From: LEROY Christophe <christophe.leroy2@cs-soprasteria.com>
To: Greg KH <gregkh@linuxfoundation.org>, WangYuli <wangyuli@uniontech.com>
Cc: "stable@vger.kernel.org" <stable@vger.kernel.org>,
"sashal@kernel.org" <sashal@kernel.org>,
"ast@kernel.org" <ast@kernel.org>,
"keescook@chromium.org" <keescook@chromium.org>,
"linux-hardening@vger.kernel.org"
<linux-hardening@vger.kernel.org>,
"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
"song@kernel.org" <song@kernel.org>,
"puranjay12@gmail.com" <puranjay12@gmail.com>,
"daniel@iogearbox.net" <daniel@iogearbox.net>,
"andrii@kernel.org" <andrii@kernel.org>,
"martin.lau@linux.dev" <martin.lau@linux.dev>,
"yonghong.song@linux.dev" <yonghong.song@linux.dev>,
"john.fastabend@gmail.com" <john.fastabend@gmail.com>,
"kpsingh@kernel.org" <kpsingh@kernel.org>,
"sdf@google.com" <sdf@google.com>,
"haoluo@google.com" <haoluo@google.com>,
"jolsa@kernel.org" <jolsa@kernel.org>,
"illusionist.neo@gmail.com" <illusionist.neo@gmail.com>,
"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"chenhuacai@kernel.org" <chenhuacai@kernel.org>,
"kernel@xen0n.name" <kernel@xen0n.name>,
"loongarch@lists.linux.dev" <loongarch@lists.linux.dev>,
"johan.almbladh@anyfinetworks.com"
<johan.almbladh@anyfinetworks.com>,
"paulburton@kernel.org" <paulburton@kernel.org>,
"tsbogend@alpha.franken.de" <tsbogend@alpha.franken.de>,
"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
"deller@gmx.de" <deller@gmx.de>,
"linux-parisc@vger.kernel.org" <linux-parisc@vger.kernel.org>,
"iii@linux.ibm.com" <iii@linux.ibm.com>,
"hca@linux.ibm.com" <hca@linux.ibm.com>,
"gor@linux.ibm.com" <gor@linux.ibm.com>,
"agordeev@linux.ibm.com" <agordeev@linux.ibm.com>,
"borntraeger@linux.ibm.com" <borntraeger@linux.ibm.com>,
"svens@linux.ibm.com" <svens@linux.ibm.com>,
"linux-s390@vger.kernel.org" <linux-s390@vger.kernel.org>,
"davem@davemloft.net" <davem@davemloft.net>,
"sparclinux@vger.kernel.org" <sparclinux@vger.kernel.org>,
"kuba@kernel.org" <kuba@kernel.org>,
"hawk@kernel.org" <hawk@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"dsahern@kernel.org" <dsahern@kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"bp@alien8.de" <bp@alien8.de>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"x86@kernel.org" <x86@kernel.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"guanwentao@uniontech.com" <guanwentao@uniontech.com>,
"baimingcong@uniontech.com" <baimingcong@uniontech.com>
Subject: Re: [PATCH] Revert "bpf: Take return from set_memory_rox() into account with bpf_jit_binary_lock_ro()" for linux-6.6.37
Date: Mon, 8 Jul 2024 15:12:55 +0000 [thread overview]
Message-ID: <a1dac525-4e6d-4d28-87ee-63723abbafad@cs-soprasteria.com> (raw)
In-Reply-To: <2024070815-udder-charging-7f75@gregkh>
Le 08/07/2024 à 14:36, Greg KH a écrit :
> On Sun, Jul 07, 2024 at 03:34:15PM +0800, WangYuli wrote:
>>
>> On 2024/7/6 17:30, Greg KH wrote:
>>> This makes it sound like you are reverting this because of a build
>>> error, which is not the case here, right? Isn't this because of the
>>> powerpc issue reported here:
>>> https://lore.kernel.org/r/20240705203413.wbv2nw3747vjeibk@altlinux.org
>>> ?
>>
>> No, it only occurs on ARM64 architecture. The reason is that before being
>> modified, the function
>>
>> bpf_jit_binary_lock_ro() in arch/arm64/net/bpf_jit_comp.c +1651
>>
>> was introduced with __must_check, which is defined as
>> __attribute__((__warn_unused_result__)).
>>
>>
>> However, at this point, calling bpf_jit_binary_lock_ro(header)
>> coincidentally results in an unused-result
>>
>> warning.
>
> Ok, thanks, but why is no one else seeing this in their testing?
Probably the configs used by robots do not activate BPF JIT ?
>
>>> If not, why not just backport the single missing arm64 commit,
>>
>> Upstream commit 1dad391daef1 ("bpf, arm64: use bpf_prog_pack for memory
>> management") is part of
>>
>> a larger change that involves multiple commits. It's not an isolated commit.
>>
>>
>> We could certainly backport all of them to solve this problem, buthas it's not
>> the simplest solution.
>
> reverting the change feels wrong in that you will still have the bug
> present that it was trying to solve, right? If so, can you then provide
> a working version?
Indeed, by reverting the change you "punish" all architectures because
arm64 hasn't properly been backported, is it fair ?
In fact, when I implemented commit e60adf513275 ("bpf: Take return from
set_memory_rox() into account with bpf_jit_binary_lock_ro()"), we had
the following users for function bpf_jit_binary_lock_ro() :
$ git grep bpf_jit_binary_lock_ro e60adf513275~
e60adf513275~:arch/arm/net/bpf_jit_32.c:
bpf_jit_binary_lock_ro(header);
e60adf513275~:arch/loongarch/net/bpf_jit.c:
bpf_jit_binary_lock_ro(header);
e60adf513275~:arch/mips/net/bpf_jit_comp.c:
bpf_jit_binary_lock_ro(header);
e60adf513275~:arch/parisc/net/bpf_jit_core.c:
bpf_jit_binary_lock_ro(jit_data->header);
e60adf513275~:arch/s390/net/bpf_jit_comp.c:
bpf_jit_binary_lock_ro(header);
e60adf513275~:arch/sparc/net/bpf_jit_comp_64.c:
bpf_jit_binary_lock_ro(header);
e60adf513275~:arch/x86/net/bpf_jit_comp32.c:
bpf_jit_binary_lock_ro(header);
e60adf513275~:include/linux/filter.h:static inline void
bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr)
But when commit 08f6c05feb1d ("bpf: Take return from set_memory_rox()
into account with bpf_jit_binary_lock_ro()") was applied, we had one
more user which is arm64:
$ git grep bpf_jit_binary_lock_ro 08f6c05feb1d~
08f6c05feb1d~:arch/arm/net/bpf_jit_32.c:
bpf_jit_binary_lock_ro(header);
08f6c05feb1d~:arch/arm64/net/bpf_jit_comp.c:
bpf_jit_binary_lock_ro(header);
08f6c05feb1d~:arch/loongarch/net/bpf_jit.c:
bpf_jit_binary_lock_ro(header);
08f6c05feb1d~:arch/mips/net/bpf_jit_comp.c:
bpf_jit_binary_lock_ro(header);
08f6c05feb1d~:arch/parisc/net/bpf_jit_core.c:
bpf_jit_binary_lock_ro(jit_data->header);
08f6c05feb1d~:arch/s390/net/bpf_jit_comp.c:
bpf_jit_binary_lock_ro(header);
08f6c05feb1d~:arch/sparc/net/bpf_jit_comp_64.c:
bpf_jit_binary_lock_ro(header);
08f6c05feb1d~:arch/x86/net/bpf_jit_comp32.c:
bpf_jit_binary_lock_ro(header);
08f6c05feb1d~:include/linux/filter.h:static inline void
bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr)
Therefore, commit 08f6c05feb1d should have included a backport for arm64.
So yes, I agree with Greg, the correct fix should be to backport to
ARM64 the changes done on other architectures in order to properly
handle return of set_memory_rox() in bpf_jit_binary_lock_ro().
Christophe
next prev parent reply other threads:[~2024-07-08 15:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-06 3:11 [PATCH] Revert "bpf: Take return from set_memory_rox() into account with bpf_jit_binary_lock_ro()" for linux-6.6.37 WangYuli
2024-07-06 9:30 ` Greg KH
2024-07-07 7:34 ` WangYuli
2024-07-08 12:36 ` Greg KH
2024-07-08 15:12 ` LEROY Christophe [this message]
2024-07-09 9:15 ` Greg KH
2024-07-09 9:24 ` LEROY Christophe
2024-07-09 9:39 ` Greg KH
2024-07-09 10:03 ` LEROY Christophe
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a1dac525-4e6d-4d28-87ee-63723abbafad@cs-soprasteria.com \
--to=christophe.leroy2@cs-soprasteria.com \
--cc=agordeev@linux.ibm.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=baimingcong@uniontech.com \
--cc=borntraeger@linux.ibm.com \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=daniel@iogearbox.net \
--cc=dave.hansen@linux.intel.com \
--cc=davem@davemloft.net \
--cc=deller@gmx.de \
--cc=dsahern@kernel.org \
--cc=gor@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=guanwentao@uniontech.com \
--cc=haoluo@google.com \
--cc=hawk@kernel.org \
--cc=hca@linux.ibm.com \
--cc=hpa@zytor.com \
--cc=iii@linux.ibm.com \
--cc=illusionist.neo@gmail.com \
--cc=johan.almbladh@anyfinetworks.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=keescook@chromium.org \
--cc=kernel@xen0n.name \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=loongarch@lists.linux.dev \
--cc=martin.lau@linux.dev \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=paulburton@kernel.org \
--cc=puranjay12@gmail.com \
--cc=sashal@kernel.org \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=sparclinux@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=svens@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=tsbogend@alpha.franken.de \
--cc=wangyuli@uniontech.com \
--cc=x86@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox