netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Skripkin <paskripkin@gmail.com>
To: syzbot <syzbot+b2be9dd8ca6f6c73ee2d@syzkaller.appspotmail.com>,
	antony.antony@secunet.com, christian.langrock@secunet.com,
	davem@davemloft.net, herbert@gondor.apana.org.au,
	kuba@kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, steffen.klassert@secunet.com,
	syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] UBSAN: shift-out-of-bounds in xfrm_get_default
Date: Wed, 1 Sep 2021 23:21:00 +0300	[thread overview]
Message-ID: <983049ea-3023-8dbe-cbb4-51fb5661d2cb@gmail.com> (raw)
In-Reply-To: <0000000000005a8dc805caf4b92e@google.com>

[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]

On 9/1/21 23:15, syzbot wrote:
> Hello,
> 
> syzbot tried to test the proposed patch but the build/boot failed:
> 
> arch/x86/kernel/setup.c:916:6: error: implicit declaration of function 'acpi_mps_check' [-Werror=implicit-function-declaration]
> arch/x86/kernel/setup.c:1110:2: error: implicit declaration of function 'acpi_table_upgrade' [-Werror=implicit-function-declaration]
> arch/x86/kernel/setup.c:1112:2: error: implicit declaration of function 'acpi_boot_table_init' [-Werror=implicit-function-declaration]
> arch/x86/kernel/setup.c:1120:2: error: implicit declaration of function 'early_acpi_boot_init'; did you mean 'early_cpu_init'? [-Werror=implicit-function-declaration]
> arch/x86/kernel/setup.c:1162:2: error: implicit declaration of function 'acpi_boot_init' [-Werror=implicit-function-declaration]
> 
> 
> Tested on:
> 
> commit:         9e9fb765 Merge tag 'net-next-5.15' of git://git.kernel..
> git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git master
> dashboard link: https://syzkaller.appspot.com/bug?extid=b2be9dd8ca6f6c73ee2d
> compiler:
> patch:          https://syzkaller.appspot.com/x/patch.diff?x=14a2a34d300000
> 

Ok, net-next is also broken....

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




With regards,
Pavel Skripkin

[-- Attachment #2: 0001-net-xfrm-fix-shift-out-of-bounds-in-xfrm_get_default.patch --]
[-- Type: text/x-patch, Size: 1227 bytes --]

From 172c351869e5920630f27d20976b079fca30650c Mon Sep 17 00:00:00 2001
From: Pavel Skripkin <paskripkin@gmail.com>
Date: Wed, 1 Sep 2021 21:55:25 +0300
Subject: [PATCH] net: xfrm: fix shift-out-of-bounds in xfrm_get_default

/* ... */

Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
 arch/x86/kernel/setup.c | 1 +
 net/xfrm/xfrm_user.c    | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index da0a4b64880f..c9e3a17b94f9 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -23,6 +23,7 @@
 #include <linux/usb/xhci-dbgp.h>
 #include <linux/static_call.h>
 #include <linux/swiotlb.h>
+#include <linux/acpi.h>
 
 #include <uapi/linux/mount.h>
 
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index b7b986520dc7..a1dd38525957 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2007,6 +2007,9 @@ static int xfrm_get_default(struct sk_buff *skb, struct nlmsghdr *nlh,
 
 	r_up = nlmsg_data(r_nlh);
 
+	if (up->dirmask >= XFRM_USERPOLICY_DIRMASK_MAX)
+		return -EINVAL;
+
 	r_up->action = ((net->xfrm.policy_default & (1 << up->dirmask)) >> up->dirmask);
 	r_up->dirmask = up->dirmask;
 	nlmsg_end(r_skb, r_nlh);
-- 
2.33.0


  reply	other threads:[~2021-09-01 20:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 20:19 [syzbot] UBSAN: shift-out-of-bounds in xfrm_get_default syzbot
2021-09-01 18:56 ` Pavel Skripkin
2021-09-01 18:56   ` syzbot
2021-09-01 18:57     ` Pavel Skripkin
2021-09-01 20:15       ` syzbot
2021-09-01 20:21         ` Pavel Skripkin [this message]
2021-09-02  2:15           ` syzbot
2021-09-01 18:56   ` syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=983049ea-3023-8dbe-cbb4-51fb5661d2cb@gmail.com \
    --to=paskripkin@gmail.com \
    --cc=antony.antony@secunet.com \
    --cc=christian.langrock@secunet.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.com \
    --cc=syzbot+b2be9dd8ca6f6c73ee2d@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).