Skip to contentSkip to conversation

syscalls/shmctl05: new test for IPC file use-after-free bug

PATCH New Eric Biggers 3 participants 3 messages Jul 11, 2018 – Jul 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 syscalls/shmctl05: new test for IPC file use-after-free bug

From: Eric Biggers <[email protected]>

Test for a bug in the System V IPC subsystem that resulted in a shared memory file being used after it was freed (or being freed).

---

Changed since v2:
- Add tst_timer_check(CLOCK_MONOTONIC).
- Use 'CFLAGS += -pthread' instead of 'LDLIBS += -lpthread'.
- Add 'LDLIBS += -lrt' (for timer functions).

Changed since v1:
- Use "fuzzy sync" spinlocks instead of random sleeps.
- Use threads with .timeout instead of processes.
- Use SAFE_SHMAT() instead of shmat() directly.
- Use tst_timer_expired_ms() instead of tst_timer_stop() + tst_timer_elapsed_ms().

 runtest/syscalls                              |   1 +
 runtest/syscalls-ipc                          |   1 +
 .../kernel/syscalls/ipc/shmctl/.gitignore     |   1 +
 testcases/kernel/syscalls/ipc/shmctl/Makefile |   3 +
 .../kernel/syscalls/ipc/shmctl/shmctl05.c     | 114 ++++++++++++++++++
 5 files changed, 120 insertions(+)
 create mode 100644 testcases/kernel/syscalls/ipc/shmctl/shmctl05.c
runtest/syscalls +1 -0
index a9afecf57..9eafd75d6 100644
@@ -1187,6 +1187,7 @@ shmctl01 shmctl01
 shmctl02 shmctl02
 shmctl03 shmctl03
 shmctl04 shmctl04
+shmctl05 shmctl05
 
 shmdt01 shmdt01
 shmdt02 shmdt02
runtest/syscalls-ipc +1 -0
index 00d7eed3a..54d8622d4 100644
@@ -53,6 +53,7 @@ shmctl01 shmctl01
 shmctl02 shmctl02
 shmctl03 shmctl03
 shmctl04 shmctl04
+shmctl05 shmctl05
 
 shmdt01 shmdt01
 shmdt02 shmdt02
testcases/kernel/syscalls/ipc/shmctl/.gitignore +1 -0
index 9f5ac37ff..d6777e3b8 100644
@@ -2,3 +2,4 @@
 /shmctl02
 /shmctl03
 /shmctl04
+/shmctl05
testcases/kernel/syscalls/ipc/shmctl/Makefile +3 -0
index f467389b9..16da31b03 100644
@@ -18,6 +18,9 @@
 
 top_srcdir              ?= ../../../../..
 
+shmctl05: CFLAGS += -pthread
+shmctl05: LDLIBS += -lrt
+
 include $(top_srcdir)/include/mk/testcases.mk
 include $(abs_srcdir)/../Makefile.inc
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmctl/shmctl05.c new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
2.18.0.203.gfac676dfb9-goog
#1 lore raw

PATCH v3 1/1 syscalls/shmctl05: new test for IPC file use-after-free bug

----- Original Message -----

Quoted 6 lines

From: Eric Biggers <[email protected]>

Test for a bug in the System V IPC subsystem that resulted in a shared memory file being used after it was freed (or being freed).

ack, I'll give Cyril chance to review as well.

Regards,
Jan