Skip to contentSkip to conversation

Add test for CVE 2022-4378

PATCH In review Martin Doucha 4 participants 6 messages Dec 16, 2022 – Dec 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add test for CVE 2022-4378

---
 runtest/cve                   |   1 +
 testcases/cve/.gitignore      |   1 +
 testcases/cve/cve-2022-4378.c | 108 ++++++++++++++++++++++++++++++++++
 3 files changed, 110 insertions(+)
 create mode 100644 testcases/cve/cve-2022-4378.c
runtest/cve +1 -0
index fd0305aa3..1ba63c2a7 100644
@@ -76,3 +76,4 @@ cve-2022-0847 dirtypipe
 cve-2022-2590 dirtyc0w_shmem
 # Tests below may cause kernel memory leak
 cve-2020-25704 perf_event_open03
+cve-2022-4378 cve-2022-4378
testcases/cve/.gitignore +1 -0
index eb0a8b37d..90e8b191c 100644
@@ -10,4 +10,5 @@ stack_clash
 cve-2017-17052
 cve-2017-16939
 cve-2017-17053
+cve-2022-4378
 icmp_rate_limit01
testcases/cve/cve-2022-4378.c new file +108 -0

108 lines not on this page · raw message

Signature · 5 lines
2.39.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hello,

Quoted 40 lines · Martin Doucha
---
 runtest/cve                   |   1 +
 testcases/cve/.gitignore      |   1 +
 testcases/cve/cve-2022-4378.c | 108 ++++++++++++++++++++++++++++++++++
 3 files changed, 110 insertions(+)
 create mode 100644 testcases/cve/cve-2022-4378.c
runtest/cve +1 -0
index fd0305aa3..1ba63c2a7 100644
@@ -76,3 +76,4 @@ cve-2022-0847 dirtypipe
 cve-2022-2590 dirtyc0w_shmem
 # Tests below may cause kernel memory leak
 cve-2020-25704 perf_event_open03
+cve-2022-4378 cve-2022-4378
testcases/cve/.gitignore +1 -0
index eb0a8b37d..90e8b191c 100644
@@ -10,4 +10,5 @@ stack_clash
 cve-2017-17052
 cve-2017-16939
 cve-2017-17053
+cve-2022-4378
 icmp_rate_limit01
testcases/cve/cve-2022-4378.c new file +7 -0
new file mode 100644
index 000000000..e1c5df325
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2022 SUSE LLC <[email protected]>
+ */
+
+/*\
+ * CVE 2022-4378

testcases/cve/cve-2022-4378.c line 17

Quoted 10 lines
testcases/cve/cve-2022-4378.c new file +10 -0
+ *
+ * Check that writing several pages worth of whitespace into /proc/sys files
+ * does not cause kernel stack overflow. Kernel bug fixed in:
+ *
+ * commit bce9332220bd677d83b19d21502776ad555a0e73
+ * Author: Linus Torvalds <[email protected]>
+ * Date:   Mon Dec 5 12:09:06 2022 -0800
+ *
+ * proc: proc_skip_spaces() shouldn't think it is working on C strings
+ */

Haha, OK, merged with minor fix to null terminate tags array (detected by make check).

Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
In reply to Martin Doucha

Hi Martin,

testcases/cve/cve-2022-4378.c line 6

Quoted 12 lines
testcases/cve/cve-2022-4378.c new file +6 -0
new file mode 100644
index 000000000..e1c5df325
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2022 SUSE LLC <[email protected]>
+ */
+
+/*\

nit: you used /*\ docparse start comment, but without any [...] mark, thus nothing shows in generated docs.
There should have been either normal C comment /* or docparse [...] mark.

Kind regards,
Petr

Quoted 12 lines
testcases/cve/cve-2022-4378.c new file +3 -0
+ * CVE 2022-4378
+ *
+ * Check that writing several pages worth of whitespace into /proc/sys 

files
+ * does not cause kernel stack overflow. Kernel bug fixed in:
+ *
+ * commit bce9332220bd677d83b19d21502776ad555a0e73
+ * Author: Linus Torvalds <[email protected]>
+ * Date: Mon Dec 5 12:09:06 2022 -0800
+ *
+ * proc: proc_skip_spaces() shouldn't think it is working on C strings
+ */

...

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
Quoted 17 lines · pvorel

Hi Martin,

testcases/cve/cve-2022-4378.c line 6

