-
Notifications
You must be signed in to change notification settings - Fork 1k
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
ASAN runtime SEGVs after a recursive glob() #1654
Comments
Any chance you can point to the source and provide some reproduction instructions? |
Unfortunately, not. As hinted at the end of my posting
so it is pretty buried deep within our product's usage. When I read the code in advance of submitting the bug, it was clear that setting |
This reproduces it for me with glibc 2.39-0ubuntu8.3, both using gcc 13.3.0-6ubuntu2~24.04 and clang 18.1.3 (1ubuntu1). (There must exist some files under the filesystem root.)
|
Thanks, John. (Keeping your hands dirty, I see...) |
The address sanitizer runtime SEGVs after a recursive glob(). I needn’t.
This is because after calling the real glob and swapping things back, it does an unconditional
pglob_copy = 0;
When the outer (intercepted) glob later tries to dereference pglob_copy, it will SEGV near address 0, in our environment at 0x28 in wrapped_gl_readdir trying to get the caller’s readdir function.
It should instead capture the previous value and restore it only if it set it.
Why do we do recursive glob()? We use the GLOB_ALTDIRFUNC feature, and in the opendir function (HDFS, though that doesn’t really matter), it constructs a URL and invokes curl routines on it. Curl eventually wanders into this backtrace which I feel comfortable sharing:
#0 0x00002b2ffda38cd4 in glob () from libasan.so.4
#1 0x00002b2ffd7c9615 in loadConfigFiles () from libgssapi_krb5.so.2
#2 0x00002b2ffd7c967f in updateMechList () from libgssapi_krb5.so.2
#3 0x00002b2ffd7c9199 in build_mechSet () from libgssapi_krb5.so.2
#4 0x00002b2ffd7c90ae in gss_indicate_mechs () from libgssapi_krb5.so.2
#5 0x00002b2ffd7d05ae in gss_indicate_mechs_by_attrs () from libgssapi_krb5.so.2
#6 0x00002b2ffd7f865b in get_available_mechs () from libgssapi_krb5.so.2
#7 0x00002b2ffd7f8854 in get_negotiable_mechs () from libgssapi_krb5.so.2
#8 0x00002b2ffd7f4e73 in init_ctx_new () from libgssapi_krb5.so.2
#9 0x00002b2ffd7f57bd in spnego_gss_init_sec_context () from libgssapi_krb5.so.2
#10 0x00002b2ffd7c8a3a in gss_init_sec_context () from libgssapi_krb5.so.2
It’s not that we’re trying to do a recursive glob(), it’s that our code calls HDFS stuff which calls CURL which calls GSSAPI_KRB5 which wants to glob configuration files:
(gdb) x/s $rdi
0x2b2ffd7b08b8: "…/etc/gss/mech.d/*.conf"
The text was updated successfully, but these errors were encountered: