-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: improve firejail's error messaging #3325
base: master
Are you sure you want to change the base?
Conversation
Heh, classic "640k is enough for everybody" case: I had 64 variables, so I thought 100 would be more than enough for everybody... Perhaps the limit should be higher, say 256? This would total 256 * (4096+32) ~ 1M, which should not be enough for a stack smashing attack, at least on 64 bit systems. I'd perhaps improve errExit() and use it everywhere than add prefix to everywhere. That can be done independently of this commit too. |
@topimiettinen Thanks for pointing out the rationale behind the limit. I was not familiar with the notion of a
That would be awesome! In this context I noticed several C files also have the following construct:
I suppose these are different than errExit(), or can they be integrated /rewritten using that function too? Apologies for the 'absolute-beginner-C' question. A basic understanding of the language and its constructs have been on my todo list for a while, but life always seems to find a way to creep in :) Pointers to sound introductory stuff is still very welcome though. |
Variadic or printf-like functions, which can take any number of arguments and then process them (typically based on a format string as first and mandatory argument), need to use special C constructs for variadic arguments, see man stdarg. It should be possible to make errExit() variadic. Since Firejail is only targeting Linux, we could simplify errExit() a lot by using "%m" instead of sprintf(), perror() etc. Also it should be an inlined function ( |
I think there could be some issue with how environment variables are being counted in the original commit: 8825856. I am also being considered over the What I do have set is the env variable for configuring If I remove this env var, firejail works again as expected. Could it be that this variable is wrongly being counted as a large number of env variables, exceeding the limit? |
@Ryujinra Good question. In the current code |
Yep, this makes sense. My |
@Ryujinra So you seem only affected by
|
Splitting does not help, the environment variable will be the same. This bash alias seems to work:
It means that the environment variable is only set for the |
The issue with this is if you use something like vivid to autogenerate the |
My example is static, there's no regeneration. If you want vivid to be used only when .bashrc is read, something like this should work:
|
Yes, this workaround works for me now. Tested with latest master and no longer get the env var length error. |
If we want users to reduce number of environments, we may hint to [shameless copied]. System wide
User specific
It is a shame that it is cluttered like that. |
One of those days on a rolling release OS. Both kernel and systemd just got upgraded, together with a few dozen other packages. After a reboot frustration levels upped as my main dev machine was only barely alive. After taking a long outdoor reflective breather I started to rebuild a few mission-critical packages.
Error: too many environment variables
. Exit. No sender. No return address. No nothing.This strangely mixed crystal clear and utterly cryptic message had apparently started to pop-up left and right. Sure, I use plenty of these env vars (134 according to
env
), but never had I been told I use too many :) After more digging it turned out I had been bitten by a newly introduced sane maximum number of environment variables. Going over the commit in question rapidly improved my mood. At last I had found something I could relate to: didn't pass the 'sanity check' :) Took care of upping the number to accomodate my 134 vars in my firejail-git PKGBUILD.Nothing wrong with setting a limit, nor with drawing the line at 100. In fact probably a very wise thing to do as a sandbox application. All sarcasm aside, a slightly more contextual indication of the originator of the error message(s) would have helped. This WIP is a minimalistic first attempt to do just that, nothing more, nothing less. For now it only touched error messages directly followed by exit(1) that didn't already mention {F,f}irejail in the error text. I did notice the errExit("foo") defined in common.h but decided to not touch that yet and await comments/suggestions.