Quoted 12 lines
testcases/cve/cve-2022-4378.c new file +6 -0
new file mode 100644
index 000000000..e1c5df325
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2022 SUSE LLC <[email protected]>
+ */
+
+/*\

nit: you used /*\ docparse start comment, but without any [...] mark, thus nothing shows in generated docs.
There should have been either normal C comment /* or docparse [...] mark.

I'm sorry, I was wrong, the text *appear* in generated docs, just without any header. Just the text contains too much details (given we have link to git commit in the table below):

... fixed in:

commit bce9332220bd677d83b19d21502776ad555a0e73 Author: Linus Torvalds <[email protected]> Date: Mon Dec 5 12:09:06 2022 -0800

Kind regards,
Petr

Quoted 18 lines

Kind regards,
Petr

Quoted 13 lines
testcases/cve/cve-2022-4378.c new file +3 -0
+ * CVE 2022-4378
+ *
+ * Check that writing several pages worth of whitespace into 

/proc/sys files
+ * does not cause kernel stack overflow. Kernel bug fixed in:
+ *
+ * commit bce9332220bd677d83b19d21502776ad555a0e73
+ * Author: Linus Torvalds <[email protected]>
+ * Date: Mon Dec 5 12:09:06 2022 -0800
+ *
+ * proc: proc_skip_spaces() shouldn't think it is working on C strings
+ */

...

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw

Hello,

Quoted 21 lines · pvorel
Quoted 11 lines · pvorel

Hi Martin,

Quoted 9 lines
testcases/cve/cve-2022-4378.c new file +2 -0
new file mode 100644
index 000000000..e1c5df325
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
Quoted 8 lines

testcases/cve/cve-2022-4378.c line 6

Quoted 4 lines
testcases/cve/cve-2022-4378.c new file +4 -0
+ * Copyright (C) 2022 SUSE LLC <[email protected]>
+ */
+
+/*\

nit: you used /*\ docparse start comment, but without any [...] mark, thus nothing shows in generated docs.
There should have been either normal C comment /* or docparse [...] mark.

Quoted 2 lines

I'm sorry, I was wrong, the text *appear* in generated docs, just without any header.

Perhaps make-check could validate the docparse string?

Quoted 7 lines

Just the text contains too much details (given we have link to git commit in the table below):

... fixed in:

commit bce9332220bd677d83b19d21502776ad555a0e73 Author: Linus Torvalds <[email protected]> Date: Mon Dec 5 12:09:06 2022 -0800

I think it is fine to even copy and paste the whole commit message. If we list the wrong Git commit this may make it easier to see as well.

Quoted 21 lines

Kind regards,
Petr

Quoted 17 lines

Kind regards,
Petr

Quoted 13 lines
testcases/cve/cve-2022-4378.c new file +3 -0
+ * CVE 2022-4378
+ *
+ * Check that writing several pages worth of whitespace into

/proc/sys files
+ * does not cause kernel stack overflow. Kernel bug fixed in:
+ *
+ * commit bce9332220bd677d83b19d21502776ad555a0e73
+ * Author: Linus Torvalds <[email protected]>
+ * Date: Mon Dec 5 12:09:06 2022 -0800
+ *
+ * proc: proc_skip_spaces() shouldn't think it is working on C strings
+ */

...

Signature · 5 lines
Thank you,
Richard.

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw

Hi Richie,

Quoted 25 lines

Hello,

Quoted 20 lines · pvorel
Quoted 19 lines · pvorel

Hi Martin,

testcases/cve/cve-2022-4378.c line 6

Quoted 13 lines
testcases/cve/cve-2022-4378.c new file +6 -0
new file mode 100644
index 000000000..e1c5df325
@@ -0,0 +1,108 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2022 SUSE LLC <[email protected]>
+ */
+
+/*\

nit: you used /*\ docparse start comment, but without any [...] mark, thus nothing shows in generated docs.
There should have been either normal C comment /* or docparse [...] mark.

Quoted 4 lines
Quoted 2 lines

I'm sorry, I was wrong, the text *appear* in generated docs, just without any header.

Perhaps make-check could validate the docparse string?

+1, I was already thinking about it.

It would not help in the case below, but it's definitely worth (error in JSON will be caught by CI, but why not to catch it early?)

Quoted 10 lines
Quoted 7 lines

Just the text contains too much details (given we have link to git commit in the table below):

... fixed in:

commit bce9332220bd677d83b19d21502776ad555a0e73 Author: Linus Torvalds <[email protected]> Date: Mon Dec 5 12:09:06 2022 -0800

I think it is fine to even copy and paste the whole commit message. If we list the wrong Git commit this may make it easier to see as well.

I'd just use the format for "Fixes:":

$ git log --pretty=format:"%h (\"%s\")" -1
bce9332220bd ("proc: proc_skip_spaces() shouldn't think it is working on C strings")

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp