Re: [PATCH] net: skmsg: fix NULL pointer dereference in sk_msg_recvmsg()
From: Pranav Tyagi <hidden>
Date: 2025-07-25 11:55:47
Also in:
bpf, linux-kernel-mentees, lkml
From: Pranav Tyagi <hidden>
Date: 2025-07-25 11:55:47
Also in:
bpf, linux-kernel-mentees, lkml
On Thu, Jul 17, 2025 at 4:40 PM Paolo Abeni [off-list ref] wrote:
On 7/15/25 10:11 AM, Pranav Tyagi wrote:quoted
A NULL page from sg_page() in sk_msg_recvmsg() can reach __kmap_local_page_prot() and crash the kernel. Add a check for the page before calling copy_page_to_iter() and fail early with -EFAULT to prevent the crash.Interesting. I thought the sge in this case are build from the kernel, I did not expect a null page to be possible. Can you describe in the commit message how such bad sges are created?quoted
Reported-by: syzbot+b18872ea9631b5dcef3b@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=b18872ea9631b5dcef3b Fixes: 2bc793e3272a ("skmsg: Extract __tcp_bpf_recvmsg() and tcp_bpf_wait_data()") Signed-off-by: Pranav Tyagi <redacted>Does not apply to net. Please rebase and resend, adding the target tree in the subj prefix and specifying a revision number. Thanks, Paolo
Hi Paolo, Apologies for a delayed response. I will send a v2 of the patch with all the required changes shortly. Also, as I am a beginner at kernel work, my initial intention was to just fix the bug and (honestly) I did not think about the cause of bad sges. But, I will definitely take a deep dive and try my level best to look for a suitable explanation for the same. Thanks for the feedback. Regards Pranav Tyagi