[PATCH] D105169: [Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default
Nathan Chancellor via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 29 16:26:03 PST 2021
nathanchance added a comment.
@hyeongyukim I hand reduced a couple of the translation units that I see issues in so apologies if they are a little verbose.
The full set of warnings:
drivers/net/ethernet/renesas/ravb.lto.o: warning: objtool: .text.ravb_set_gti: unexpected end of section
drivers/net/ethernet/wiznet/w5100.lto.o: warning: objtool: .text.w5100_tx_skb: unexpected end of section
drivers/net/ethernet/wiznet/w5100.lto.o: warning: objtool: .text.w5100_readbuf: unexpected end of section
drivers/video/fbdev/intelfb/intelfb.lto.o: warning: objtool: .text.intelfbhw_validate_mode: unexpected end of section
which individually can be viewed at the following links:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/renesas/ravb_main.c?h=v5.16-rc7#n2480
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/wiznet/w5100.c?h=v5.16-rc7#n798
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/wiznet/w5100.c?h=v5.16-rc7#n513
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/video/fbdev/intelfb/intelfbhw.c?h=v5.16-rc7#n313
I have a reproducer for the first two, as that is all I had time for; if you would like them for the other two, I can get those for you tomorrow.
https://github.com/nathanchance/creduce-files/tree/3699d2b725a305c0f02a7672447b30578115ba51/D105169-ravb_main
$ clang -O2 -flto=thin -fsanitize=integer-divide-by-zero -c -o ravb_main.o ravb_main.i
ravb_main.i:68:5: warning: expression result unused [-Wunused-value]
__rem;
^~~~~
1 warning generated.
$ ld.lld -m elf_x86_64 -r -o ravb.lto.o --whole-archive ravb_main.o
$ ./objtool orc generate --module --no-fp --no-unreachable --uaccess --mcount ravb.lto.o
ravb.lto.o: warning: objtool: .text.ravb_set_gti: unexpected end of section
This one can also be reproduced without LTO:
$ clang -O2 -fsanitize=integer-divide-by-zero -c -o ravb_main.o ravb_main.i
$ ./objtool orc generate --module --no-fp --no-unreachable --uaccess --mcount ravb_main.o
ravb_main.o: warning: objtool: .text: unexpected end of section
As far as I can tell, that function already has a check to avoid dividing by zero.
https://github.com/nathanchance/creduce-files/tree/3699d2b725a305c0f02a7672447b30578115ba51/D105169-w5100
$ clang -O2 -flto=thin -fsanitize=integer-divide-by-zero -c -o w5100.o w5100.i
$ ld.lld -m elf_x86_64 -r -o w5100.lto.o --whole-archive w5100.o
$ w5100.lto.o: warning: objtool: .text.w5100_tx_skb: unexpected end of section
Without LTO, another warning is emitted, with a similar root cause I believe:
$ clang -O2 -fsanitize=integer-divide-by-zero -c -o w5100.o w5100.i
$ ./objtool orc generate --module --no-fp --no-unreachable --uaccess --mcount w5100.o
w5100.o: warning: objtool: w5100_tx_skb() falls through to next function w5100_probe()
In theory, `w5100_writebuf()` should probably have a check for `s0_tx_buf_size` being zero but the input is completely controlled by the kernel, as can be seen in `w5100_probe()` (`s0_tx_buf_size` cannot be zero). Most if not all kernel maintainers are not going to accept patches adding checks that are superfluous.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105169/new/
https://reviews.llvm.org/D105169
More information about the cfe-commits
mailing list