BPF Archive on lore.kernel.org
 help / color / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Christian Brauner <christian.brauner@ubuntu.com>,
	Christoph Hellwig <hch@lst.de>,
	davem@davemloft.net, kuba@kernel.org, ast@kernel.org,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	Rodrigo Madera <rodrigo.madera@gmail.com>
Subject: Re: [PATCH net] net/bpfilter: initialize pos in __bpfilter_process_sockopt
Date: Mon, 3 Aug 2020 16:56:35 +0200
Message-ID: <c166831a-d506-3a4e-80ed-f0474079770d@iogearbox.net> (raw)
In-Reply-To: <20200801194846.dxmvg5fmg67nuhwy@ast-mbp.dhcp.thefacebook.com>

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@ubuntu.com>
>>>> Reported-by: Rodrigo Madera <rodrigo.madera@gmail.com>
>>>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>>>> Tested-by: Rodrigo Madera <rodrigo.madera@gmail.com>
>>>> ---
>>> Thanks for tracking this down, Christoph! This fixes the logging issue
>>> for me.
>>> Tested-by: Christian Brauner <christian.brauner@ubuntu.com>
>>> Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
>> 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/

  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-30 16:09 Christoph Hellwig
2020-07-30 16:13 ` Christian Brauner
2020-07-31  0:07   ` Daniel Borkmann
2020-08-01 19:48     ` Alexei Starovoitov
2020-08-03 14:56       ` Daniel Borkmann [this message]
2020-08-03 15:36         ` Rodrigo Madera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c166831a-d506-3a4e-80ed-f0474079770d@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=christian.brauner@ubuntu.com \
    --cc=davem@davemloft.net \
    --cc=hch@lst.de \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rodrigo.madera@gmail.com \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git