Re: [PATCH] bpf: defer printk() inside __bpf_prog_run()

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

 



On Wed, 26 Jun 2024 09:02:22 +0900
Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:

> On 2024/06/26 8:56, Alexei Starovoitov wrote:
> > You are missing the point. The bug has nothing to do with bpf.  
> 
> The bug is caused by calling tracing hooks with rq lock held.
> If tracing hooks do not exist, this bug does not exist.

Could you expand on this. What tracing hooks are called with rq lock
held? You mean the scheduling events?

> 
> > It can happen without any bpf loaded. Exactly the same way.
> > should_fail_usercopy() is called on all user accesses.  
> 
> Not all callers of e.g. should_fail_usercopy() are holding rq lock.

Sorry, but if a function is going to call printk and can be called in
any context that has rq locks held, then it should be doing the printk
deferred and preempt disable logic, and not expect the caller of it to
do that dirty work. Otherwise this will expand out of control.

The same goes with calling spin_lock_irq() vs spin_lock_irqsave(). If a
function is called with interrupts disabled sometimes and sometimes
not, it needs the irqsave() version. We don't make all callers of it
disable interrupts.

-- Steve




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux