[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200320154633.GB765793@kroah.com>
Date: Fri, 20 Mar 2020 16:46:33 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Yonghong Song <yhs@...com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>,
Andrii Nakryiko <andriin@...com>, netdev@...r.kernel.org,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org,
Maciej Żenczykowski <maze@...gle.com>,
John Stultz <john.stultz@...aro.org>,
Alexander Potapenko <glider@...gle.com>,
Alistair Delva <adelva@...gle.com>
Subject: Re: [PATCH] bpf: explicitly memset the bpf_attr structure
On Fri, Mar 20, 2020 at 08:23:57AM -0700, Yonghong Song wrote:
>
>
> On 3/20/20 2:48 AM, Greg Kroah-Hartman wrote:
> > For the bpf syscall, we are relying on the compiler to properly zero out
> > the bpf_attr union that we copy userspace data into. Unfortunately that
> > doesn't always work properly, padding and other oddities might not be
> > correctly zeroed, and in some tests odd things have been found when the
> > stack is pre-initialized to other values.
>
> Maybe add more contexts about the failure itself so it could be clear
> why we need this patch.
I didn't have the full details, I think Maciej has them though.
> As far as I know from the link below, the failure happens in
> CHECK_ATTR() which checks any unused *area* for a particular subcommand
> must be 0, and this patch tries to provide this guarantee beyond
> area beyond min(uattr_size, sizeof(attr)).
That macro also will get tripped up if padding is not zeroed out as
well, so this is good to fix up.
thanks for the review.
greg k-h
Powered by blists - more mailing lists