Tomas-M / iotop

A top utility for IO
Other
376 stars 50 forks source link

src/iotop: correct pg_cb signature #64

Closed mikoxyz closed 6 months ago

mikoxyz commented 6 months ago

This fixes CFI due to mismatching signatures between pg_cb and pid_cb.

bbonev commented 6 months ago

Looks ok on a first glance. I need to run my tests and will merge it. Thanks!

Can you provide more info on how you discovered that and how you test for the presence of a similar problem elsewhere?

mikoxyz commented 6 months ago

On Fri Feb 23, 2024 at 3:58 PM CET, Boian Bonev wrote:

Can you provide more info on how you discovered that Simply ran an iotop build built using clang with the -fsanitize=cfi, -fno-sanitize-trap (also needs to be passed to the linker!), and -fvisibility=hidden compiler flags (see https://clang.llvm.org/docs/ControlFlowIntegrity.html for more details).

and how you test for the presence of a similar problem elsewhere? AFAIK there's no straightforward way to test that, so you're sort of limited to simply trying to run a program with CFI and see if any problems occur, that is unless you want to manually audit the code.

bbonev commented 6 months ago

Thanks for the info! TIL

I think that pidgen_cb should also be changed - I will merge this and change it.

And for the curious, here is the quick way:

CC=clang-17 CFLAGS="-fsanitize=cfi -fno-sanitize-trap -fvisibility=hidden" make re V=1