-
Notifications
You must be signed in to change notification settings - Fork 26
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
(RHEL-55266) Return ESRCH if userdb service refuses a user/group name as invalid #302
base: main
Are you sure you want to change the base?
Conversation
Commit validationTracker - RHEL-55266 The following commits meet all requirements
Tracker validationSuccess🟢 Tracker RHEL-55266 has set desired product: Pull Request validationFailed🔴 Failed or pending checks - Success🟢 Review - Reviewed by a member |
@dtardon I have noticed that this PR references two issues. Could you please split it into two PRs? Thank you. |
Otherwise hilarity ensues: AddressSanitizer:DEADLYSIGNAL ================================================================= ==722==ERROR: AddressSanitizer: SEGV on unknown address 0xffffffff00000000 (pc 0x7f8d50ca9ffb bp 0x7fff11b0d4a0 sp 0x7fff11b0cc30 T0) ==722==The signal is caused by a READ memory access. #0 0x7f8d50ca9ffb in __interceptor_strcmp.part.0 (/lib64/libasan.so.8+0xa9ffb) redhat-plumbers#1 0x7f8d4f9cf5a1 in strcmp_ptr ../src/fundamental/string-util-fundamental.h:33 redhat-plumbers#2 0x7f8d4f9cf5f8 in streq_ptr ../src/fundamental/string-util-fundamental.h:46 redhat-plumbers#3 0x7f8d4f9d74d2 in free_and_strdup ../src/basic/string-util.c:948 redhat-plumbers#4 0x49139a in free_and_strdup_warn ../src/basic/string-util.h:197 redhat-plumbers#5 0x4923eb in oci_absolute_path ../src/nspawn/nspawn-oci.c:139 redhat-plumbers#6 0x7f8d4f6bd359 in json_dispatch ../src/shared/json.c:4395 redhat-plumbers#7 0x4a8831 in oci_hooks_array ../src/nspawn/nspawn-oci.c:2089 redhat-plumbers#8 0x7f8d4f6bd359 in json_dispatch ../src/shared/json.c:4395 redhat-plumbers#9 0x4a8b56 in oci_hooks ../src/nspawn/nspawn-oci.c:2112 redhat-plumbers#10 0x7f8d4f6bd359 in json_dispatch ../src/shared/json.c:4395 redhat-plumbers#11 0x4aa298 in oci_load ../src/nspawn/nspawn-oci.c:2197 redhat-plumbers#12 0x446cec in load_oci_bundle ../src/nspawn/nspawn.c:4744 redhat-plumbers#13 0x44ffa7 in run ../src/nspawn/nspawn.c:5477 redhat-plumbers#14 0x4552fb in main ../src/nspawn/nspawn.c:5920 redhat-plumbers#15 0x7f8d4e04a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f) redhat-plumbers#16 0x7f8d4e04a5c8 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x275c8) redhat-plumbers#17 0x40d284 in _start (/usr/bin/systemd-nspawn+0x40d284) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV (/lib64/libasan.so.8+0xa9ffb) in __interceptor_strcmp.part.0 ==722==ABORTING (cherry picked from commit f4e5c04) Related: RHEL-55266
varlink_dispatch() is a simple wrapper around json_dispatch() that returns clean, standards-compliant InvalidParameter error back to clients, if the specified JSON cannot be parsed properly. For this json_dispatch() is extended to return the offending field's name. Because it already has quite a few parameters, I then renamed json_dispatch() to json_dispatch_full() and made json_dispatch() a wrapper around it that passes the new argument as NULL. While doing so I figured we should also get rid of the bad= argument in the short wrapper, since it's only used in the OCI code. To simplify the OCI code this adds a second wrapper oci_dispatch() around json_dispatch_full(), that fills in bad= the way we want. Net result: instead of one json_dispatch() call there are now: 1. json_dispatch_full() for the fully feature mother of all dispathers. 2. json_dispatch() for the simpler version that you want to use most of the time. 3. varlink_dispatch() that generates nice Varlink errors 4. oci_dispatch() that does the OCI specific error handling And that's all there is. (cherry picked from commit f1b622a) Related: RHEL-55266
This is the same as json_dispatch_user_group_name() but fills in the string as "const char*" to the JSON field. Or in other words, it's what sd_json_dispatch_const_string() is to sd_json_dispatch_string(). Note this drops the SD_JSON_STRICT flags from various dispatch tables for these fields, and replaces this by SD_JSON_RELAX, i.e. the opposite behaviour. As #34558 correctly suggests we should validate user names in lookup functions using the lax rules, rather than the strict ones, since clients not knowing the rules might ask us for arbitrary resolution. (SD_JSON_RELAX internally translates to valid_user_group_name() with the VALID_USER_RELAX flag). See: #34558 (cherry picked from commit 0376ef36a1ff3768ad0c833f215064e34b40b86c) Related: RHEL-55266
(cherry picked from commit 12641ecd67875b7bf18db06c0afa40c37d804750) Related: RHEL-55266
…nvalid if a userdb service refuse a user/group name as invalid, let's turn this into ESRCH client-side following that there definitely is no user/group record for a completely invalid user/group name. Replaces: #34558 (cherry picked from commit 69cc4ee134f420dcdd6aac08446bd852d8739694) Resolves: RHEL-55266
The references to RHEL-55301 are a mistake. Fixed. |
f79303d
to
575675c
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.
As per CI results it seems that backport doesn't compile due to issues with json-util.h include. @dtardon can you please double check.
Resolves: RHEL-55266