-
Notifications
You must be signed in to change notification settings - Fork 0
Dracut cpio-reflink feature detection #1
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
Conversation
dinfo() requires dracut-init.sh to be loaded.
The cpio-reflink feature requires certain features of the file system and system configuratino and is incompatible with certain other options. Make sure settings are consistent.
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 Martin! I'll collapse the dinfo
fix in with my current upstream submission.
Regarding the is_reflink_supported()
change - I'd prefer to only print a warning, rather than have it disable the explicitly enabled reflink option.
Well, you did the same in your code (albeit only if The relationship between the various options is a different issue. My idea was:
I did not distinguish whether This is to to explain my line of thought. Feel free to modify this logic as you see fit. But if there are contradictory / inconsistent options, we must do something about it. |
I completely agree that these options should be consistent.
Thanks for the explanation :-) |
Why the extra effort?
I have no doubt about that. But I was using a different definition of "work", see below.
My thinking (which obviously doesn't fully match yours) was that this option activates space-efficient initrd generation by making use of reflinks. Therefore I'd prefer a simpler option name such as Please take off your developer 🎩 for a while 😄. From a user perspective, it only matters whether reflinks are used, not which cpio executable creates them.
Command line options set the - |
dracut.sh already uses
I'd be more inclined to say that the user doesn't care whether or not reflinks are used, they just want things to be as fast as possible. dracut-cpio should provide that in all cases, as data will either be reflinked or (when not available) be copied in kernel via I plan on updating the PR today with compression support and your fix squashed in. |
I missed a couple of other points...
It's not much in the way of effort, the ...
Thanks. I overlooked this, so will add |
I'm going to close this downstream PR. Please raise any further questions / concerns against the upstream PR at dracutdevs#1531 . I think it probably does still make sense to retain the |
in install_dependent_modules we use &path[kerneldirlen] as the key for inserting, let's do the same for checking. otherwise installing kernel module has circular dependency from a custom kernel module directory will cause infinite recursion and segfault. $ grep ipmi kbuilt/lib/modules/5.10.121/modules.dep kernel/drivers/char/ipmi/ipmi_msghandler.ko: kernel/drivers/char/ipmi/ipmi_devintf.ko: kernel/drivers/char/ipmi/ipmi_msghandler.ko $ grep ipmi kbuilt/lib/modules/5.10.121/modules.softdep softdep ipmi_msghandler post: ipmi_devintf $ ./dracut-install -D /tmp --kerneldir ~/working/kernel/linux-5.10.121/kbuilt/lib/modules/5.10.121 -m ipmi-devintf Segmentation fault (core dumped) (gdb) b install_dependent_modules Breakpoint 1 at 0x7db0: file src/install/dracut-install.c, line 1513. (gdb) bt #0 install_dependent_modules (modlist=0x0) at src/install/dracut-install.c:1513 #1 0x000055555555c027 in install_dependent_modules (modlist=modlist@entry=0x555555579e90) at src/install/dracut-install.c:1553 dracutdevs#2 0x000055555555bf1c in install_dependent_modules (modlist=0x5555555799d0) at src/install/dracut-install.c:1548 dracutdevs#3 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555557a3f0) at src/install/dracut-install.c:1554 dracutdevs#4 0x000055555555bf1c in install_dependent_modules (modlist=0x555555579d60) at src/install/dracut-install.c:1548 dracutdevs#5 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555557b170) at src/install/dracut-install.c:1554 dracutdevs#6 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557a0f0) at src/install/dracut-install.c:1548 dracutdevs#7 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x555555575320) at src/install/dracut-install.c:1554 dracutdevs#8 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557ab30) at src/install/dracut-install.c:1548 dracutdevs#9 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555557dd60) at src/install/dracut-install.c:1554 dracutdevs#10 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557b640) at src/install/dracut-install.c:1548 dracutdevs#11 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555557e0f0) at src/install/dracut-install.c:1554 dracutdevs#12 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557b9d0) at src/install/dracut-install.c:1548 dracutdevs#13 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x555555574340) at src/install/dracut-install.c:1554 dracutdevs#14 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557cf70) at src/install/dracut-install.c:1548 dracutdevs#15 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x5555555768d0) at src/install/dracut-install.c:1554 dracutdevs#16 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557d750) at src/install/dracut-install.c:1548 dracutdevs#17 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555557e700) at src/install/dracut-install.c:1554 dracutdevs#18 0x000055555555bf1c in install_dependent_modules (modlist=0x55555557de90) at src/install/dracut-install.c:1548 dracutdevs#19 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x555555581c90) at src/install/dracut-install.c:1554 dracutdevs#20 0x000055555555bf1c in install_dependent_modules (modlist=0x555555571e60) at src/install/dracut-install.c:1548 dracutdevs#21 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555556b620) at src/install/dracut-install.c:1554 dracutdevs#22 0x000055555555bf1c in install_dependent_modules (modlist=0x555555583000) at src/install/dracut-install.c:1548 dracutdevs#23 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x55555556b640) at src/install/dracut-install.c:1554 dracutdevs#24 0x000055555555bf1c in install_dependent_modules (modlist=0x555555571b40) at src/install/dracut-install.c:1548 dracutdevs#25 0x000055555555c034 in install_dependent_modules (modlist=modlist@entry=0x555555574100) at src/install/dracut-install.c:1554 dracutdevs#26 0x000055555555c4b0 in install_module (mod=mod@entry=0x555555573bc0) at src/install/dracut-install.c:1617 dracutdevs#27 0x000055555555c93d in install_modules (argc=argc@entry=1, argv=argv@entry=0x7fffffffd6e0) at src/install/dracut-install.c:1952 dracutdevs#28 0x000055555555862a in main (argc=<optimized out>, argv=0x7fffffffd6a8) at src/install/dracut-install.c:2090 Signed-off-by: runsisi <[email protected]>
The MacBook Pro 2017 (MacBookPro14,1) connects the keyboard via SPI: ``` $ dmesg input: Apple SPI Keyboard as /devices/pci0000:00/0000:00:1e.3/pxa2xx-spi.3/spi_master/spi2/spi-APP000D:00/input/input4 ``` The SPI controller requires the `intel_lpss_pci` kernel module: ``` $ lspci -vv 00:1e.3 Signal processing controller: Intel Corporation Sunrise Point-LP Serial IO SPI Controller #1 (rev 21) Subsystem: Intel Corporation Sunrise Point-LP Serial IO SPI Controller Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx- Latency: 0, Cache Line Size: 256 bytes Interrupt: pin D routed to IRQ 23 Region 0: Memory at 9282c000 (64-bit, non-prefetchable) [size=4K] Capabilities: [80] Power Management version 3 Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-) Status: D3 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- Capabilities: [90] Vendor Specific Information: Len=14 <?> Kernel driver in use: intel-lpss Kernel modules: intel_lpss_pci ``` Fedora builds `intel_lpss_pci` into the kernel: ``` $ grep INTEL_LPSS_PCI /lib/modules/6.5.11-300.fc39.x86_64/config CONFIG_MFD_INTEL_LPSS_PCI=y ``` But Ubuntu builds `intel_lpss_pci` only as module: ``` $ grep INTEL_LPSS_PCI /boot/config-6.5.0-10-generic CONFIG_MFD_INTEL_LPSS_PCI=m ``` So explicitly include `intel_lpss_pci` to support the keyboard. Bug-Ubuntu: https://launchpad.net/bugs/2042710 fixes: df381b7 ("feat(kernel-modules): driver support for macbook keyboards") Signed-off-by: Benjamin Drung <[email protected]>
Sudhakar Verma from the Ubuntu security team found a memory corruption: ``` $ pwd /tmp/dracut-ng/src/util $ CC=clang-17 CXX=clang++-17 CFLAGS="-fsanitize=address" cmake . -- The C compiler identification is Clang 17.0.6 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/clang-17 - skipped -- Detecting C compile features -- Detecting C compile features - done -- Configuring done (0.3s) -- Generating done (0.0s) -- Build files have been written to: /tmp/dracut-ng/src/util $ CC=clang-17 CXX=clang++-17 CFLAGS="-fsanitize=address" make [ 50%] Building C object CMakeFiles/dracut-util.dir/util.c.o [100%] Linking C executable dracut-util [100%] Built target dracut-util $ ln -s $PWD/dracut-util dracut-getargs $ ln -s $PWD/dracut-util dracut-getarg $ CMDLINE=' "' ./dracut-getarg ' ' AddressSanitizer:DEADLYSIGNAL ================================================================= ==163118==ERROR: AddressSanitizer: SEGV on unknown address 0x50210000001d (pc 0x599a6b7d4c07 bp 0x7ffe44ea9ef0 sp 0x7ffe44ea9da0 T0) ==163118==The signal is caused by a READ memory access. #0 0x599a6b7d4c07 in next_arg util.c #1 0x599a6b7d3e75 in getarg util.c dracutdevs#2 0x599a6b7d3448 in main (/tmp/dracut-ng/src/util/dracut-util+0x108448) (BuildId: ea28a61b3c6dd0a75c505cd1749f8711779bd819) dracutdevs#3 0x72381be2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 dracutdevs#4 0x72381be2a28a in __libc_start_main csu/../csu/libc-start.c:360:3 dracutdevs#5 0x599a6b6f7304 in _start (/tmp/dracut-ng/src/util/dracut-util+0x2c304) (BuildId: ea28a61b3c6dd0a75c505cd1749f8711779bd819) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV util.c in next_arg ==163118==ABORTING ``` The variable `i` in `next_arg` is an unsigned integeter. `i - 1` will result in an underflow in case `i` is 0.
Hi David,
here are 2 patches, the first fixes a minor issue in your code, the 2nd adds autodetection for cpio-reflink which we discussed in Jira.
Martin