From: Vlastimil Babka <vbabka@suse.cz>
To: Linux regressions mailing list <regressions@lists.linux.dev>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Mohammad Shehar Yaar Tausif <sheharyaar48@gmail.com>
Cc: "Martin KaFai Lau" <martin.lau@linux.dev>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"John Fastabend" <john.fastabend@gmail.com>,
"KP Singh" <kpsingh@kernel.org>,
"Stanislav Fomichev" <sdf@google.com>,
"Hao Luo" <haoluo@google.com>, "Jiri Olsa" <jolsa@kernel.org>,
bpf <bpf@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
"Javier Carrasco" <javier.carrasco.cruz@gmail.com>,
"Christian Kujau" <lists@nerdbynature.de>,
"Péter Ujfalusi" <peter.ujfalusi@intel.com>,
"Lorenzo Stoakes" <lstoakes@gmail.com>,
"Suren Baghdasaryan" <surenb@google.com>,
"Kent Overstreet" <kent.overstreet@linux.dev>
Subject: Re: [PATCH RESEND] bpf: fix order of args in call to bpf_map_kvcalloc
Date: Tue, 9 Jul 2024 17:14:02 +0200 [thread overview]
Message-ID: <2c9089c9-4314-4e4a-a7e2-2dd09716962f@suse.cz> (raw)
In-Reply-To: <270804d4-b751-4ac9-99b2-80e364288c37@leemhuis.info>
On 7/8/24 10:20 AM, Linux regression tracking (Thorsten Leemhuis) wrote:
> [CCing the regressions list and people mentioned below]
>
> On 12.06.24 16:53, Alexei Starovoitov wrote:
>> On Wed, Jun 12, 2024 at 2:51 AM Mohammad Shehar Yaar Tausif
>> <sheharyaar48@gmail.com> wrote:
>>>
>>> The original function call passed size of smap->bucket before the number of
>>> buckets which raises the error 'calloc-transposed-args' on compilation.
>>>
>>> Fixes: 62827d612ae5 ("bpf: Remove __bpf_local_storage_map_alloc")
>>> Reviewed-by: Andrii Nakryiko <andrii@kernel.org>
>>> Signed-off-by: Mohammad Shehar Yaar Tausif <sheharyaar48@gmail.com>
>>> ---
>>> - already merged in linux-next
>>> - [1] suggested sending as a fix for 6.10 cycle
>>
>> No. It's not a fix.
>
> If you have a minute, could you please explain why that is? From what I
> can see a quite a few people run into build problems with 6.10-rc
> recently that are fixed by the patch:
>
> * Péter Ujfalusi
> https://lore.kernel.org/bpf/363ad8d1-a2d2-4fca-b66a-3d838eb5def9@intel.com/
>
> * Christian Kujau
> https://lore.kernel.org/bpf/48360912-b239-51f2-8f25-07a46516dc76@nerdbynature.de/
> https://lore.kernel.org/lkml/d0dd2457-ab58-1b08-caa4-93eaa2de221e@nerdbynature.de/
>
> * Lorenzo Stoakes
> https://fosstodon.org/@ljs@social.kernel.org/112734050799590482
>
> At the same time I see that the culprit mentioned above is from 6.4-rc1,
IIUC the order was wrong even before, but see below.
> so I guess it there must be some other reason why a few people seem to
> tun into this now. Did some other change expose this problem? Or are
> updated compilers causing this?
I think it's because of 2c321f3f70bc ("mm: change inlined allocation helpers
to account at the call site"), which was added in 6.10-rc1 and thus makes
this technically a 6.10 regression after all. So what triggers the bug is
AFAICS the following together:
- gcc-14 (didn't see it with gcc-13)
- commit 2c321f3f70bc that makes bpf_map_kvcalloc a macro that does
kvcalloc() directly instead of static inline function wrapping it for
!CONFIG_MEMCG
- CONFIG_MEMCG=n in .config
The fix is so trivial, it's better to include it in 6.10 even this late.
> Ciao, Thorsten
>
>>> [1] https://lore.kernel.org/all/363ad8d1-a2d2-4fca-b66a-3d838eb5def9@intel.com/
>>> ---
>>> kernel/bpf/bpf_local_storage.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c
>>> index 976cb258a0ed..c938dea5ddbf 100644
>>> --- a/kernel/bpf/bpf_local_storage.c
>>> +++ b/kernel/bpf/bpf_local_storage.c
>>> @@ -782,8 +782,8 @@ bpf_local_storage_map_alloc(union bpf_attr *attr,
>>> nbuckets = max_t(u32, 2, nbuckets);
>>> smap->bucket_log = ilog2(nbuckets);
>>>
>>> - smap->buckets = bpf_map_kvcalloc(&smap->map, sizeof(*smap->buckets),
>>> - nbuckets, GFP_USER | __GFP_NOWARN);
>>> + smap->buckets = bpf_map_kvcalloc(&smap->map, nbuckets,
>>> + sizeof(*smap->buckets), GFP_USER | __GFP_NOWARN);
>>> if (!smap->buckets) {
>>> err = -ENOMEM;
>>> goto free_smap;
>>>
>>> ---
>>> base-commit: 2ef5971ff345d3c000873725db555085e0131961
>>> change-id: 20240612-master-fe9e63ab5c95
>>>
>>> Best regards,
>>> --
>>> Mohammad Shehar Yaar Tausif <sheharyaar48@gmail.com>
>>>
next prev parent reply other threads:[~2024-07-09 15:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-12 9:51 Mohammad Shehar Yaar Tausif
2024-06-12 14:53 ` Alexei Starovoitov
2024-07-08 8:20 ` Linux regression tracking (Thorsten Leemhuis)
2024-07-08 8:41 ` Lorenzo Stoakes
2024-07-09 15:14 ` Vlastimil Babka [this message]
2024-07-09 15:39 ` Suren Baghdasaryan
2024-07-09 18:11 ` Alexei Starovoitov
2024-07-10 10:05 ` [PATCH for 6.10] " Vlastimil Babka
2024-07-10 10:27 ` Christian Kujau
2024-07-10 22:36 ` Alexei Starovoitov
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=2c9089c9-4314-4e4a-a7e2-2dd09716962f@suse.cz \
--to=vbabka@suse.cz \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kent.overstreet@linux.dev \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lists@nerdbynature.de \
--cc=lstoakes@gmail.com \
--cc=martin.lau@linux.dev \
--cc=peter.ujfalusi@intel.com \
--cc=regressions@lists.linux.dev \
--cc=sdf@google.com \
--cc=sheharyaar48@gmail.com \
--cc=song@kernel.org \
--cc=surenb@google.com \
--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
all inboxes | Powered by JetHome®