Skip to contentSkip to conversation

syscalls: Add tests to verify the _time_high fields

PATCH Superseded Viresh Kumar 3 participants 12 messages Jun 16, 2020 – Jun 17, 2020

lore
Share & tools
lore
#0 lore raw

v2 cover syscalls: Add tests to verify the _time_high fields

Hello,

This patchset adds a new tests to three syscalls to verify that the extended fields, _time_high, are cleared by the kernel. This was suggested by Arnd.

V2:
- Separate out structure definitions to separate patches.
- Drop first two patches from V1 as they are already applied.
- Minor makefile fixes.

Viresh Kumar (6):
include: Add declaration of struct semid64_ds
syscalls: semctl: Add new test to verify the _time_high fields
include: Add declaration of struct shmid64_ds
syscalls: shmctl: Add new test to verify the _time_high fields
include: Add declaration of struct msqid64_ds
syscalls: msgctl: Add new test to verify the _time_high fields

 configure.ac                                  |   3 +
 include/lapi/msgbuf.h                         | 306 ++++++++++++++++++
 include/lapi/sembuf.h                         | 234 ++++++++++++++
 include/lapi/shmbuf.h                         | 273 ++++++++++++++++
 runtest/syscalls                              |   3 +
 runtest/syscalls-ipc                          |   3 +
 .../kernel/syscalls/ipc/msgctl/.gitignore     |   1 +
 .../kernel/syscalls/ipc/msgctl/msgctl05.c     |  48 +++
 .../kernel/syscalls/ipc/semctl/.gitignore     |   1 +
 testcases/kernel/syscalls/ipc/semctl/Makefile |   5 +-
 .../kernel/syscalls/ipc/semctl/semctl08.c     |  52 +++
 .../kernel/syscalls/ipc/shmctl/.gitignore     |   1 +
 testcases/kernel/syscalls/ipc/shmctl/Makefile |   5 +-
 .../kernel/syscalls/ipc/shmctl/shmctl06.c     |  51 +++
 14 files changed, 983 insertions(+), 3 deletions(-)
 create mode 100644 include/lapi/msgbuf.h
 create mode 100644 include/lapi/sembuf.h
 create mode 100644 include/lapi/shmbuf.h
 create mode 100644 testcases/kernel/syscalls/ipc/msgctl/msgctl05.c
 create mode 100644 testcases/kernel/syscalls/ipc/semctl/semctl08.c
 create mode 100644 testcases/kernel/syscalls/ipc/shmctl/shmctl06.c
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#1 lore raw

PATCH v2 1/6 include: Add declaration of struct semid64_ds

This adds declaration of struct semid64_ds, which will be used by following patches.

---
 configure.ac          |   1 +
 include/lapi/sembuf.h | 234 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 235 insertions(+)
 create mode 100644 include/lapi/sembuf.h
