* [PATCH v2] net: sctp: fix KMSAN uninit-value in sctp_inq_pop
@ 2025-10-24 11:44 Ranganath V N
2025-10-24 16:01 ` Xin Long
2025-10-24 16:39 ` Simon Horman
0 siblings, 2 replies; 3+ messages in thread
From: Ranganath V N @ 2025-10-24 11:44 UTC (permalink / raw)
To: Marcelo Ricardo Leitner, Xin Long, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman
Cc: linux-sctp, netdev, linux-kernel, syzkaller-bugs,
syzbot+d101e12bccd4095460e7, Ranganath V N
Fix an issue detected by syzbot:
KMSAN reported an uninitialized-value access in sctp_inq_pop
BUG: KMSAN: uninit-value in sctp_inq_pop
The issue is actually caused by skb trimming via sk_filter() in sctp_rcv().
In the reproducer, skb->len becomes 1 after sk_filter(), which bypassed the
original check:
if (skb->len < sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr) +
skb_transport_offset(skb))
To handle this safely, a new check should be performed after sk_filter().
Reported-by: syzbot+d101e12bccd4095460e7@syzkaller.appspotmail.com
Tested-by: syzbot+d101e12bccd4095460e7@syzkaller.appspotmail.com
Fixes: https://syzkaller.appspot.com/bug?extid=d101e12bccd4095460e7
Suggested-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Ranganath V N <vnranganath.20@gmail.com>
---
KMSAN reported an uninitialized-value access in sctp_inq_pop
---
Changes in v2:
- changes in commit message as per the code changes.
- fixed as per the suggestion.
- Link to v1: https://lore.kernel.org/r/20251023-kmsan_fix-v1-1-d08c18db8877@gmail.com
---
net/sctp/input.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 7e99894778d4..e119e460ccde 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -190,7 +190,7 @@ int sctp_rcv(struct sk_buff *skb)
goto discard_release;
nf_reset_ct(skb);
- if (sk_filter(sk, skb))
+ if (sk_filter(sk, skb) || skb->len < sizeof(struct sctp_chunkhdr))
goto discard_release;
/* Create an SCTP packet structure. */
---
base-commit: 43e9ad0c55a369ecc84a4788d06a8a6bfa634f1c
change-id: 20251023-kmsan_fix-78d527b9960b
Best regards,
--
Ranganath V N <vnranganath.20@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: sctp: fix KMSAN uninit-value in sctp_inq_pop
2025-10-24 11:44 [PATCH v2] net: sctp: fix KMSAN uninit-value in sctp_inq_pop Ranganath V N
@ 2025-10-24 16:01 ` Xin Long
2025-10-24 16:39 ` Simon Horman
1 sibling, 0 replies; 3+ messages in thread
From: Xin Long @ 2025-10-24 16:01 UTC (permalink / raw)
To: Ranganath V N
Cc: Marcelo Ricardo Leitner, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, linux-sctp, netdev,
linux-kernel, syzkaller-bugs, syzbot+d101e12bccd4095460e7
On Fri, Oct 24, 2025 at 7:44 AM Ranganath V N <vnranganath.20@gmail.com> wrote:
>
> Fix an issue detected by syzbot:
>
> KMSAN reported an uninitialized-value access in sctp_inq_pop
> BUG: KMSAN: uninit-value in sctp_inq_pop
>
> The issue is actually caused by skb trimming via sk_filter() in sctp_rcv().
> In the reproducer, skb->len becomes 1 after sk_filter(), which bypassed the
> original check:
>
> if (skb->len < sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr) +
> skb_transport_offset(skb))
> To handle this safely, a new check should be performed after sk_filter().
>
> Reported-by: syzbot+d101e12bccd4095460e7@syzkaller.appspotmail.com
> Tested-by: syzbot+d101e12bccd4095460e7@syzkaller.appspotmail.com
> Fixes: https://syzkaller.appspot.com/bug?extid=d101e12bccd4095460e7
> Suggested-by: Xin Long <lucien.xin@gmail.com>
> Signed-off-by: Ranganath V N <vnranganath.20@gmail.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Thanks for the follow up.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: sctp: fix KMSAN uninit-value in sctp_inq_pop
2025-10-24 11:44 [PATCH v2] net: sctp: fix KMSAN uninit-value in sctp_inq_pop Ranganath V N
2025-10-24 16:01 ` Xin Long
@ 2025-10-24 16:39 ` Simon Horman
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2025-10-24 16:39 UTC (permalink / raw)
To: Ranganath V N
Cc: Marcelo Ricardo Leitner, Xin Long, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-sctp, netdev, linux-kernel,
syzkaller-bugs, syzbot+d101e12bccd4095460e7
On Fri, Oct 24, 2025 at 05:14:17PM +0530, Ranganath V N wrote:
> Fix an issue detected by syzbot:
>
> KMSAN reported an uninitialized-value access in sctp_inq_pop
> BUG: KMSAN: uninit-value in sctp_inq_pop
>
> The issue is actually caused by skb trimming via sk_filter() in sctp_rcv().
> In the reproducer, skb->len becomes 1 after sk_filter(), which bypassed the
> original check:
>
> if (skb->len < sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr) +
> skb_transport_offset(skb))
> To handle this safely, a new check should be performed after sk_filter().
>
> Reported-by: syzbot+d101e12bccd4095460e7@syzkaller.appspotmail.com
> Tested-by: syzbot+d101e12bccd4095460e7@syzkaller.appspotmail.com
> Fixes: https://syzkaller.appspot.com/bug?extid=d101e12bccd4095460e7
Hi,
Thanks for your patch.
Unfortunately, this is not the correct format for a fixes tag.
A fixes tag should reference the commit where the bug
was introduced into the tree. In this case, perhaps that
is the beginning of git history. If so:
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
I think the URL you provide is appropriate for a Closed tag.
Closes: https://syzkaller.appspot.com/bug?extid=d101e12bccd4095460e7
See https://docs.kernel.org/process/submitting-patches.html
> Suggested-by: Xin Long <lucien.xin@gmail.com>
> Signed-off-by: Ranganath V N <vnranganath.20@gmail.com>
> ---
> KMSAN reported an uninitialized-value access in sctp_inq_pop
> ---
> Changes in v2:
> - changes in commit message as per the code changes.
> - fixed as per the suggestion.
> - Link to v1: https://lore.kernel.org/r/20251023-kmsan_fix-v1-1-d08c18db8877@gmail.com
...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-24 16:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-24 11:44 [PATCH v2] net: sctp: fix KMSAN uninit-value in sctp_inq_pop Ranganath V N
2025-10-24 16:01 ` Xin Long
2025-10-24 16:39 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).