Skip to content
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

6.4.9-zen1: Clang LTO broken #322

Closed
aidanharris opened this issue Aug 10, 2023 · 2 comments
Closed

6.4.9-zen1: Clang LTO broken #322

aidanharris opened this issue Aug 10, 2023 · 2 comments

Comments

@aidanharris
Copy link

This is a regression from 6.4.8

make defconfig
export CC=clang-16
export HOSTCC=$CC
env PATH=/usr/lib/llvm/16/bin:"$PATH" LIBCLANG_PATH=/usr/lib/llvm/16/lib64 make CC=$CC HOSTCC=$CC LLVM=1 LLVM_IAS=1 V=1 -j1
# enable thin-lto when prompted, don't enable CFI
+ ld.lld -m elf_x86_64 --thinlto-cache-dir=.thinlto-cache -mllvm -import-instr-limit=5 -z noexecstack --emit-relocs --discard-none -z max-page-size=0x200000 --build-id=sha1 --orphan-handling=error --script=./arch/x86/kernel/vmlinux.lds --strip-debug -o .tmp_vmlinux.kallsyms1 --whole-archive vmlinux.o .vmlinux.export.o init/version-timestamp.o --no-whole-archive --start-group --end-group
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:35: unable to move location counter backward for: .text
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:203: at least one side of the expression must be absolute
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:204: at least one side of the expression must be absolute
ld.lld: error: SRSO function pair won't alias
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:35: unable to move location counter backward for: .text
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:203: at least one side of the expression must be absolute
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:204: at least one side of the expression must be absolute
ld.lld: error: SRSO function pair won't alias
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:35: unable to move location counter backward for: .text
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:203: at least one side of the expression must be absolute
ld.lld: error: ./arch/x86/kernel/vmlinux.lds:204: at least one side of the expression must be absolute
ld.lld: error: SRSO function pair won't alias
@aidanharris
Copy link
Author

Toolchain info:

$ clang-16 --version
clang version 16.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/16/bin
Configuration file: /etc/clang/clang.cfg
$ ld.lld --version
LLD 16.0.6 (compatible with GNU linkers)

@damentz
Copy link
Member

damentz commented Aug 10, 2023

The v6.4.9 release was an urgent security release: https://lwn.net/Articles/940798/

Not only is this simply upstream (has nothing to do with Zen Kernel), they acknowledge they may have broken things. Stay tuned to v6.4.10 and later releases, or let them know on the mailing list that Clang LTO is broken yourself.

@damentz damentz closed this as not planned Won't fix, can't repro, duplicate, stale Aug 10, 2023
damentz pushed a commit that referenced this issue Nov 20, 2023
[ Upstream commit c5d3f9b ]

With below mount option and testcase, it hangs kernel.

1. mount -t f2fs -o compress_log_size=5 /dev/vdb /mnt/f2fs
2. touch /mnt/f2fs/file
3. chattr +c /mnt/f2fs/file
4. dd if=/dev/zero of=/mnt/f2fs/file bs=1MB count=1
5. sync
6. dd if=/dev/zero of=/mnt/f2fs/file bs=111 count=11 conv=notrunc
7. sync

INFO: task sync:4788 blocked for more than 120 seconds.
      Not tainted 6.5.0-rc1+ #322
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:sync            state:D stack:0     pid:4788  ppid:509    flags:0x00000002
Call Trace:
 <TASK>
 __schedule+0x335/0xf80
 schedule+0x6f/0xf0
 wb_wait_for_completion+0x5e/0x90
 sync_inodes_sb+0xd8/0x2a0
 sync_inodes_one_sb+0x1d/0x30
 iterate_supers+0x99/0xf0
 ksys_sync+0x46/0xb0
 __do_sys_sync+0x12/0x20
 do_syscall_64+0x3f/0x90
 entry_SYSCALL_64_after_hwframe+0x6e/0xd8

The reason is f2fs_all_cluster_page_ready() assumes that pages array should
cover at least one cluster, otherwise, it will always return false, result
in deadloop.

By default, pages array size is 16, and it can cover the case cluster_size
is equal or less than 16, for the case cluster_size is larger than 16, let's
allocate memory of pages array dynamically.

Fixes: 4c8ff70 ("f2fs: support data compression")
Signed-off-by: Chao Yu <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants