I got a gdb backtrace for the openat syscall of /etc/passwd. This is with glibc 2.31:
#0 __GI___open64_nocancel (file=0x7ffff7df715e "/etc/passwd", oflag=524288) at ../sysdeps/unix/sysv/linux/open64_nocancel.c:45 #1 0x00007ffff7e82185 in __GI__IO_file_open (fp=fp@entry=0x5555555596b0, filename=<optimized out>, posix_mode=<optimized out>, prot=prot@entry=438, read_write=8, is32not64=<optimized out>) at fileops.c:186 #2 0x00007ffff7e822aa in _IO_new_file_fopen (fp=fp@entry=0x5555555596b0, filename=filename@entry=0x7ffff7df715e "/etc/passwd", mode=<optimized out>, mode@entry=0x7ffff7df7003 "rce", is32not64=is32not64@entry=1) at fileops.c:281 #3 0x00007ffff7e75c09 in __fopen_internal ( filename=filename@entry=0x7ffff7df715e "/etc/passwd", mode=mode@entry=0x7ffff7df7003 "rce", is32=is32@entry=1) at iofopen.c:75 #4 0x00007ffff7e75c8a in _IO_new_fopen ( filename=filename@entry=0x7ffff7df715e "/etc/passwd", mode=mode@entry=0x7ffff7df7003 "rce") at iofopen.c:86 #5 0x00007ffff7df37a0 in internal_setent (stream=<synthetic pointer>) at nss_files/files-XXX.c:77 #6 _nss_files_getpwnam_r (name=0x7fffffffe38a "root", result=0x7fffffffdf10, buffer=0x5555555592a0 "", buflen=1024, errnop=0x7ffff7fc74c0) at nss_files/files-pwd.c:32 #7 0x00007ffff7ecb4f3 in __getpwnam_r (name=0x7fffffffe38a "root", resbuf=0x7fffffffdf10, buffer=0x5555555592a0 "", buflen=1024, result=<optimized out>) at ../nss/getXXbyYY_r.c:315 #8 0x0000555555555266 in main (argc=2, argv=0x7fffffffe058) at test.c:30 fopen gets called here: https://sources.debian.org/src/glibc/2.31-17/nss/nss_files/files-XXX.c/#L77 This is with glibc 2.32: #0 __GI___open64_nocancel (file=0x7ffff7db104f "/etc/passwd", oflag=524288) at ../sysdeps/unix/sysv/linux/open64_nocancel.c:45 #1 0x00007ffff7e369d5 in __GI__IO_file_open (fp=fp@entry=0x5555555596b0, filename=<optimized out>, posix_mode=<optimized out>, prot=prot@entry=438, read_write=8, is32not64=<optimized out>) at fileops.c:186 #2 0x00007ffff7e36afa in _IO_new_file_fopen (fp=fp@entry=0x5555555596b0, filename=filename@entry=0x7ffff7db104f "/etc/passwd", mode=<optimized out>, mode@entry=0x7ffff7f3f08e "rce", is32not64=is32not64@entry=1) at fileops.c:281 #3 0x00007ffff7e2a829 in __fopen_internal (filename=filename@entry=0x7ffff7db104f "/etc/passwd", mode=mode@entry=0x7ffff7f3f08e "rce", is32=is32@entry=1) at iofopen.c:75 #4 0x00007ffff7e2a8aa in _IO_new_fopen (filename=filename@entry=0x7ffff7db104f "/etc/passwd", mode=mode@entry=0x7ffff7f3f08e "rce") at iofopen.c:86 #5 0x00007ffff7ed7dbe in __GI___nss_files_fopen (path=path@entry=0x7ffff7db104f "/etc/passwd") at nss_files_fopen.c:27 #6 0x00007ffff7dac3cc in internal_setpwent (ent=ent@entry=0x7fffffffde70, stayopen=stayopen@entry=0, needent=needent@entry=0) at nss_compat/compat-pwd.c:227 #7 0x00007ffff7dad76a in _nss_compat_getpwnam_r (name=0x7fffffffe479 "josch", pwd=0x7fffffffe020, buffer=0x5555555592a0 "", buflen=1024, errnop=0x7ffff7f7c4c8) at nss_compat/compat-pwd.c:829 #8 0x00007ffff7e801e3 in __getpwnam_r (name=0x7fffffffe479 "josch", resbuf=0x7fffffffe020, buffer=0x5555555592a0 "", buflen=1024, result=<optimized out>) at ../nss/getXXbyYY_r.c:315 #9 0x0000555555555266 in main (argc=2, argv=0x7fffffffe168) at test.c:30 fopen gets called here: https://sources.debian.org/src/glibc/2.32-2/nss/nss_files_fopen.c/#L27 But why is the fopen of 2.32 different from the one in 2.31?
signature.asc
Description: signature