Re: [PATCH net] net/bpfilter: initialize pos in __bpfilter_process_sockopt

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

 



On 8/1/20 9:48 PM, Alexei Starovoitov wrote:
On Fri, Jul 31, 2020 at 02:07:42AM +0200, Daniel Borkmann wrote:
On 7/30/20 6:13 PM, Christian Brauner wrote:
On Thu, Jul 30, 2020 at 06:09:00PM +0200, Christoph Hellwig wrote:
__bpfilter_process_sockopt never initialized the pos variable passed to
the pipe write.  This has been mostly harmless in the past as pipes
ignore the offset, but the switch to kernel_write no verified the

s/no/now/

position, which can lead to a failure depending on the exact stack
initialization patter.  Initialize the variable to zero to make

s/patter/pattern/

rw_verify_area happy.

Fixes: 6955a76fbcd5 ("bpfilter: switch to kernel_write")
Reported-by: Christian Brauner <christian.brauner@xxxxxxxxxx>
Reported-by: Rodrigo Madera <rodrigo.madera@xxxxxxxxx>
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Tested-by: Rodrigo Madera <rodrigo.madera@xxxxxxxxx>
---

Thanks for tracking this down, Christoph! This fixes the logging issue
for me.
Tested-by: Christian Brauner <christian.brauner@xxxxxxxxxx>
Reviewed-by: Christian Brauner <christian.brauner@xxxxxxxxxx>

Applied to bpf & fixed up the typos in the commit msg, thanks everyone!

Daniel,
why is it necessary in bpf tree?

I fixed it already in bpf-next in commit a4fa458950b4 ("bpfilter: Initialize pos variable")
two weeks ago...

Several folks reported that with v5.8-rc kernels their console is spammed with
'bpfilter: write fail' messages [0]. Given this affected the 5.8 release and
the fix was a one-line change, it felt appropriate to route it there. Why was
a4fa458950b4 not pushed into bpf tree given it was affected there too? Either
way, we can undo the double pos assignment upon tree sync..

  [0] https://lore.kernel.org/lkml/20200727104636.nuz3u4xb7ba7ue5a@wittgenstein/



[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