-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
lib/posix-environ: Ensure that compiled-in strings are writable #1054
lib/posix-environ: Ensure that compiled-in strings are writable #1054
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. One minor point is the leading underscore in the variable name. Unless there is a strong reason to be there it should be changed to something in compliance with our guidelines.
I noticed that @skuenzer likes using those 😝. |
I have to admit that this is true. I liked them for things to mark them as "do not touch", especially when they are part of a system declared in the file/library. But since we have our convention, we can change it. In this sense @michpappas is right that we should be a good example for other contributors. |
d0b74b9
to
1a354e1
Compare
1a354e1
to
a7aa288
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-by: Michalis Pappas michalis@unikraft.io
Previously, the elements of `__init_env` would be compile-in strings that would correspond to `CONFIG_LIBPOSIX_ENVIRON_ENVPx` configurable strings. This lead to these strings being placed by in the `.rodata` section and making them unmodifiable. Unfortunately, Redis represents an application whose code may want to modify such data (see commit 6356cf6808be ("Set process name in ps output to make operations safer.")). Therefore, to appease such actions, make sure that this data is placed in a modifiable section such as `.data` by using statically declared global variables containing these very strings as an indirection. To make it look somewhat nicer, do so with the help of two basic helper macros: DECLARE_LIBPOSIX_ENVIRON_ENV_VAR to transparently declare such variables and LIBPOSIX_ENVIRON_ENV_VAR to transparently access them. Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
a7aa288
to
97918b2
Compare
Beep boop! I ran Unikraft's
Truncated logs starting from first warning 97918b2:
View complete logs | Learn more about Unikraft's coding style and contribution guidelines. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for these changes!
Approved-by: Simon Kuenzer simon@unikraft.io
Previously, the elements of
__init_env
would be compile-in stringsthat would correspond to
CONFIG_LIBPOSIX_ENVIRON_ENVPx
configurablestrings. This lead to these strings being placed by in the
.rodata
section and making them unmodifiable.
Unfortunately, Redis represents an application whose code may want to
modify such data (see
commit 6356cf6808be ("Set process name in ps output to make operations safer.").
Therefore, to appease such actions, make sure that this data is placed
in a modifiable section such as
.data
by using statically declaredglobal variables containing these very strings as an indirection.
To make it look somewhat nicer, do so with the help of two basic helper
macros: DECLARE_LIBPOSIX_ENVIRON_ENV_VAR to transparently declare such
variables and LIBPOSIX_ENVIRON_ENV_VAR to transparently access them.
Signed-off-by: Sergiu Moga sergiu@unikraft.io
Prerequisite checklist
checkpatch.uk
on your commit series before opening this PR;Base target
Additional configuration
Description of changes