Re: [PATCH 1/1] block: prevent calls to should_fail_bio() optimized by gcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Apr 21, 2025, at 4:51 AM, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
> 
> On Thu, Apr 17, 2025 at 09:34:32AM -0700, Prasad Singamsetty wrote:
>> When CONFIG_FAIL_MAKE_REQUEST is not enabled, gcc may optimize out
>> calls to should_fail_bio() because the content of should_fail_bio()
>> is empty returning always 'false'. The gcc compiler then detects
>> the function call to should_fail_bio() being empty and optimizes
>> out the call to it.
> 
> Yes, that's intentional and a good thing becaue we don't want to pay
> the overhead for the fault injetion helper.
> 
>> This prevents block I/O error injection programs
>> attached to it from working. The compiler is not aware of the side
>> effect of calling this probe function.
> 
> I can't see any attachment.  But if this is a bpf program or kernel
> module using kprobes then there is absolutely zero expectation that
> a static inline function actually exists in the binary kernel, so
> you should not rely on that.
> 

Thank you Christoph, for the clarifications and comments. Yes, it is a bpf program that
gets loaded/attached to the kprobe function, should_fail_bio(). We used this program
for a use case for block i/o filtering and it was working fine until we moved to gcc 14
compiler. Kernel has this kprobe function defined so the bpf program gets attached
fine but not getting invoked as the call is optimized out.

Agree that any additional overhead to this code path is not acceptable and
in this case it is an existing overhead prior to the latest compiler version usage.

We are also aware of the block filter project that was active and not sure about
the current status of it. We will look into that. 

Thanks,
—Prasad








[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux