* [PATCH perf/core] uprobes: guard against kmemdup() failing in dup_return_instance()
@ 2024-12-06 18:34 Andrii Nakryiko
2024-12-06 19:01 ` [tip: perf/core] uprobes: Guard " tip-bot2 for Andrii Nakryiko
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Andrii Nakryiko @ 2024-12-06 18:34 UTC (permalink / raw)
To: linux-trace-kernel, peterz, mingo
Cc: oleg, rostedt, mhiramat, bpf, linux-kernel, jolsa, liaochang1,
kernel-team, Andrii Nakryiko
If kmemdup() failed to alloc memory, don't proceed with extra_consumers
copy.
Fixes: e62f2d492728 ("uprobes: Simplify session consumer tracking")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
kernel/events/uprobes.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 1af950208c2b..1f75a2f91206 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -2048,6 +2048,8 @@ static struct return_instance *dup_return_instance(struct return_instance *old)
struct return_instance *ri;
ri = kmemdup(old, sizeof(*ri), GFP_KERNEL);
+ if (!ri)
+ return NULL;
if (unlikely(old->cons_cnt > 1)) {
ri->extra_consumers = kmemdup(old->extra_consumers,
--
2.43.5
^ permalink raw reply [flat|nested] 5+ messages in thread* [tip: perf/core] uprobes: Guard against kmemdup() failing in dup_return_instance()
2024-12-06 18:34 [PATCH perf/core] uprobes: guard against kmemdup() failing in dup_return_instance() Andrii Nakryiko
@ 2024-12-06 19:01 ` tip-bot2 for Andrii Nakryiko
2024-12-09 10:32 ` tip-bot2 for Andrii Nakryiko
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Andrii Nakryiko @ 2024-12-06 19:01 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Andrii Nakryiko, Ingo Molnar, x86, linux-kernel
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 64fb80679287a6dd0acd9c8afa259054a2479a52
Gitweb: https://git.kernel.org/tip/64fb80679287a6dd0acd9c8afa259054a2479a52
Author: Andrii Nakryiko <andrii@kernel.org>
AuthorDate: Fri, 06 Dec 2024 10:34:36 -08:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 06 Dec 2024 19:52:47 +01:00
uprobes: Guard against kmemdup() failing in dup_return_instance()
If kmemdup() failed to alloc memory, don't proceed with extra_consumers
copy.
Fixes: e62f2d492728 ("uprobes: Simplify session consumer tracking")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20241206183436.968068-1-andrii@kernel.org
---
kernel/events/uprobes.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 1af9502..1f75a2f 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -2048,6 +2048,8 @@ static struct return_instance *dup_return_instance(struct return_instance *old)
struct return_instance *ri;
ri = kmemdup(old, sizeof(*ri), GFP_KERNEL);
+ if (!ri)
+ return NULL;
if (unlikely(old->cons_cnt > 1)) {
ri->extra_consumers = kmemdup(old->extra_consumers,
^ permalink raw reply [flat|nested] 5+ messages in thread* [tip: perf/core] uprobes: Guard against kmemdup() failing in dup_return_instance()
2024-12-06 18:34 [PATCH perf/core] uprobes: guard against kmemdup() failing in dup_return_instance() Andrii Nakryiko
2024-12-06 19:01 ` [tip: perf/core] uprobes: Guard " tip-bot2 for Andrii Nakryiko
@ 2024-12-09 10:32 ` tip-bot2 for Andrii Nakryiko
2024-12-09 11:13 ` [PATCH perf/core] uprobes: guard " Masami Hiramatsu
2024-12-09 14:55 ` [tip: perf/core] uprobes: Guard " tip-bot2 for Andrii Nakryiko
3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Andrii Nakryiko @ 2024-12-09 10:32 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Andrii Nakryiko, Ingo Molnar, x86, linux-kernel
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 638331f34c3f19f5bf14611ec6092ca1ba0ceb51
Gitweb: https://git.kernel.org/tip/638331f34c3f19f5bf14611ec6092ca1ba0ceb51
Author: Andrii Nakryiko <andrii@kernel.org>
AuthorDate: Fri, 06 Dec 2024 10:34:36 -08:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 09 Dec 2024 11:18:08 +01:00
uprobes: Guard against kmemdup() failing in dup_return_instance()
If kmemdup() failed to alloc memory, don't proceed with extra_consumers
copy.
Fixes: e62f2d492728 ("uprobes: Simplify session consumer tracking")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20241206183436.968068-1-andrii@kernel.org
---
kernel/events/uprobes.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 1af9502..1f75a2f 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -2048,6 +2048,8 @@ static struct return_instance *dup_return_instance(struct return_instance *old)
struct return_instance *ri;
ri = kmemdup(old, sizeof(*ri), GFP_KERNEL);
+ if (!ri)
+ return NULL;
if (unlikely(old->cons_cnt > 1)) {
ri->extra_consumers = kmemdup(old->extra_consumers,
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH perf/core] uprobes: guard against kmemdup() failing in dup_return_instance()
2024-12-06 18:34 [PATCH perf/core] uprobes: guard against kmemdup() failing in dup_return_instance() Andrii Nakryiko
2024-12-06 19:01 ` [tip: perf/core] uprobes: Guard " tip-bot2 for Andrii Nakryiko
2024-12-09 10:32 ` tip-bot2 for Andrii Nakryiko
@ 2024-12-09 11:13 ` Masami Hiramatsu
2024-12-09 14:55 ` [tip: perf/core] uprobes: Guard " tip-bot2 for Andrii Nakryiko
3 siblings, 0 replies; 5+ messages in thread
From: Masami Hiramatsu @ 2024-12-09 11:13 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: linux-trace-kernel, peterz, mingo, oleg, rostedt, mhiramat, bpf,
linux-kernel, jolsa, liaochang1, kernel-team
On Fri, 6 Dec 2024 10:34:36 -0800
Andrii Nakryiko <andrii@kernel.org> wrote:
> If kmemdup() failed to alloc memory, don't proceed with extra_consumers
> copy.
>
> Fixes: e62f2d492728 ("uprobes: Simplify session consumer tracking")
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Looks good to me.
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thanks!
> ---
> kernel/events/uprobes.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index 1af950208c2b..1f75a2f91206 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -2048,6 +2048,8 @@ static struct return_instance *dup_return_instance(struct return_instance *old)
> struct return_instance *ri;
>
> ri = kmemdup(old, sizeof(*ri), GFP_KERNEL);
> + if (!ri)
> + return NULL;
>
> if (unlikely(old->cons_cnt > 1)) {
> ri->extra_consumers = kmemdup(old->extra_consumers,
> --
> 2.43.5
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread* [tip: perf/core] uprobes: Guard against kmemdup() failing in dup_return_instance()
2024-12-06 18:34 [PATCH perf/core] uprobes: guard against kmemdup() failing in dup_return_instance() Andrii Nakryiko
` (2 preceding siblings ...)
2024-12-09 11:13 ` [PATCH perf/core] uprobes: guard " Masami Hiramatsu
@ 2024-12-09 14:55 ` tip-bot2 for Andrii Nakryiko
3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Andrii Nakryiko @ 2024-12-09 14:55 UTC (permalink / raw)
To: linux-tip-commits; +Cc: Andrii Nakryiko, Ingo Molnar, x86, linux-kernel
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 02c56362a7d3eccc209d5c00d73a06513d2504d5
Gitweb: https://git.kernel.org/tip/02c56362a7d3eccc209d5c00d73a06513d2504d5
Author: Andrii Nakryiko <andrii@kernel.org>
AuthorDate: Fri, 06 Dec 2024 10:34:36 -08:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Mon, 09 Dec 2024 15:50:32 +01:00
uprobes: Guard against kmemdup() failing in dup_return_instance()
If kmemdup() failed to alloc memory, don't proceed with extra_consumers
copy.
Fixes: e62f2d492728 ("uprobes: Simplify session consumer tracking")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20241206183436.968068-1-andrii@kernel.org
---
kernel/events/uprobes.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 1af9502..1f75a2f 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -2048,6 +2048,8 @@ static struct return_instance *dup_return_instance(struct return_instance *old)
struct return_instance *ri;
ri = kmemdup(old, sizeof(*ri), GFP_KERNEL);
+ if (!ri)
+ return NULL;
if (unlikely(old->cons_cnt > 1)) {
ri->extra_consumers = kmemdup(old->extra_consumers,
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-09 14:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-06 18:34 [PATCH perf/core] uprobes: guard against kmemdup() failing in dup_return_instance() Andrii Nakryiko
2024-12-06 19:01 ` [tip: perf/core] uprobes: Guard " tip-bot2 for Andrii Nakryiko
2024-12-09 10:32 ` tip-bot2 for Andrii Nakryiko
2024-12-09 11:13 ` [PATCH perf/core] uprobes: guard " Masami Hiramatsu
2024-12-09 14:55 ` [tip: perf/core] uprobes: Guard " tip-bot2 for Andrii Nakryiko
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®