configure.ac +1 -0
index eaf33dd60350..c513fdf440c2 100644
@@ -151,6 +151,7 @@ AC_CHECK_TYPES([struct fs_quota_statv],,,[#include <xfs/xqm.h>])
 AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
 AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
 AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
+AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
 
 AC_CHECK_TYPES([struct mmsghdr],,,[
 #define _GNU_SOURCE
include/lapi/sembuf.h new file +234 -0

234 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#2 lore raw

PATCH v2 2/6 syscalls: semctl: Add new test to verify the _time_high fields

In reply to Viresh Kumar

The _time_high fields must be reset by the kernel, add a test to verify that.

---
 runtest/syscalls                              |  1 +
 runtest/syscalls-ipc                          |  1 +
 .../kernel/syscalls/ipc/semctl/.gitignore     |  1 +
 testcases/kernel/syscalls/ipc/semctl/Makefile |  5 +-
 .../kernel/syscalls/ipc/semctl/semctl08.c     | 52 +++++++++++++++++++
 5 files changed, 58 insertions(+), 2 deletions(-)
 create mode 100644 testcases/kernel/syscalls/ipc/semctl/semctl08.c
runtest/syscalls +1 -0
index bee03e93f765..eedd727fb617 100644
@@ -1157,6 +1157,7 @@ semctl04 semctl04
 semctl05 semctl05
 semctl06 semctl06
 semctl07 semctl07
+semctl08 semctl08
 
 semget01 semget01
 semget02 semget02
runtest/syscalls-ipc +1 -0
index 54d8622d4223..f912cb067f74 100644
@@ -33,6 +33,7 @@ semctl04 semctl04
 semctl05 semctl05
 semctl06 semctl06
 semctl07 semctl07
+semctl08 semctl08
 
 semget01 semget01
 semget02 semget02
testcases/kernel/syscalls/ipc/semctl/.gitignore +1 -0
index b6899acf5da6..6189a04cc3c6 100644
@@ -5,3 +5,4 @@
 /semctl05
 /semctl06
 /semctl07
+/semctl08
testcases/kernel/syscalls/ipc/semctl/Makefile +3 -2
index f62cd1f481d9..99971a7dbb32 100644
@@ -3,10 +3,11 @@
 
 top_srcdir              ?= ../../../../..
 
-LTPLIBS = ltpipc
+LTPLIBS = ltpipc ltpnewipc
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS  += -lltpipc
+semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpipc
+semctl08: LDLIBS += -lltpnewipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semctl/semctl08.c new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#3 lore raw

PATCH v2 3/6 include: Add declaration of struct shmid64_ds

In reply to Viresh Kumar

This adds declaration of struct shmid64_ds, which will be used by following patches.

---
 configure.ac          |   1 +
 include/lapi/shmbuf.h | 273 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 274 insertions(+)
 create mode 100644 include/lapi/shmbuf.h
configure.ac +1 -0
index c513fdf440c2..f1ee98b23cbe 100644
@@ -152,6 +152,7 @@ AC_CHECK_TYPES([struct if_nextdqblk],,,[#include <linux/quota.h>])
 AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
 AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
 AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
+AC_CHECK_TYPES([struct shmid64_ds],,,[#include <sys/shmbuf.h>])
 
 AC_CHECK_TYPES([struct mmsghdr],,,[
 #define _GNU_SOURCE
include/lapi/shmbuf.h new file +273 -0

273 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#4 lore raw

PATCH v2 4/6 syscalls: shmctl: Add new test to verify the _time_high fields

In reply to Viresh Kumar

The _time_high fields must be reset by the kernel, add a test to verify that.

---
 runtest/syscalls                              |  1 +
 runtest/syscalls-ipc                          |  1 +
 .../kernel/syscalls/ipc/shmctl/.gitignore     |  1 +
 testcases/kernel/syscalls/ipc/shmctl/Makefile |  5 +-
 .../kernel/syscalls/ipc/shmctl/shmctl06.c     | 51 +++++++++++++++++++
 5 files changed, 58 insertions(+), 1 deletion(-)
 create mode 100644 testcases/kernel/syscalls/ipc/shmctl/shmctl06.c
runtest/syscalls +1 -0
index eedd727fb617..f8b2277e0eda 100644
@@ -1355,6 +1355,7 @@ shmctl02 shmctl02
 shmctl03 shmctl03
 shmctl04 shmctl04
 shmctl05 shmctl05
+shmctl06 shmctl06
 
 shmdt01 shmdt01
 shmdt02 shmdt02
runtest/syscalls-ipc +1 -0
index f912cb067f74..5ba3b1449a6c 100644
@@ -55,6 +55,7 @@ shmctl02 shmctl02
 shmctl03 shmctl03
 shmctl04 shmctl04
 shmctl05 shmctl05
+shmctl06 shmctl06
 
 shmdt01 shmdt01
 shmdt02 shmdt02
testcases/kernel/syscalls/ipc/shmctl/.gitignore +1 -0
index d6777e3b8f1b..46b107344cf4 100644
@@ -3,3 +3,4 @@
 /shmctl03
 /shmctl04
 /shmctl05
+/shmctl06
testcases/kernel/syscalls/ipc/shmctl/Makefile +4 -1
index cfa5d6e76489..252c11058bc5 100644
@@ -3,13 +3,16 @@
 
 top_srcdir              ?= ../../../../..
 
-LTPLIBS = ltpipc
+LTPLIBS = ltpipc ltpnewipc
 
 shmctl05: CFLAGS += -pthread
 shmctl05: LDLIBS += -lrt
 
 include $(top_srcdir)/include/mk/testcases.mk
 
+shmctl01 shmctl02 shmctl03 shmctl04 shmctl05: LDLIBS += -lltpipc
+shmctl06: LDLIBS += -lltpnewipc
+
 LDLIBS  += -lltpipc
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmctl/shmctl06.c new file +51 -0

51 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#5 lore raw

PATCH v2 5/6 include: Add declaration of struct msqid64_ds

In reply to Viresh Kumar

This adds declaration of struct msqid64_ds, which will be used by following patches.

---
 configure.ac          |   1 +
 include/lapi/msgbuf.h | 306 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 307 insertions(+)
 create mode 100644 include/lapi/msgbuf.h
configure.ac +1 -0
index f1ee98b23cbe..05032d1cfd8f 100644
@@ -153,6 +153,7 @@ AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
 AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
 AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
 AC_CHECK_TYPES([struct shmid64_ds],,,[#include <sys/shmbuf.h>])
+AC_CHECK_TYPES([struct msqid64_ds],,,[#include <sys/msgbuf.h>])
 
 AC_CHECK_TYPES([struct mmsghdr],,,[
 #define _GNU_SOURCE
include/lapi/msgbuf.h new file +306 -0

306 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#8 lore raw

PATCH v2 6/6 syscalls: msgctl: Add new test to verify the _time_high fields

In reply to Viresh Kumar

The _time_high fields must be reset by the kernel, add a test to verify that.

---
 runtest/syscalls                              |  1 +
 runtest/syscalls-ipc                          |  1 +
 .../kernel/syscalls/ipc/msgctl/.gitignore     |  1 +
 .../kernel/syscalls/ipc/msgctl/msgctl05.c     | 48 +++++++++++++++++++
 4 files changed, 51 insertions(+)
 create mode 100644 testcases/kernel/syscalls/ipc/msgctl/msgctl05.c
runtest/syscalls +1 -0
index f8b2277e0eda..ee7e2a0d217d 100644
@@ -797,6 +797,7 @@ msgctl01 msgctl01
 msgctl02 msgctl02
 msgctl03 msgctl03
 msgctl04 msgctl04
+msgctl05 msgctl05
 msgstress01 msgstress01
 msgstress02 msgstress02
 msgstress03 msgstress03
runtest/syscalls-ipc +1 -0
index 5ba3b1449a6c..c3a35896c5a8 100644
@@ -2,6 +2,7 @@ msgctl01 msgctl01
 msgctl02 msgctl02
 msgctl03 msgctl03
 msgctl04 msgctl04
+msgctl05 msgctl05
 msgstress01 msgstress01
 msgstress02 msgstress02
 msgstress03 msgstress03
testcases/kernel/syscalls/ipc/msgctl/.gitignore +1 -0
index f179f2606a3e..0157f4611bdf 100644
@@ -2,4 +2,5 @@
 /msgctl02
 /msgctl03
 /msgctl04
+/msgctl05
 /msgctl12
testcases/kernel/syscalls/ipc/msgctl/msgctl05.c new file +48 -0

48 lines not on this page · raw message

Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#9 lore raw

v2 cover syscalls: Add tests to verify the _time_high fields

In reply to Viresh Kumar

Hi!
I've added one more patch that includes config.h in the include/lapi/ipcbuf.h, since otherwise we may not get the HAVE_* macros defined and pushed, thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]
#10 lore raw

v2 cover syscalls: Add tests to verify the _time_high fields

Hi!
Looking at the travis it looks like we do have a problem with missing __kernel_ulong_t on older kernel headers:

https://api.travis-ci.org/v3/job/698929344/log.txt

Also looking into kernel headers it looks like it's defined to unsigned long unless on x32 which has unsigned long long. It seems that the types __kernel_long_t and __kernel_ulong_t firstly appeared in 3.4 along with the x32 so I guess that we will need a fallback definition in UAPI as well. And given that __kernel_long_t is defined we may need something as lapi/posix_types.h with:

#include "linux/posix_types.h"

#ifndef __kernel_long_t

# if (defined(__x86_64__) && defined(__ILP32__))
typedef long          __kernel_long_t
typedef unsigned long __kernel_ulong_t
# else
typedef long long          __kernel_long_t
typedef unsigned long long __kernel_ulong_t
# endif
#endif

Is that all or do I miss some 32bit ABI with 64bit syscalls?

Signature · 2 lines
Cyril Hrubis
[email protected]
#6 lore raw

PATCH v2 5/6 include: Add declaration of struct msqid64_ds

In reply to Viresh Kumar

Hi Viresh,

configure.ac AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>]) · line 156

Quoted 6 lines

+++ b/configure.ac

configure.ac +1 -0
@@ -153,6 +153,7 @@ AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
 AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
 AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
 AC_CHECK_TYPES([struct shmid64_ds],,,[#include <sys/shmbuf.h>])
+AC_CHECK_TYPES([struct msqid64_ds],,,[#include <sys/msgbuf.h>])

NOTE (for next time): we try to keep items in configure.ac alphabetically sorted :).

Kind regards,
Petr

#7 lore raw

PATCH v2 5/6 include: Add declaration of struct msqid64_ds

Quoted 10 lines · Petr Vorel

Hi Viresh,

configure.ac AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>]) · line 156

Quoted 6 lines

+++ b/configure.ac

configure.ac +1 -0
@@ -153,6 +153,7 @@ AC_CHECK_TYPES([struct iovec],,,[#include <sys/uio.h>])
 AC_CHECK_TYPES([struct ipc64_perm],,,[#include <sys/ipcbuf.h>])
 AC_CHECK_TYPES([struct semid64_ds],,,[#include <sys/sem.h>])
 AC_CHECK_TYPES([struct shmid64_ds],,,[#include <sys/shmbuf.h>])
+AC_CHECK_TYPES([struct msqid64_ds],,,[#include <sys/msgbuf.h>])

NOTE (for next time): we try to keep items in configure.ac alphabetically sorted :).

I normally keep such things sorted, looks like I need to watch some "ABCD" youtube videos with my 3 yrs old daughter now :)

Signature · 1 line
viresh
#11 lore raw

v2 cover syscalls: Add tests to verify the _time_high fields

In reply to Cyril Hrubis
Quoted 26 lines · Cyril Hrubis

Hi!
Looking at the travis it looks like we do have a problem with missing __kernel_ulong_t on older kernel headers:

https://api.travis-ci.org/v3/job/698929344/log.txt

Also looking into kernel headers it looks like it's defined to unsigned long unless on x32 which has unsigned long long. It seems that the types __kernel_long_t and __kernel_ulong_t firstly appeared in 3.4 along with the x32 so I guess that we will need a fallback definition in UAPI as well. And given that __kernel_long_t is defined we may need something as lapi/posix_types.h with:

#include "linux/posix_types.h"

#ifndef __kernel_long_t

# if (defined(__x86_64__) && defined(__ILP32__))
typedef long          __kernel_long_t
typedef unsigned long __kernel_ulong_t
# else
typedef long long          __kernel_long_t
typedef unsigned long long __kernel_ulong_t
# endif
#endif
Quoted 1 line

Is that all or do I miss some 32bit ABI with 64bit syscalls?

That should do I believe. Part of this is already present in tst_timer.h btw.

Signature · 1 line
viresh