mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: #syz test
       [not found] <20260520084826.6246-1-souradiptodas6@gmail.com>
@ 2026-05-20  8:48 ` syzbot
  0 siblings, 0 replies; 6+ messages in thread
From: syzbot @ 2026-05-20  8:48 UTC (permalink / raw)
  To: souradiptodas6; +Cc: souradiptodas6, linux-kernel, syzkaller-bugs

> From c3f773691e3c568d67d8628ffd4b7cf25ba8e150 Mon Sep 17 00:00:00 2001
> From: Souradipto Das <souradiptodas6@gmail.com>
> Date: Wed, 20 May 2026 14:11:05 +0530
> Subject: [PATCH] #syz test KVM: x86/xen: Secure gpc refresh_lock mutual
>  exclusion in shared info init
>
> ---
>  arch/x86/kvm/xen.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c
> index 91fd3673c09a..421e4359ce0d 100644
> --- a/arch/x86/kvm/xen.c
> +++ b/arch/x86/kvm/xen.c
> @@ -45,6 +45,8 @@ static int kvm_xen_shared_info_init(struct kvm *kvm)
>  	int ret = 0;
>  	int idx = srcu_read_lock(&kvm->srcu);
>  
> +	mutex_lock(&gpc->refresh_lock);
> +
>  	read_lock_irq(&gpc->lock);
>  	while (!kvm_gpc_check(gpc, PAGE_SIZE)) {
>  		read_unlock_irq(&gpc->lock);
> @@ -101,6 +103,7 @@ static int kvm_xen_shared_info_init(struct kvm *kvm)
>  	kvm_make_all_cpus_request(kvm, KVM_REQ_MASTERCLOCK_UPDATE);
>  
>  out:
> +	mutex_unlock(&gpc->refresh_lock);
>  	srcu_read_unlock(&kvm->srcu, idx);
>  	return ret;
>  }
> -- 
> 2.43.0
>

This crash does not have a reproducer. I cannot test it.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: #syz test
  2026-02-08 20:09   ` kawada
