fix(dracut-install): remove FTS_NOSTAT in install_modules() fts traversal#2394
fix(dracut-install): remove FTS_NOSTAT in install_modules() fts traversal#2394jpoimboe wants to merge 1 commit into
Conversation
aafeijoo-suse
left a comment
There was a problem hiding this comment.
Thanks for fixing this well before the glibc 2.44 release. I tested dracut + glibc from git main without and with your patch and I can confirm its critical.
All the fts_open() in dracut-install have the FTS_NOSTAT flag, but the fts_info value is only filtered for directories.
FTR, I'm not sure the current glibc status in other distros, but openSUSE Tumbleweed ships 2.42, while 2.43 is in staging, so there is still time until dracut breaks the system if it's not fixed.
Ok, so it's already affecting rawhide. Let's wait and see if dracut is not the only one affected by this change. |
|
Yeah, that's how I discovered it, I couldn't boot my kernel on Rawhide :-) |
|
The draft patch is dubious, because if |
Alternatively, if efficiency is important (and I guess it is, if you're using |
I don't know about special kernel builds, but with the ones I tested, packaged and shipped by the distro, since we are traversing the kernel file tree, where we had |
Sure, but if all you have are directories and regular files, then the existing test But surely that test was put in for a reason. dracut is checking for files that are neither directories nor regular files nor symbolic links because it wants to ignore them. And that means the patch originally proposed in this pull request cannot be right, because in some cases it would cause dracut to fail to ignore these files. |
10 years ago without any comments, so unfortunately the reason is unknown.
Ack. I wonder which kernel source code tree files fail outside of these 3 categories. Maybe |
Head branch was pushed to by a user without write access
…rsal install_modules() uses FTS_NOSTAT when traversing kernel module directories. With FTS_NOSTAT, fts may skip stat() and report regular files as FTS_NSOK instead of FTS_F. However, the fts_info check only accepts FTS_F and FTS_SL, causing all .ko files found this way to be silently skipped. This was previously masked by glibc's fts implementation which ignored FTS_NOSTAT when FTS_LOGICAL was also set, always calling stat and returning FTS_F. A recent glibc change (commit 99303f3871, "io: Use gnulib fts implementation") now honors FTS_NOSTAT regardless, exposing this bug. The result is that all '=directory' pattern module installs (=drivers, =crypto, =fs, etc.) find zero modules, producing an initramfs with only explicitly-named modules (~40 instead of ~500+), which typically fails to boot. Fix it by removing FTS_NOSTAT so that fts always stats files and reliably reports actual file types.
|
Agreed, I changed it to remove FTS_NOSTAT so the existing error checking behavior for non-files and non-symlinks continues to work. |
|
I guess it was just defensive programming back in the days... FTS_NOSTAT was of course only for speed, which in hindsight did not do anything 😄 |
…rsal install_modules() uses FTS_NOSTAT when traversing kernel module directories. With FTS_NOSTAT, fts may skip stat() and report regular files as FTS_NSOK instead of FTS_F. However, the fts_info check only accepts FTS_F and FTS_SL, causing all .ko files found this way to be silently skipped. This was previously masked by glibc's fts implementation which ignored FTS_NOSTAT when FTS_LOGICAL was also set, always calling stat and returning FTS_F. A recent glibc change (commit 99303f3871, "io: Use gnulib fts implementation") now honors FTS_NOSTAT regardless, exposing this bug. The result is that all '=directory' pattern module installs (=drivers, =crypto, =fs, etc.) find zero modules, producing an initramfs with only explicitly-named modules (~40 instead of ~500+), which typically fails to boot. Fix it by removing FTS_NOSTAT so that fts always stats files and reliably reports actual file types. (cherry picked from dracut-ng#2394)
…rsal install_modules() uses FTS_NOSTAT when traversing kernel module directories. With FTS_NOSTAT, fts may skip stat() and report regular files as FTS_NSOK instead of FTS_F. However, the fts_info check only accepts FTS_F and FTS_SL, causing all .ko files found this way to be silently skipped. This was previously masked by glibc's fts implementation which ignored FTS_NOSTAT when FTS_LOGICAL was also set, always calling stat and returning FTS_F. A recent glibc change (commit 99303f3871, "io: Use gnulib fts implementation") now honors FTS_NOSTAT regardless, exposing this bug. The result is that all '=directory' pattern module installs (=drivers, =crypto, =fs, etc.) find zero modules, producing an initramfs with only explicitly-named modules (~40 instead of ~500+), which typically fails to boot. Fix it by removing FTS_NOSTAT so that fts always stats files and reliably reports actual file types. (cherry picked from dracut-ng#2394)
install_modules() uses FTS_NOSTAT when traversing kernel module directories. With FTS_NOSTAT, fts may skip stat() and report regular files as FTS_NSOK instead of FTS_F. However, the fts_info check only accepts FTS_F and FTS_SL, causing all .ko files found this way to be silently skipped.
This was previously masked by glibc's fts implementation which ignored FTS_NOSTAT when FTS_LOGICAL was also set, always calling stat and returning FTS_F. A recent glibc change (commit 99303f3871, "io: Use gnulib fts implementation") now honors FTS_NOSTAT regardless, exposing this bug.
The result is that all '=directory' pattern module installs (=drivers, =crypto, =fs, etc.) find zero modules, producing an initramfs with only explicitly-named modules (~40 instead of ~500+), which typically fails to boot.
Fix it by checking for FTS_NSOK.
Checklist