* [GIT PULL] probes: Fixes for v6.12-rc4-2
@ 2024-10-23 14:36 Masami Hiramatsu
2024-10-24 21:05 ` Linus Torvalds
2024-10-24 21:29 ` pr-tracker-bot
0 siblings, 2 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2024-10-23 14:36 UTC (permalink / raw)
To: Linus Torvalds
Cc: Leo Yan, Mikel Rychliski, Viktor Malik, Steven Rostedt,
linux-kernel, Masami Hiramatsu
Hi Linus,
Probes fixes for v6.12-rc4(2):
- objpool: Fix choosing allocation for percpu slots
Fixes to allocate objpool's percpu slots correctly according to the
GFP flag. It checks whether "any bit" in GFP_ATOMIC is set to choose
the vmalloc source, but it should check "all bits" in GFP_ATOMIC flag
is set, because GFP_ATOMIC is a combined flag.
- tracing/probes: Fix MAX_TRACE_ARGS limit handling
If more than MAX_TRACE_ARGS are passed for creating a probe event, the
entries over MAX_TRACE_ARG in trace_arg array are not initialized.
Thus if the kernel accesses those entries, it crashes. This rejects
creating event if the number of arguments is over MAX_TRACE_ARGS.
- tracing: Consider the NULL character when validating the event length
A strlen() is used when parsing the event name, and the original code
does not consider the terminal null byte. Thus it can pass the name
1 byte longer than the buffer. This fixes to check it correctly.
Please pull the latest probes-fixes-v6.12-rc4.2 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
probes-fixes-v6.12-rc4.2
Tag SHA1: 62eeda86599cd8c8fe92b4bc6181ef6d2c1e6e03
Head SHA1: 0b6e2e22cb23105fcb171ab92f0f7516c69c8471
Leo Yan (1):
tracing: Consider the NULL character when validating the event length
Mikel Rychliski (1):
tracing/probes: Fix MAX_TRACE_ARGS limit handling
Viktor Malik (1):
objpool: fix choosing allocation for percpu slots
----
kernel/trace/trace_eprobe.c | 7 ++++++-
kernel/trace/trace_fprobe.c | 6 +++++-
kernel/trace/trace_kprobe.c | 6 +++++-
kernel/trace/trace_probe.c | 2 +-
kernel/trace/trace_uprobe.c | 4 +++-
lib/objpool.c | 2 +-
6 files changed, 21 insertions(+), 6 deletions(-)
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [GIT PULL] probes: Fixes for v6.12-rc4-2
2024-10-23 14:36 [GIT PULL] probes: Fixes for v6.12-rc4-2 Masami Hiramatsu
@ 2024-10-24 21:05 ` Linus Torvalds
2024-10-25 3:09 ` Masami Hiramatsu
2024-10-24 21:29 ` pr-tracker-bot
1 sibling, 1 reply; 4+ messages in thread
From: Linus Torvalds @ 2024-10-24 21:05 UTC (permalink / raw)
To: Masami Hiramatsu
Cc: Leo Yan, Mikel Rychliski, Viktor Malik, Steven Rostedt, linux-kernel
On Wed, 23 Oct 2024 at 07:36, Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> - objpool: Fix choosing allocation for percpu slots
>
> Fixes to allocate objpool's percpu slots correctly according to the
> GFP flag. It checks whether "any bit" in GFP_ATOMIC is set to choose
> the vmalloc source, but it should check "all bits" in GFP_ATOMIC flag
> is set, because GFP_ATOMIC is a combined flag.
So the old code was buggy, but I don't think the new code is wonderful either.
For example, it does not recognized GFP_NOWAIT, which has very similar
characteristics to GFP_ATOMIC (it's basically the same thing as
GFP_ATOMIC, but without the "try to allocate urgently", and with an
added "don't warn on failure" as a result).
So what I think that code *should* test for is "can I sleep".
Which is indicated by __GFP_IO or __GFP_FS (and, I guess also
__GFP_DIRECT_RECLAIM).
Linus
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [GIT PULL] probes: Fixes for v6.12-rc4-2
2024-10-24 21:05 ` Linus Torvalds
@ 2024-10-25 3:09 ` Masami Hiramatsu
0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2024-10-25 3:09 UTC (permalink / raw)
To: Linus Torvalds
Cc: Leo Yan, Mikel Rychliski, Viktor Malik, Steven Rostedt, linux-kernel
On Thu, 24 Oct 2024 14:05:08 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Wed, 23 Oct 2024 at 07:36, Masami Hiramatsu <mhiramat@kernel.org> wrote:
> >
> > - objpool: Fix choosing allocation for percpu slots
> >
> > Fixes to allocate objpool's percpu slots correctly according to the
> > GFP flag. It checks whether "any bit" in GFP_ATOMIC is set to choose
> > the vmalloc source, but it should check "all bits" in GFP_ATOMIC flag
> > is set, because GFP_ATOMIC is a combined flag.
>
> So the old code was buggy, but I don't think the new code is wonderful either.
Agreed.
>
> For example, it does not recognized GFP_NOWAIT, which has very similar
> characteristics to GFP_ATOMIC (it's basically the same thing as
> GFP_ATOMIC, but without the "try to allocate urgently", and with an
> added "don't warn on failure" as a result).
>
> So what I think that code *should* test for is "can I sleep".
>
> Which is indicated by __GFP_IO or __GFP_FS (and, I guess also
> __GFP_DIRECT_RECLAIM).
This code is for switching __vmalloc_node() to kmalloc_node() based on
GFP_ATOMIC, because __vmalloc_node() does not support GFP_ATOMIC.
---
/**
* __vmalloc_node_range - allocate virtually contiguous memory
...
*
* Allocate enough pages to cover @size from the page level
* allocator with @gfp_mask flags. Please note that the full set of gfp
* flags are not supported. GFP_KERNEL, GFP_NOFS and GFP_NOIO are all
* supported.
---
(BTW, the above kerneldoc is a bit outdated, because the function name
has been changed to `__vmalloc_node_range_noprof()`)
As above said, it supports GFP_KENEL & GFP_NOFS & GFP_NOIO, which
means __GFP_RECLAIM (= ___GFP_DIRECT_RECLAIM|___GFP_KSWAPD_RECLAIM) is
required.
Since GFP_ATOMIC is __GFP_HIGH | __GFP_KSWAPD_RECLAIM, the difference
is ___GFP_DIRECT_RECLAIM is not set if GFP_ATOMIC is specified.
But I don't want to touch such bitflags deeper. What about simply
masking with GFP_ATOMIC | GFP_KERNEL? I mean
if ((gfp & (GFP_ATOMIC | GFP_KERNEL)) == GFP_ATOMIC)
/* use kmalloc_node() because vmalloc does not support GFP_ATOMIC */
slot = kmalloc_node(...)
else
slot = __vmalloc_node(...)
Or, simply failback to kmalloc_node() if __vmalloc_node() fails.
(I think this is more robust.)
slot = __vmalloc_node(...)
if (!slot)
slot = kmalloc_node(...)
(Note that slot is freed by kvfree() so either works)
Thank you,
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [GIT PULL] probes: Fixes for v6.12-rc4-2
2024-10-23 14:36 [GIT PULL] probes: Fixes for v6.12-rc4-2 Masami Hiramatsu
2024-10-24 21:05 ` Linus Torvalds
@ 2024-10-24 21:29 ` pr-tracker-bot
1 sibling, 0 replies; 4+ messages in thread
From: pr-tracker-bot @ 2024-10-24 21:29 UTC (permalink / raw)
To: Masami Hiramatsu (Google)
Cc: Linus Torvalds, Leo Yan, Mikel Rychliski, Viktor Malik,
Steven Rostedt, linux-kernel, Masami Hiramatsu
The pull request you sent on Wed, 23 Oct 2024 23:36:00 +0900:
> git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git probes-fixes-v6.12-rc4.2
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/c2cd8e4592c04b6725611ccce60f2d0f85383f09
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-25 3:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-23 14:36 [GIT PULL] probes: Fixes for v6.12-rc4-2 Masami Hiramatsu
2024-10-24 21:05 ` Linus Torvalds
2024-10-25 3:09 ` Masami Hiramatsu
2024-10-24 21:29 ` pr-tracker-bot
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®