@ 2026-02-09  7:50     ` kawada
  0 siblings, 0 replies; 6+ messages in thread
From: kawada @ 2026-02-09  7:50 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, syzkaller-bugs


[-- Attachment #1.1: Type: text/plain, Size: 3479 bytes --]

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
 master

2026年2月9日(月) 5:09 kawada <youjingxiaogao2@gmail.com>:

> #syz test: git://
> git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>
> 2026年2月9日(月) 5:03 syzbot <
> syzbot+3609b9b48e68e1fe47fd@syzkaller.appspotmail.com>:
>
>> > #syz test git://
>> git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>> > master
>> >
>> > From d5153b84b90fa80ee0d041d1bd28bd465f7913ec Mon Sep 17 00:00:00 2001
>> > From: Masahiro Kawada <youjingxiaogao2@gmail.com>
>> > Date: Mon, 9 Feb 2026 04:47:14 +0900
>> > Subject: [PATCH] Bluetooth: fix use-after-free in hci_conn_drop
>> >
>> > Fix a use-after-free in hci_conn_drop triggered via hci_cmd_sync_work.
>> >
>> > In hci_conn_del(), hci_cmd_sync_dequeue() is called after
>> > hci_conn_cleanup() which may have already freed the conn pointer.
>> > Fix by moving the dequeue before cleanup.
>> >
>> > Additionally, le_read_features_complete() calls hci_conn_drop(conn)
>> > without checking whether conn is still valid. When
>> > hci_le_read_remote_features_sync() blocks waiting for an HCI event,
>> > another thread can free conn through hci_conn_del(). Fix by adding
>> > a hci_conn_valid() check before calling hci_conn_drop().
>> >
>> > Reported-by: syzbot+3609b9b48e68e1fe47fd@syzkaller.appspotmail.com
>> > Closes: https://syzkaller.appspot.com/bug?extid=3609b9b48e68e1fe47fd
>> > Signed-off-by: Masahiro Kawada <youjingxiaogao2@gmail.com>
>> > ---
>> >  net/bluetooth/hci_conn.c | 6 +++---
>> >  net/bluetooth/hci_sync.c | 3 +++
>> >  2 files changed, 6 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
>> > index 0795818963a..aa3607327ad 100644
>> > --- a/net/bluetooth/hci_conn.c
>> > +++ b/net/bluetooth/hci_conn.c
>> > @@ -1232,15 +1232,15 @@ void hci_conn_del(struct hci_conn *conn)
>> >   skb_queue_purge(&conn->data_q);
>> >   skb_queue_purge(&conn->tx_q.queue);
>> >
>> > + /* Dequeue callbacks using connection pointer as data */
>> > + hci_cmd_sync_dequeue(hdev, NULL, conn, NULL);
>> > +
>> >   /* Remove the connection from the list and cleanup its remaining
>> >   * state. This is a separate function since for some cases like
>> >   * BT_CONNECT_SCAN we *only* want the cleanup part without the
>> >   * rest of hci_conn_del.
>> >   */
>> >   hci_conn_cleanup(conn);
>> > -
>> > - /* Dequeue callbacks using connection pointer as data */
>> > - hci_cmd_sync_dequeue(hdev, NULL, conn, NULL);
>> >  }
>> >
>> >  struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src, uint8_t
>> > src_type)
>> > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
>> > index f04a90bce4a..f31086c187f 100644
>> > --- a/net/bluetooth/hci_sync.c
>> > +++ b/net/bluetooth/hci_sync.c
>> > @@ -7371,6 +7371,9 @@ static void le_read_features_complete(struct
>> hci_dev
>> > *hdev, void *data, int err)
>> >   if (err == -ECANCELED)
>> >   return;
>> >
>> > + if (!hci_conn_valid(hdev, conn))
>> > + return;
>> > +
>> >   hci_conn_drop(conn);
>> >  }
>> >
>> > --
>> > 2.43.0
>>
>> Command #2:
>> I've failed to parse your command.
>> Did you perhaps forget to provide the branch name, or added an extra ':'?
>> Please use one of the two supported formats:
>> 1. #syz test
>> 2. #syz test: repo branch-or-commit-hash
>> Note the lack of ':' in option 1.
>>
>>

[-- Attachment #1.2: Type: text/html, Size: 5078 bytes --]

[-- Attachment #2: 0001-Bluetooth-fix-use-after-free-in-hci_conn_drop.patch --]
[-- Type: application/octet-stream, Size: 2579 bytes --]

From d5153b84b90fa80ee0d041d1bd28bd465f7913ec Mon Sep 17 00:00:00 2001
From: Masahiro Kawada <youjingxiaogao2@gmail.com>
Date: Mon, 9 Feb 2026 04:47:14 +0900
Subject: [PATCH] Bluetooth: fix use-after-free in hci_conn_drop

Fix a use-after-free in hci_conn_drop triggered via hci_cmd_sync_work.

In hci_conn_del(), hci_cmd_sync_dequeue() is called after
hci_conn_cleanup() which may have already freed the conn pointer.
Fix by moving the dequeue before cleanup.

Additionally, le_read_features_complete() calls hci_conn_drop(conn)
without checking whether conn is still valid. When
hci_le_read_remote_features_sync() blocks waiting for an HCI event,
another thread can free conn through hci_conn_del(). Fix by adding
a hci_conn_valid() check before calling hci_conn_drop().

Fixes: 881559af5f5c ("Bluetooth: hci_sync: Attempt to dequeue connection attempt")
Fixes: a106e50be74b ("Bluetooth: HCI: Add support for LL Extended Feature Set")
Reported-by: syzbot+3609b9b48e68e1fe47fd@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3609b9b48e68e1fe47fd
Tested-by: syzbot+3609b9b48e68e1fe47fd@syzkaller.appspotmail.com
Signed-off-by: Masahiro Kawada <youjingxiaogao2@gmail.com>
---
 net/bluetooth/hci_conn.c | 6 +++---
 net/bluetooth/hci_sync.c | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 0795818963a..aa3607327ad 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1232,15 +1232,15 @@ void hci_conn_del(struct hci_conn *conn)
 	skb_queue_purge(&conn->data_q);
 	skb_queue_purge(&conn->tx_q.queue);
 
+	/* Dequeue callbacks using connection pointer as data */
+	hci_cmd_sync_dequeue(hdev, NULL, conn, NULL);
+
 	/* Remove the connection from the list and cleanup its remaining
 	 * state. This is a separate function since for some cases like
 	 * BT_CONNECT_SCAN we *only* want the cleanup part without the
 	 * rest of hci_conn_del.
 	 */
 	hci_conn_cleanup(conn);
-
-	/* Dequeue callbacks using connection pointer as data */
-	hci_cmd_sync_dequeue(hdev, NULL, conn, NULL);
 }
 
 struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src, uint8_t src_type)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index f04a90bce4a..f31086c187f 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -7371,6 +7371,9 @@ static void le_read_features_complete(struct hci_dev *hdev, void *data, int err)
 	if (err == -ECANCELED)
 		return;
 
+	if (!hci_conn_valid(hdev, conn))
+		return;
+
 	hci_conn_drop(conn);
 }
 
-- 
2.43.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: #syz test
  2026-02-08 20:03 ` syzbot
