Test WARNING in __vunmap

15 views
Skip to first unread message

Khalid Masum

unread,
Aug 30, 2022, 1:25:29ā€ÆPM8/30/22
to syzkall...@googlegroups.com, syzbot+5ec9bb...@syzkaller.appspotmail.com, Khalid Masum
#syz-test: https://github.com/torvalds/linux.git b90cb1053190
Reported-by: syzbot+5ec9bb...@syzkaller.appspotmail.com
link: https://lore.kernel.org/lkml/00000000000092...@google.com/
---

net/xfrm/xfrm_ipcomp.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
index cb40ff0ff28d..0c60ccecb55f 100644
--- a/net/xfrm/xfrm_ipcomp.c
+++ b/net/xfrm/xfrm_ipcomp.c
@@ -210,12 +210,16 @@ static void * __percpu *ipcomp_alloc_scratches(void)
void * __percpu *scratches;
int i;

- if (ipcomp_scratch_users++)
+ if (ipcomp_scratch_users) {
+ ipcomp_scratch_users++;
return ipcomp_scratches;
-
+ }
scratches = alloc_percpu(void *);
- if (!scratches)
+ if (!scratches){
+ ipcomp_scratches = NULL;
return NULL;
+ }
+ ipcomp_scratch_users++;

ipcomp_scratches = scratches;

--
2.37.1

syzbot

unread,
Aug 30, 2022, 1:58:15ā€ÆPM8/30/22
to khalid....@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+5ec9bb...@syzkaller.appspotmail.com

Tested on:

commit: b90cb105 Linux 6.0-rc3
git tree: https://github.com/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=17680f95080000
kernel config: https://syzkaller.appspot.com/x/.config?x=7a83b0ed0cc4e36e
dashboard link: https://syzkaller.appspot.com/bug?extid=5ec9bb042ddfe9644773
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=17447493080000

Note: testing is done by a robot and is best-effort only.

Khalid Masum

unread,
Aug 30, 2022, 3:33:31ā€ÆPM8/30/22
to syzkall...@googlegroups.com, syzbot+5ec9bb...@syzkaller.appspotmail.com, Khalid Masum
net/xfrm/xfrm_ipcomp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
index cb40ff0ff28d..af9097983139 100644
--- a/net/xfrm/xfrm_ipcomp.c
+++ b/net/xfrm/xfrm_ipcomp.c
@@ -210,13 +210,15 @@ static void * __percpu *ipcomp_alloc_scratches(void)
void * __percpu *scratches;
int i;

- if (ipcomp_scratch_users++)
+ if (ipcomp_scratch_users) {
+ ipcomp_scratch_users++;
return ipcomp_scratches;
-
+ }
scratches = alloc_percpu(void *);
if (!scratches)
return NULL;

+ ipcomp_scratch_users++;
ipcomp_scratches = scratches;

for_each_possible_cpu(i) {
--
2.37.1

syzbot

unread,
Aug 30, 2022, 4:04:17ā€ÆPM8/30/22
to khalid....@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+5ec9bb...@syzkaller.appspotmail.com

Tested on:

commit: b90cb105 Linux 6.0-rc3
git tree: https://github.com/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=130b9783080000
kernel config: https://syzkaller.appspot.com/x/.config?x=7a83b0ed0cc4e36e
dashboard link: https://syzkaller.appspot.com/bug?extid=5ec9bb042ddfe9644773
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=131da07d080000

Khalid Masum

unread,
Aug 31, 2022, 7:02:24ā€ÆAM8/31/22
to syzkall...@googlegroups.com, syzbot+5ec9bb...@syzkaller.appspotmail.com
diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
index cb40ff0ff28d..17815cde8a7f 100644
--- a/net/xfrm/xfrm_ipcomp.c
+++ b/net/xfrm/xfrm_ipcomp.c
@@ -215,7 +215,7 @@ static void * __percpu *ipcomp_alloc_scratches(void)

scratches = alloc_percpu(void *);
if (!scratches)
- return NULL;
+ return ipcomp_scratches = NULL;

ipcomp_scratches = scratches;

syzbot

unread,
Aug 31, 2022, 7:32:13ā€ÆAM8/31/22
to khalid....@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+5ec9bb...@syzkaller.appspotmail.com

Tested on:

commit: b90cb105 Linux 6.0-rc3
git tree: https://github.com/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=103c046d080000
kernel config: https://syzkaller.appspot.com/x/.config?x=7a83b0ed0cc4e36e
dashboard link: https://syzkaller.appspot.com/bug?extid=5ec9bb042ddfe9644773
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=121bdb75080000

Khalid Masum

unread,
Aug 31, 2022, 8:45:04ā€ÆAM8/31/22
to syzkall...@googlegroups.com, syzbot+5ec9bb...@syzkaller.appspotmail.com
#syz-test: https://github.com/torvalds/linux.git b90cb1053190
Reported-by: syzbot+5ec9bb...@syzkaller.appspotmail.com
link: https://lore.kernel.org/lkml/00000000000092...@google.com/
---
diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
index cb40ff0ff28d..7f3cbd941eb6 100644
--- a/net/xfrm/xfrm_ipcomp.c
+++ b/net/xfrm/xfrm_ipcomp.c
@@ -31,7 +31,7 @@ struct ipcomp_tfms {
};

static DEFINE_MUTEX(ipcomp_resource_mutex);
-static void * __percpu *ipcomp_scratches;
+static void * __percpu *ipcomp_scratches = NULL;
static int ipcomp_scratch_users;
static LIST_HEAD(ipcomp_tfms_list);

@@ -203,6 +203,7 @@ static void ipcomp_free_scratches(void)
vfree(*per_cpu_ptr(scratches, i));

free_percpu(scratches);
+ ipcomp_scratches = NULL;

syzbot

unread,
Aug 31, 2022, 9:05:13ā€ÆAM8/31/22
to khalid....@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+5ec9bb...@syzkaller.appspotmail.com

Tested on:

commit: b90cb105 Linux 6.0-rc3
git tree: https://github.com/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=10634b33080000
kernel config: https://syzkaller.appspot.com/x/.config?x=7a83b0ed0cc4e36e
dashboard link: https://syzkaller.appspot.com/bug?extid=5ec9bb042ddfe9644773
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=136c90cd080000

Khalid Masum

unread,
Aug 31, 2022, 3:48:01ā€ÆPM8/31/22
to syzbot+5ec9bb...@syzkaller.appspotmail.com, syzkall...@googlegroups.com
diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c
index cb40ff0ff28d..3774d07c5819 100644
--- a/net/xfrm/xfrm_ipcomp.c
+++ b/net/xfrm/xfrm_ipcomp.c
@@ -203,6 +203,7 @@ static void ipcomp_free_scratches(void)
vfree(*per_cpu_ptr(scratches, i));

free_percpu(scratches);
+ ipcomp_scratches = NULL;
}

static void * __percpu *ipcomp_alloc_scratches(void)
@@ -215,7 +216,7 @@ static void * __percpu *ipcomp_alloc_scratches(void)

syzbot

unread,
Aug 31, 2022, 4:14:13ā€ÆPM8/31/22
to khalid....@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+5ec9bb...@syzkaller.appspotmail.com

Tested on:

commit: b90cb105 Linux 6.0-rc3
git tree: https://github.com/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=161660ab080000
kernel config: https://syzkaller.appspot.com/x/.config?x=7a83b0ed0cc4e36e
dashboard link: https://syzkaller.appspot.com/bug?extid=5ec9bb042ddfe9644773
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=1360a8ab080000

Khalid Masum

unread,
Sep 1, 2022, 1:01:46ā€ÆAM9/1/22
to syzkall...@googlegroups.com, syzbot+5ec9bb...@syzkaller.appspotmail.com
diff.temp.patch

syzbot

unread,
Sep 1, 2022, 1:38:11ā€ÆAM9/1/22
to khalid....@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+5ec9bb...@syzkaller.appspotmail.com

Tested on:

commit: b90cb105 Linux 6.0-rc3
git tree: https://github.com/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=13fd306d080000
kernel config: https://syzkaller.appspot.com/x/.config?x=7a83b0ed0cc4e36e
dashboard link: https://syzkaller.appspot.com/bug?extid=5ec9bb042ddfe9644773
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=15d5be63080000

Dan Carpenter

unread,
Sep 1, 2022, 1:44:53ā€ÆAM9/1/22
to Khalid Masum, syzkall...@googlegroups.com, syzbot+5ec9bb...@syzkaller.appspotmail.com
Heh. You have inspired me to create a static checker warning so that
no one writes code like this in the future. :P Write it as:

if (!scratches) {
ipcomp_scratches = NULL;
return NULL;
}

regards,
dan carpenter

Khalid Masum

unread,
Sep 1, 2022, 2:14:04ā€ÆAM9/1/22
to Dan Carpenter, syzkaller-bugs, syzbot+5ec9bb...@syzkaller.appspotmail.com
Thanks for the tip. Are you adding this warning for checkpatch.pl?
-- Khalid Masum
Reply all
Reply to author
Forward
0 new messages