@ 2026-02-08 20:09   ` kawada
  2026-02-09  7:50     ` kawada
  0 siblings, 1 reply; 6+ messages in thread
From: kawada @ 2026-02-08 20:09 UTC (permalink / raw)
  To: syzbot; +Cc: linux-kernel, syzkaller-bugs


[-- Attachment #1.1: Type: text/plain, Size: 3233 bytes --]

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
master

2026年2月9日(月) 5:03 syzbot <
syzbot+3609b9b48e68e1fe47fd@syzkaller.appspotmail.com>:

> > #syz test git://
> git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> > master
> >
> > From d5153b84b90fa80ee0d041d1bd28bd465f7913ec Mon Sep 17 00:00:00 2001
> > From: Masahiro Kawada <youjingxiaogao2@gmail.com>
> > Date: Mon, 9 Feb 2026 04:47:14 +0900
> > Subject: [PATCH] Bluetooth: fix use-after-free in hci_conn_drop
> >
> > Fix a use-after-free in hci_conn_drop triggered via hci_cmd_sync_work.
> >
> > In hci_conn_del(), hci_cmd_sync_dequeue() is called after
> > hci_conn_cleanup() which may have already freed the conn pointer.
> > Fix by moving the dequeue before cleanup.
> >
> > Additionally, le_read_features_complete() calls hci_conn_drop(conn)
> > without checking whether conn is still valid. When
> > hci_le_read_remote_features_sync() blocks waiting for an HCI event,
> > another thread can free conn through hci_conn_del(). Fix by adding
> > a hci_conn_valid() check before calling hci_conn_drop().
> >
> > Reported-by: syzbot+3609b9b48e68e1fe47fd@syzkaller.appspotmail.com
> > Closes: https://syzkaller.appspot.com/bug?extid=3609b9b48e68e1fe47fd
> > Signed-off-by: Masahiro Kawada <youjingxiaogao2@gmail.com>
> > ---
> >  net/bluetooth/hci_conn.c | 6 +++---
> >  net/bluetooth/hci_sync.c | 3 +++
> >  2 files changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> > index 0795818963a..aa3607327ad 100644
> > --- a/net/bluetooth/hci_conn.c
> > +++ b/net/bluetooth/hci_conn.c
> > @@ -1232,15 +1232,15 @@ void hci_conn_del(struct hci_conn *conn)
> >   skb_queue_purge(&conn->data_q);
> >   skb_queue_purge(&conn->tx_q.queue);
> >
> > + /* Dequeue callbacks using connection pointer as data */
> > + hci_cmd_sync_dequeue(hdev, NULL, conn, NULL);
> > +
> >   /* Remove the connection from the list and cleanup its remaining
> >   * state. This is a separate function since for some cases like
> >   * BT_CONNECT_SCAN we *only* want the cleanup part without the
> >   * rest of hci_conn_del.
> >   */
> >   hci_conn_cleanup(conn);
> > -
> > - /* Dequeue callbacks using connection pointer as data */
> > - hci_cmd_sync_dequeue(hdev, NULL, conn, NULL);
> >  }
> >
> >  struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src, uint8_t
> > src_type)
> > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> > index f04a90bce4a..f31086c187f 100644
> > --- a/net/bluetooth/hci_sync.c
> > +++ b/net/bluetooth/hci_sync.c
> > @@ -7371,6 +7371,9 @@ static void le_read_features_complete(struct
> hci_dev
> > *hdev, void *data, int err)
> >   if (err == -ECANCELED)
> >   return;
> >
> > + if (!hci_conn_valid(hdev, conn))
> > + return;
> > +
> >   hci_conn_drop(conn);
> >  }
> >
> > --
> > 2.43.0
>
> Command #2:
> I've failed to parse your command.
> Did you perhaps forget to provide the branch name, or added an extra ':'?
> Please use one of the two supported formats:
> 1. #syz test
> 2. #syz test: repo branch-or-commit-hash
> Note the lack of ':' in option 1.
>
>

[-- Attachment #1.2: Type: text/html, Size: 4515 bytes --]

[-- Attachment #2: 0001-Bluetooth-fix-use-after-free-in-hci_conn_drop.patch --]
[-- Type: application/octet-stream, Size: 2351 bytes --]

From d5153b84b90fa80ee0d041d1bd28bd465f7913ec Mon Sep 17 00:00:00 2001
From: Masahiro Kawada <youjingxiaogao2@gmail.com>
Date: Mon, 9 Feb 2026 04:47:14 +0900
Subject: [PATCH] Bluetooth: fix use-after-free in hci_conn_drop

Fix a use-after-free in hci_conn_drop triggered via hci_cmd_sync_work.

In hci_conn_del(), hci_cmd_sync_dequeue() is called after
hci_conn_cleanup() which may have already freed the conn pointer.
Fix by moving the dequeue before cleanup.

Additionally, le_read_features_complete() calls hci_conn_drop(conn)
without checking whether conn is still valid. When
hci_le_read_remote_features_sync() blocks waiting for an HCI event,
another thread can free conn through hci_conn_del(). Fix by adding
a hci_conn_valid() check before calling hci_conn_drop().

Reported-by: syzbot+3609b9b48e68e1fe47fd@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3609b9b48e68e1fe47fd
Signed-off-by: Masahiro Kawada <youjingxiaogao2@gmail.com>
---
 net/bluetooth/hci_conn.c | 6 +++---
 net/bluetooth/hci_sync.c | 3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 0795818963a..aa3607327ad 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1232,15 +1232,15 @@ void hci_conn_del(struct hci_conn *conn)
 	skb_queue_purge(&conn->data_q);
 	skb_queue_purge(&conn->tx_q.queue);
 
+	/* Dequeue callbacks using connection pointer as data */
+	hci_cmd_sync_dequeue(hdev, NULL, conn, NULL);
+
 	/* Remove the connection from the list and cleanup its remaining
 	 * state. This is a separate function since for some cases like
 	 * BT_CONNECT_SCAN we *only* want the cleanup part without the
 	 * rest of hci_conn_del.
 	 */
 	hci_conn_cleanup(conn);
-
-	/* Dequeue callbacks using connection pointer as data */
-	hci_cmd_sync_dequeue(hdev, NULL, conn, NULL);
 }
 
 struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src, uint8_t src_type)
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index f04a90bce4a..f31086c187f 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -7371,6 +7371,9 @@ static void le_read_features_complete(struct hci_dev *hdev, void *data, int err)
 	if (err == -ECANCELED)
 		return;
 
+	if (!hci_conn_valid(hdev, conn))
+		return;
+
 	hci_conn_drop(conn);
 }
 
-- 
2.43.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: #syz test
       [not found] <CAKZCeSX=JVK5OK0GLYry4gkEH9cryp-FG8k9WcR_6FsPsZR6JQ@mail.gmail.com>
@ 2026-02-08 20:03 ` syzbot
  2026-02-08 20:09   ` kawada
  0 siblings, 1 reply; 6+ messages in thread
From: syzbot @ 2026-02-08 20:03 UTC (permalink / raw)
  To: youjingxiaogao2; +Cc: youjingxiaogao2, linux-kernel, syzkaller-bugs

> #syz test git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> master
>
> From d5153b84b90fa80ee0d041d1bd28bd465f7913ec Mon Sep 17 00:00:00 2001
> From: Masahiro Kawada <youjingxiaogao2@gmail.com>
> Date: Mon, 9 Feb 2026 04:47:14 +0900
> Subject: [PATCH] Bluetooth: fix use-after-free in hci_conn_drop
>
> Fix a use-after-free in hci_conn_drop triggered via hci_cmd_sync_work.
>
> In hci_conn_del(), hci_cmd_sync_dequeue() is called after
> hci_conn_cleanup() which may have already freed the conn pointer.
> Fix by moving the dequeue before cleanup.
>
> Additionally, le_read_features_complete() calls hci_conn_drop(conn)
> without checking whether conn is still valid. When
> hci_le_read_remote_features_sync() blocks waiting for an HCI event,
> another thread can free conn through hci_conn_del(). Fix by adding
> a hci_conn_valid() check before calling hci_conn_drop().
>
> Reported-by: syzbot+3609b9b48e68e1fe47fd@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=3609b9b48e68e1fe47fd
> Signed-off-by: Masahiro Kawada <youjingxiaogao2@gmail.com>
> ---
>  net/bluetooth/hci_conn.c | 6 +++---
>  net/bluetooth/hci_sync.c | 3 +++
>  2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 0795818963a..aa3607327ad 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -1232,15 +1232,15 @@ void hci_conn_del(struct hci_conn *conn)
>   skb_queue_purge(&conn->data_q);
>   skb_queue_purge(&conn->tx_q.queue);
>
> + /* Dequeue callbacks using connection pointer as data */
> + hci_cmd_sync_dequeue(hdev, NULL, conn, NULL);
> +
>   /* Remove the connection from the list and cleanup its remaining
>   * state. This is a separate function since for some cases like
>   * BT_CONNECT_SCAN we *only* want the cleanup part without the
>   * rest of hci_conn_del.
>   */
>   hci_conn_cleanup(conn);
> -
> - /* Dequeue callbacks using connection pointer as data */
> - hci_cmd_sync_dequeue(hdev, NULL, conn, NULL);
>  }
>
>  struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src, uint8_t
> src_type)
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index f04a90bce4a..f31086c187f 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -7371,6 +7371,9 @@ static void le_read_features_complete(struct hci_dev
> *hdev, void *data, int err)
>   if (err == -ECANCELED)
>   return;
>
> + if (!hci_conn_valid(hdev, conn))
> + return;
> +
>   hci_conn_drop(conn);
>  }
>
> -- 
> 2.43.0

Command #2:
I've failed to parse your command.
Did you perhaps forget to provide the branch name, or added an extra ':'?
Please use one of the two supported formats:
1. #syz test
2. #syz test: repo branch-or-commit-hash
Note the lack of ':' in option 1.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* #syz test
  2025-11-10 18:41 [syzbot] [bpf?] KASAN: stack-out-of-bounds Write in __bpf_get_stack syzbot
  2026-01-04 18:29 ` #syz test Arnaud Lecomte
@ 2026-01-04 18:30 ` Arnaud Lecomte
  1 sibling, 0 replies; 6+ messages in thread
From: Arnaud Lecomte @ 2026-01-04 18:30 UTC (permalink / raw)
  To: syzbot+d1b7fa1092def3628bd7; +Cc: contact, linux-kernel, syzkaller-bugs

#syz test

diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 2365541c81dd..b8ff4ccae2d6 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -465,7 +465,6 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,

        if (trace_in) {
                trace = trace_in;
-               trace->nr = min_t(u32, trace->nr, max_depth);
        } else if (kernel && task) {
                trace = get_callchain_entry_for_task(task, max_depth);
        } else {
@@ -479,7 +478,8 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,
                goto err_fault;
        }

-       trace_nr = trace->nr - skip;
+       trace_nr = min(trace->nr, max_depth);
+       trace_nr = trace_nr - skip;
        copy_len = trace_nr * elem_size;

        ips = trace->ip + skip;
--
2.43.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* #syz test
  2025-11-10 18:41 [syzbot] [bpf?] KASAN: stack-out-of-bounds Write in __bpf_get_stack syzbot
@ 2026-01-04 18:29 ` Arnaud Lecomte
  2026-01-04 18:30 ` Arnaud Lecomte
  1 sibling, 0 replies; 6+ messages in thread
From: Arnaud Lecomte @ 2026-01-04 18:29 UTC (permalink / raw)
  To: syzbot+d1b7fa1092def3628bd7; +Cc: contact, linux-kernel, syzkaller-bugs

diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 2365541c81dd..b8ff4ccae2d6 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -465,7 +465,6 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,

        if (trace_in) {
                trace = trace_in;
-               trace->nr = min_t(u32, trace->nr, max_depth);
        } else if (kernel && task) {
                trace = get_callchain_entry_for_task(task, max_depth);
        } else {
@@ -479,7 +478,8 @@ static long __bpf_get_stack(struct pt_regs *regs, struct task_struct *task,
                goto err_fault;
        }

-       trace_nr = trace->nr - skip;
+       trace_nr = min(trace->nr, max_depth);
+       trace_nr = trace_nr - skip;
        copy_len = trace_nr * elem_size;

        ips = trace->ip + skip;
--
2.43.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-05-20  8:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20260520084826.6246-1-souradiptodas6@gmail.com>
2026-05-20  8:48 ` #syz test syzbot
     [not found] <CAKZCeSX=JVK5OK0GLYry4gkEH9cryp-FG8k9WcR_6FsPsZR6JQ@mail.gmail.com>
2026-02-08 20:03 ` syzbot
2026-02-08 20:09   ` kawada
2026-02-09  7:50     ` kawada
2025-11-10 18:41 [syzbot] [bpf?] KASAN: stack-out-of-bounds Write in __bpf_get_stack syzbot
2026-01-04 18:29 ` #syz test Arnaud Lecomte
2026-01-04 18:30 ` Arnaud Lecomte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome