syscalls: Add tests to verify the _time_high fields
cover syscalls: Add tests to verify the _time_high fields
Hello,
This patchset adds a new test to three syscalls to verify that the extended fields, _time_high, are cleared by the kernel. This was suggested by Arnd.
I did run them, but on a 64 bit machine. Please see if you can check that they work properly on 32 bit machines, where we really want to test them. This is rebased over ltp master.
Cyril, This conflicts a bit with my other time64 syscall tests, I will rebase one of these, after you apply any of these first :)
Viresh Kumar (5):
syscalls:ipc: Move libraries to libs/ director
include: Add declaration of struct ipc64_perm
syscalls: semctl: Add new test to verify the _time_high fields
syscalls: shmctl: Add new test to verify the _time_high fields
syscalls: msgctl: Add new test to verify the _time_high fields
configure.ac | 4 +
include/ipcbuf.h | 45 +++
.../syscalls/ipc/lib => include}/ipcmsg.h | 0
.../syscalls/ipc/lib => include}/ipcsem.h | 0
.../syscalls/ipc/lib => include}/ipcshm.h | 0
.../syscalls/ipc/lib => include}/libmsgctl.h | 0
.../ipc/libnewipc => include}/libnewipc.h | 2 +
include/msgbuf.h | 306 ++++++++++++++++++
include/sembuf.h | 234 ++++++++++++++
include/shmbuf.h | 273 ++++++++++++++++
.../ipc/lib => libs/libltpipc}/Makefile | 5 +-
.../ipc/lib => libs/libltpipc}/libipc.c | 0
.../ipc/lib => libs/libltpipc}/libmsgctl.c | 0
.../libnewipc => libs/libltpnewipc}/Makefile | 5 +-
.../libltpnewipc}/libnewipc.c | 0
runtest/syscalls | 3 +
runtest/syscalls-ipc | 3 +
testcases/kernel/syscalls/ipc/Makefile | 22 --
testcases/kernel/syscalls/ipc/Makefile.inc | 28 --
testcases/kernel/syscalls/ipc/Makefile2.inc | 22 --
.../kernel/syscalls/ipc/msgctl/.gitignore | 1 +
testcases/kernel/syscalls/ipc/msgctl/Makefile | 5 +-
testcases/kernel/syscalls/ipc/msgctl/msgctl05 | Bin 0 -> 498784 bytes
.../kernel/syscalls/ipc/msgctl/msgctl05.c | 48 +++
testcases/kernel/syscalls/ipc/msgget/Makefile | 5 +-
testcases/kernel/syscalls/ipc/msgrcv/Makefile | 5 +-
.../kernel/syscalls/ipc/msgrcv/msgrcv01.c | 2 +-
.../kernel/syscalls/ipc/msgrcv/msgrcv02.c | 2 +-
.../kernel/syscalls/ipc/msgrcv/msgrcv03.c | 2 +-
.../kernel/syscalls/ipc/msgrcv/msgrcv04.c | 2 +-
.../kernel/syscalls/ipc/msgrcv/msgrcv05.c | 2 +-
.../kernel/syscalls/ipc/msgrcv/msgrcv06.c | 2 +-
testcases/kernel/syscalls/ipc/msgsnd/Makefile | 5 +-
.../kernel/syscalls/ipc/msgstress/Makefile | 8 +-
.../syscalls/ipc/msgstress/msgstress01.c | 2 +-
.../syscalls/ipc/msgstress/msgstress02.c | 2 +-
.../syscalls/ipc/msgstress/msgstress03.c | 2 +-
.../syscalls/ipc/msgstress/msgstress04.c | 2 +-
.../kernel/syscalls/ipc/semctl/.gitignore | 1 +
testcases/kernel/syscalls/ipc/semctl/Makefile | 8 +-
.../kernel/syscalls/ipc/semctl/semctl02.c | 2 +-
.../kernel/syscalls/ipc/semctl/semctl03.c | 2 +-
.../kernel/syscalls/ipc/semctl/semctl04.c | 2 +-
.../kernel/syscalls/ipc/semctl/semctl05.c | 2 +-
.../kernel/syscalls/ipc/semctl/semctl08.c | 52 +++
testcases/kernel/syscalls/ipc/semget/Makefile | 5 +-
.../kernel/syscalls/ipc/semget/semget01.c | 4 +-
.../kernel/syscalls/ipc/semget/semget02.c | 4 +-
.../kernel/syscalls/ipc/semget/semget03.c | 4 +-
.../kernel/syscalls/ipc/semget/semget05.c | 2 +-
.../kernel/syscalls/ipc/semget/semget06.c | 4 +-
testcases/kernel/syscalls/ipc/semop/Makefile | 5 +-
testcases/kernel/syscalls/ipc/semop/semop03.c | 2 +-
testcases/kernel/syscalls/ipc/semop/semop04.c | 2 +-
testcases/kernel/syscalls/ipc/semop/semop05.c | 2 +-
testcases/kernel/syscalls/ipc/shmat/Makefile | 5 +-
.../kernel/syscalls/ipc/shmctl/.gitignore | 1 +
testcases/kernel/syscalls/ipc/shmctl/Makefile | 10 +-
.../kernel/syscalls/ipc/shmctl/shmctl02.c | 2 +-
.../kernel/syscalls/ipc/shmctl/shmctl03.c | 2 +-
.../kernel/syscalls/ipc/shmctl/shmctl04.c | 2 +-
.../kernel/syscalls/ipc/shmctl/shmctl06.c | 51 +++
testcases/kernel/syscalls/ipc/shmdt/Makefile | 5 +-
testcases/kernel/syscalls/ipc/shmdt/shmdt01.c | 2 +-
testcases/kernel/syscalls/ipc/shmget/Makefile | 5 +-
.../kernel/syscalls/ipc/shmget/shmget01.c | 2 +-
.../kernel/syscalls/ipc/shmget/shmget02.c | 2 +-
.../kernel/syscalls/ipc/shmget/shmget03.c | 2 +-
.../kernel/syscalls/ipc/shmget/shmget04.c | 2 +-
.../kernel/syscalls/ipc/shmget/shmget05.c | 2 +-
testcases/kernel/syscalls/kill/Makefile | 19 +-
testcases/kernel/syscalls/kill/kill07.c | 2 +-
testcases/kernel/syscalls/mremap/Makefile | 19 +-
73 files changed, 1124 insertions(+), 163 deletions(-)
create mode 100644 include/ipcbuf.h
rename {testcases/kernel/syscalls/ipc/lib => include}/ipcmsg.h (100%)
rename {testcases/kernel/syscalls/ipc/lib => include}/ipcsem.h (100%)
rename {testcases/kernel/syscalls/ipc/lib => include}/ipcshm.h (100%)
rename {testcases/kernel/syscalls/ipc/lib => include}/libmsgctl.h (100%)
rename {testcases/kernel/syscalls/ipc/libnewipc => include}/libnewipc.h (98%)
create mode 100644 include/msgbuf.h
create mode 100644 include/sembuf.h
create mode 100644 include/shmbuf.h
rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/Makefile (63%)
rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/libipc.c (100%)
rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/libmsgctl.c (100%)
rename {testcases/kernel/syscalls/ipc/libnewipc => libs/libltpnewipc}/Makefile (63%)
rename {testcases/kernel/syscalls/ipc/libnewipc => libs/libltpnewipc}/libnewipc.c (100%)
delete mode 100644 testcases/kernel/syscalls/ipc/Makefile.inc
delete mode 100644 testcases/kernel/syscalls/ipc/Makefile2.inc
create mode 100755 testcases/kernel/syscalls/ipc/msgctl/msgctl05
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.cSignature · 1 line
2.25.0.rc1.19.g042ed3e048af
PATCH 1/5 syscalls:ipc: Move libraries to libs/ director
Move the ipc libraries to libs/ directory. One of the reasons to do this was to add the capability of adding tests with both old and new test frameworks in the same ipc test directory.
---
.../syscalls/ipc/lib => include}/ipcmsg.h | 0
.../syscalls/ipc/lib => include}/ipcsem.h | 0
.../syscalls/ipc/lib => include}/ipcshm.h | 0
.../syscalls/ipc/lib => include}/libmsgctl.h | 0
.../ipc/libnewipc => include}/libnewipc.h | 2 ++
.../ipc/lib => libs/libltpipc}/Makefile | 5 ++--
.../ipc/lib => libs/libltpipc}/libipc.c | 0
.../ipc/lib => libs/libltpipc}/libmsgctl.c | 0
.../libnewipc => libs/libltpnewipc}/Makefile | 5 ++--
.../libltpnewipc}/libnewipc.c | 0
testcases/kernel/syscalls/ipc/Makefile | 22 ---------------
testcases/kernel/syscalls/ipc/Makefile.inc | 28 -------------------
testcases/kernel/syscalls/ipc/Makefile2.inc | 22 ---------------
testcases/kernel/syscalls/ipc/msgctl/Makefile | 5 +++-
testcases/kernel/syscalls/ipc/msgget/Makefile | 5 +++-
testcases/kernel/syscalls/ipc/msgrcv/Makefile | 5 +++-
.../kernel/syscalls/ipc/msgrcv/msgrcv01.c | 2 +-
.../kernel/syscalls/ipc/msgrcv/msgrcv02.c | 2 +-
.../kernel/syscalls/ipc/msgrcv/msgrcv03.c | 2 +-
.../kernel/syscalls/ipc/msgrcv/msgrcv04.c | 2 +-
.../kernel/syscalls/ipc/msgrcv/msgrcv05.c | 2 +-
.../kernel/syscalls/ipc/msgrcv/msgrcv06.c | 2 +-
testcases/kernel/syscalls/ipc/msgsnd/Makefile | 5 +++-
.../kernel/syscalls/ipc/msgstress/Makefile | 8 ++----
.../syscalls/ipc/msgstress/msgstress01.c | 2 +-
.../syscalls/ipc/msgstress/msgstress02.c | 2 +-
.../syscalls/ipc/msgstress/msgstress03.c | 2 +-
.../syscalls/ipc/msgstress/msgstress04.c | 2 +-
testcases/kernel/syscalls/ipc/semctl/Makefile | 5 +++-
.../kernel/syscalls/ipc/semctl/semctl02.c | 2 +-
.../kernel/syscalls/ipc/semctl/semctl03.c | 2 +-
.../kernel/syscalls/ipc/semctl/semctl04.c | 2 +-
.../kernel/syscalls/ipc/semctl/semctl05.c | 2 +-
testcases/kernel/syscalls/ipc/semget/Makefile | 5 +++-
.../kernel/syscalls/ipc/semget/semget01.c | 4 +--
.../kernel/syscalls/ipc/semget/semget02.c | 4 +--
.../kernel/syscalls/ipc/semget/semget03.c | 4 +--
.../kernel/syscalls/ipc/semget/semget05.c | 2 +-
.../kernel/syscalls/ipc/semget/semget06.c | 4 +--
testcases/kernel/syscalls/ipc/semop/Makefile | 5 +++-
testcases/kernel/syscalls/ipc/semop/semop03.c | 2 +-
testcases/kernel/syscalls/ipc/semop/semop04.c | 2 +-
testcases/kernel/syscalls/ipc/semop/semop05.c | 2 +-
testcases/kernel/syscalls/ipc/shmat/Makefile | 5 +++-
testcases/kernel/syscalls/ipc/shmctl/Makefile | 5 +++-
.../kernel/syscalls/ipc/shmctl/shmctl02.c | 2 +-
.../kernel/syscalls/ipc/shmctl/shmctl03.c | 2 +-
.../kernel/syscalls/ipc/shmctl/shmctl04.c | 2 +-
testcases/kernel/syscalls/ipc/shmdt/Makefile | 5 +++-
testcases/kernel/syscalls/ipc/shmdt/shmdt01.c | 2 +-
testcases/kernel/syscalls/ipc/shmget/Makefile | 5 +++-
.../kernel/syscalls/ipc/shmget/shmget01.c | 2 +-
.../kernel/syscalls/ipc/shmget/shmget02.c | 2 +-
.../kernel/syscalls/ipc/shmget/shmget03.c | 2 +-
.../kernel/syscalls/ipc/shmget/shmget04.c | 2 +-
.../kernel/syscalls/ipc/shmget/shmget05.c | 2 +-
testcases/kernel/syscalls/kill/Makefile | 19 ++-----------
testcases/kernel/syscalls/kill/kill07.c | 2 +-
testcases/kernel/syscalls/mremap/Makefile | 19 ++-----------
59 files changed, 95 insertions(+), 162 deletions(-)
rename {testcases/kernel/syscalls/ipc/lib => include}/ipcmsg.h (100%)
rename {testcases/kernel/syscalls/ipc/lib => include}/ipcsem.h (100%)
rename {testcases/kernel/syscalls/ipc/lib => include}/ipcshm.h (100%)
rename {testcases/kernel/syscalls/ipc/lib => include}/libmsgctl.h (100%)
rename {testcases/kernel/syscalls/ipc/libnewipc => include}/libnewipc.h (98%)
rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/Makefile (63%)
rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/libipc.c (100%)
rename {testcases/kernel/syscalls/ipc/lib => libs/libltpipc}/libmsgctl.c (100%)
rename {testcases/kernel/syscalls/ipc/libnewipc => libs/libltpnewipc}/Makefile (63%)
rename {testcases/kernel/syscalls/ipc/libnewipc => libs/libltpnewipc}/libnewipc.c (100%)
delete mode 100644 testcases/kernel/syscalls/ipc/Makefile.inc
delete mode 100644 testcases/kernel/syscalls/ipc/Makefile2.incinclude/ipcmsg.h renamed from testcases/kernel/syscalls/ipc/lib/ipcmsg.h +0 -0
include/ipcsem.h renamed from testcases/kernel/syscalls/ipc/lib/ipcsem.h +0 -0
include/ipcshm.h renamed from testcases/kernel/syscalls/ipc/lib/ipcshm.h +0 -0
include/libmsgctl.h renamed from testcases/kernel/syscalls/ipc/lib/libmsgctl.h +0 -0
include/libnewipc.h renamed from testcases/kernel/syscalls/ipc/libnewipc/libnewipc.h +2 -0
@@ -22,6 +22,8 @@#ifndef __LIBNEWIPC_H#define __LIBNEWIPC_H 1 +#include <sys/types.h> +#define MSG_RD 0400#define MSG_WR 0200#define MSG_RW (MSG_RD | MSG_WR)
libs/libltpipc/Makefile renamed from testcases/kernel/syscalls/ipc/lib/Makefile +3 -2
@@ -1,10 +1,11 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) International Business Machines Corp., 2001 -top_srcdir ?= ../../../../.. +top_srcdir ?= ../.. include $(top_srcdir)/include/mk/env_pre.mk -LIB := libipc.a libmsgctl.a +LIB := libltpipc.a libltpmsgctl.a include $(top_srcdir)/include/mk/lib.mk +include $(top_srcdir)/include/mk/generic_leaf_target.mk
libs/libltpipc/libipc.c renamed from testcases/kernel/syscalls/ipc/lib/libipc.c +0 -0
libs/libltpipc/libmsgctl.c renamed from testcases/kernel/syscalls/ipc/lib/libmsgctl.c +0 -0
libs/libltpnewipc/Makefile renamed from testcases/kernel/syscalls/ipc/libnewipc/Makefile +3 -2
@@ -1,10 +1,11 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2016 Xiao Yang <[email protected]> -top_srcdir ?= ../../../../.. +top_srcdir ?= ../.. include $(top_srcdir)/include/mk/env_pre.mk -INTERNAL_LIB := libnewipc.a +INTERNAL_LIB := libltpnewipc.a include $(top_srcdir)/include/mk/lib.mk +include $(top_srcdir)/include/mk/generic_leaf_target.mk
libs/libltpnewipc/libnewipc.c renamed from testcases/kernel/syscalls/ipc/libnewipc/libnewipc.c +0 -0
testcases/kernel/syscalls/ipc/Makefile +0 -22
@@ -4,26 +4,4 @@ top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/env_pre.mk - -LIBDIR := lib -LIBNEWDIR := libnewipc -FILTER_OUT_DIRS := $(LIBDIR) $(LIBNEWDIR) -LIB := $(LIBDIR)/libipc.a $(LIBDIR)/libmsgctl.a - -$(LIBDIR): - mkdir -p "$@" - -$(LIB): $(LIBDIR) - $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all - -MAKE_DEPS := $(LIB) - -trunk-clean:: | lib-clean libnew-clean - -lib-clean:: $(LIBDIR) - $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean - -libnew-clean:: $(LIBNEWDIR) - $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean - include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/kernel/syscalls/ipc/Makefile.inc deleted +0 -28
@@ -1,28 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# kernel/syscalls/ipc testcase suite common definitions Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# Ngie Cooper, July 2009 -# - -# DO NOT USE THIS FILE FOR ipc / lib!!! - -LDLIBS += -lipc -LIBDIR := ../lib - -LIBIPC := $(LIBDIR)/libipc.a - -$(LIBDIR): - mkdir -p "$@" - -$(LIBIPC): $(LIBDIR) - $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all - -MAKE_DEPS := $(LIBIPC) - -CPPFLAGS += -I$(abs_srcdir)/$(LIBDIR) - -LDFLAGS += -L$(abs_builddir)/$(LIBDIR) - -# vim: syntax=make
testcases/kernel/syscalls/ipc/Makefile2.inc deleted +0 -22
@@ -1,22 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# kernel/syscalls/ipc testcase suite common definitions Makefile. -# -# Copyright (C) 2016, Cyril Hrubis -# - -LDLIBS += -lnewipc -LIBDIR := ../libnewipc - -LIBIPC := $(LIBDIR)/libnewipc.a - -$(LIBDIR): - mkdir -p "$@" - -$(LIBIPC): $(LIBDIR) - $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all - -MAKE_DEPS := $(LIBIPC) - -CPPFLAGS += -I$(abs_srcdir)/$(LIBDIR) - -LDFLAGS += -L$(abs_builddir)/$(LIBDIR)
testcases/kernel/syscalls/ipc/msgctl/Makefile +4 -1
@@ -4,5 +4,8 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile2.inc + +LDLIBS += -lltpnewipc +LDFLAGS += -L$(top_builddir)/libs/libltpnewipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgget/Makefile +4 -1
@@ -4,5 +4,8 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile2.inc + +LDLIBS += -lltpnewipc +LDFLAGS += -L$(top_builddir)/libs/libltpnewipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgrcv/Makefile +4 -1
@@ -4,5 +4,8 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile.inc + +LDLIBS += -lltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgrcv/msgrcv01.c +1 -1
@@ -181,7 +181,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/msgrcv/msgrcv02.c +1 -1
@@ -159,7 +159,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/msgrcv/msgrcv03.c +1 -1
@@ -136,7 +136,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/msgrcv/msgrcv04.c +1 -1
@@ -147,7 +147,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/msgrcv/msgrcv05.c +1 -1
@@ -181,7 +181,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/msgrcv/msgrcv06.c +1 -1
@@ -202,7 +202,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir (); }
testcases/kernel/syscalls/ipc/msgsnd/Makefile +4 -1
@@ -8,5 +8,8 @@ FILTER_OUT_MAKE_TARGETS += msgsnd05 msgsnd06 endif include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile2.inc + +LDLIBS += -lltpnewipc +LDFLAGS += -L$(top_builddir)/libs/libltpnewipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgstress/Makefile +3 -5
@@ -5,10 +5,8 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -LIBMSGCTL := $(LIBDIR)/libmsgctl.a -LDLIBS += -lmsgctl +LDLIBS += -lltpipc +LDLIBS += -lltpmsgctl +LDFLAGS += -L$(top_builddir)/libs/libltpipc -MAKE_DEPS := $(LIBMSGCTL) - -include $(abs_srcdir)/../Makefile.inc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgstress/msgstress01.c +1 -1
@@ -39,7 +39,7 @@#include <sys/msg.h> #include "test.h" #include "ipcmsg.h" -#include "../lib/libmsgctl.h" +#include "libmsgctl.h" char *TCID ="msgstress01" ;int TST_TOTAL =1 ;
testcases/kernel/syscalls/ipc/msgstress/msgstress02.c +1 -1
@@ -37,7 +37,7 @@#include <unistd.h> #include "test.h" #include "ipcmsg.h" -#include "../lib/libmsgctl.h" +#include "libmsgctl.h" char *TCID ="msgstress02" ;int TST_TOTAL =1 ;
testcases/kernel/syscalls/ipc/msgstress/msgstress03.c +1 -1
@@ -40,7 +40,7 @@#include <sys/msg.h> #include "test.h" #include "ipcmsg.h" -#include "../lib/libmsgctl.h" +#include "libmsgctl.h" char *TCID ="msgstress03" ;int TST_TOTAL =1 ;
testcases/kernel/syscalls/ipc/msgstress/msgstress04.c +1 -1
@@ -38,7 +38,7 @@#include <unistd.h> #include "test.h" #include "ipcmsg.h" -#include "../lib/libmsgctl.h" +#include "libmsgctl.h" char *TCID ="msgstress04" ;int TST_TOTAL =1 ;
testcases/kernel/syscalls/ipc/semctl/Makefile +4 -1
@@ -4,5 +4,8 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile.inc + +LDLIBS += -lltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semctl/semctl02.c +1 -1
@@ -130,7 +130,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/semctl/semctl03.c +1 -1
@@ -147,7 +147,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/semctl/semctl04.c +1 -1
@@ -174,7 +174,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/semctl/semctl05.c +1 -1
@@ -150,7 +150,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/semget/Makefile +4 -1
@@ -4,5 +4,8 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile.inc + +LDLIBS += -lltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semget/semget01.c +2 -2
@@ -56,7 +56,7 @@* none */ -#include "../lib/ipcsem.h" +#include "ipcsem.h" char *TCID ="semget01" ;int TST_TOTAL =1 ;
@@ -150,7 +150,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/semget/semget02.c +2 -2
@@ -51,7 +51,7 @@*/ #include <pwd.h> -#include "../lib/ipcsem.h" +#include "ipcsem.h" char *TCID ="semget02" ;int TST_TOTAL =2 ;
@@ -138,7 +138,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/semget/semget03.c +2 -2
@@ -50,7 +50,7 @@* none */ -#include "../lib/ipcsem.h" +#include "ipcsem.h" char *TCID ="semget03" ;int TST_TOTAL =1 ;
@@ -111,7 +111,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/semget/semget05.c +1 -1
@@ -48,7 +48,7 @@* none */ -#include "../lib/ipcsem.h" +#include "ipcsem.h" char *TCID ="semget05" ;int TST_TOTAL =1 ;
testcases/kernel/syscalls/ipc/semget/semget06.c +2 -2
@@ -50,7 +50,7 @@* none */ -#include "../lib/ipcsem.h" +#include "ipcsem.h" char *TCID ="semget06" ;int TST_TOTAL =2 ;
@@ -121,7 +121,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/semop/Makefile +4 -1
@@ -4,5 +4,8 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile.inc + +LDLIBS += -lltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semop/semop03.c +1 -1
@@ -130,7 +130,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/semop/semop04.c +1 -1
@@ -148,7 +148,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/semop/semop05.c +1 -1
@@ -256,7 +256,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/shmat/Makefile +4 -1
@@ -4,5 +4,8 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile2.inc + +LDLIBS += -lltpnewipc +LDFLAGS += -L$(top_builddir)/libs/libltpnewipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmctl/Makefile +4 -1
@@ -7,5 +7,8 @@ shmctl05: CFLAGS += -pthread shmctl05: LDLIBS += -lrt include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile.inc + +LDLIBS += -lltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmctl/shmctl02.c +1 -1
@@ -174,7 +174,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/shmctl/shmctl03.c +1 -1
@@ -176,7 +176,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/shmctl/shmctl04.c +1 -1
@@ -97,7 +97,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/shmdt/Makefile +4 -1
@@ -4,5 +4,8 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile.inc + +LDLIBS += -lltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmdt/shmdt01.c +1 -1
@@ -184,7 +184,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/shmget/Makefile +4 -1
@@ -4,5 +4,8 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -include $(abs_srcdir)/../Makefile.inc + +LDLIBS += -lltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmget/shmget01.c +1 -1
@@ -149,7 +149,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/shmget/shmget02.c +1 -1
@@ -144,7 +144,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/shmget/shmget03.c +1 -1
@@ -123,7 +123,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/shmget/shmget04.c +1 -1
@@ -125,7 +125,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/ipc/shmget/shmget05.c +1 -1
@@ -157,7 +157,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/kill/Makefile +2 -17
@@ -5,22 +5,7 @@ top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lipc - -LIBDIR := ../ipc/lib - -LIB := $(LIBDIR)/libipc.a - -$(LIBDIR): - mkdir -p "$@" - -$(LIB): $(LIBDIR) - $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all - -MAKE_DEPS := $(LIB) - -CPPFLAGS += -I$(abs_srcdir)/$(LIBDIR) - -LDFLAGS += -L$(abs_builddir)/$(LIBDIR) +LDLIBS += -lltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/kill/kill07.c +1 -1
@@ -214,7 +214,7 @@ void setup(void)/* * Create a temporary directory and cd into it. * This helps to ensure that a unique msgkey is created. -* See ../lib/libipc.c for more information. +* See libs/libltpipc/libipc.c for more information. */ tst_tmpdir ();
testcases/kernel/syscalls/mremap/Makefile +2 -17
@@ -5,22 +5,7 @@ top_srcdir ?= ../../../.. include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lipc - -LIBDIR := ../ipc/lib - -LIB := $(LIBDIR)/libipc.a - -$(LIBDIR): - mkdir -p "$@" - -$(LIB): $(LIBDIR) - $(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all - -MAKE_DEPS := $(LIB) - -CPPFLAGS += -I$(abs_srcdir)/$(LIBDIR) - -LDFLAGS += -L$(abs_builddir)/$(LIBDIR) +LDLIBS += -lltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
PATCH 2/5 include: Add declaration of struct ipc64_perm
In reply to Viresh KumarThis adds declaration of struct ipc64_perm, which will be used by following patches.
--- configure.ac | 1 + include/ipcbuf.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 include/ipcbuf.h
configure.ac +1 -0
@@ -150,6 +150,7 @@ AC_CHECK_TYPES([struct file_dedupe_range],,,[#include <linux/fs.h>]) 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 mmsghdr],,,[ #define _GNU_SOURCE
include/ipcbuf.h new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
PATCH 3/5 syscalls: semctl: Add new test to verify the _time_high fields
In reply to Viresh KumarThe _time_high fields must be reset by the kernel, add a test to verify that.
--- configure.ac | 1 + include/sembuf.h | 234 ++++++++++++++++++ runtest/syscalls | 1 + runtest/syscalls-ipc | 1 + testcases/kernel/syscalls/ipc/msgctl/msgctl05 | Bin 0 -> 498784 bytes .../kernel/syscalls/ipc/semctl/.gitignore | 1 + testcases/kernel/syscalls/ipc/semctl/Makefile | 5 +- .../kernel/syscalls/ipc/semctl/semctl08.c | 52 ++++ 8 files changed, 294 insertions(+), 1 deletion(-) create mode 100644 include/sembuf.h create mode 100755 testcases/kernel/syscalls/ipc/msgctl/msgctl05 create mode 100644 testcases/kernel/syscalls/ipc/semctl/semctl08.c
configure.ac +1 -0
@@ -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/sembuf.h new file +234 -0
234 lines not on this page · raw message
runtest/syscalls +1 -0
@@ -1156,6 +1156,7 @@ semctl04 semctl04 semctl05 semctl05 semctl06 semctl06 semctl07 semctl07 +semctl08 semctl08 semget01 semget01 semget02 semget02
runtest/syscalls-ipc +1 -0
@@ -33,6 +33,7 @@ semctl04 semctl04 semctl05 semctl05 semctl06 semctl06 semctl07 semctl07 +semctl08 semctl08 semget01 semget01 semget02 semget02
testcases/kernel/syscalls/ipc/msgctl/msgctl05 new file binary +0 -0
testcases/kernel/syscalls/ipc/semctl/.gitignore +1 -0
@@ -5,3 +5,4 @@ /semctl05 /semctl06 /semctl07 +/semctl08
testcases/kernel/syscalls/ipc/semctl/Makefile +4 -1
@@ -5,7 +5,10 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc +semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpipc +semctl08: LDLIBS += -lltpnewipc + LDFLAGS += -L$(top_builddir)/libs/libltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpnewipc 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
PATCH 4/5 syscalls: shmctl: Add new test to verify the _time_high fields
In reply to Viresh KumarThe _time_high fields must be reset by the kernel, add a test to verify that.
--- configure.ac | 1 + include/shmbuf.h | 273 ++++++++++++++++++ runtest/syscalls | 1 + runtest/syscalls-ipc | 1 + .../kernel/syscalls/ipc/shmctl/.gitignore | 1 + testcases/kernel/syscalls/ipc/shmctl/Makefile | 7 +- .../kernel/syscalls/ipc/shmctl/shmctl06.c | 51 ++++ 7 files changed, 333 insertions(+), 2 deletions(-) create mode 100644 include/shmbuf.h create mode 100644 testcases/kernel/syscalls/ipc/shmctl/shmctl06.c
configure.ac +1 -0
@@ -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/shmbuf.h new file +273 -0
273 lines not on this page · raw message
runtest/syscalls +1 -0
@@ -1352,6 +1352,7 @@ shmctl02 shmctl02 shmctl03 shmctl03 shmctl04 shmctl04 shmctl05 shmctl05 +shmctl06 shmctl06 shmdt01 shmdt01 shmdt02 shmdt02
runtest/syscalls-ipc +1 -0
@@ -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
@@ -3,3 +3,4 @@ /shmctl03 /shmctl04 /shmctl05 +/shmctl06
testcases/kernel/syscalls/ipc/shmctl/Makefile +5 -2
@@ -3,12 +3,15 @@ top_srcdir ?= ../../../../.. +include $(top_srcdir)/include/mk/testcases.mk + 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 LDFLAGS += -L$(top_builddir)/libs/libltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpnewipc 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
PATCH 5/5 syscalls: msgctl: Add new test to verify the _time_high fields
In reply to Viresh KumarThe _time_high fields must be reset by the kernel, add a test to verify that.
--- configure.ac | 1 + include/msgbuf.h | 306 ++++++++++++++++++ runtest/syscalls | 1 + runtest/syscalls-ipc | 1 + .../kernel/syscalls/ipc/msgctl/.gitignore | 1 + .../kernel/syscalls/ipc/msgctl/msgctl05.c | 48 +++ 6 files changed, 358 insertions(+) create mode 100644 include/msgbuf.h create mode 100644 testcases/kernel/syscalls/ipc/msgctl/msgctl05.c
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>]) AC_CHECK_TYPES([struct mmsghdr],,,[ #define _GNU_SOURCE
include/msgbuf.h new file +306 -0
306 lines not on this page · raw message
runtest/syscalls +1 -0
@@ -796,6 +796,7 @@ msgctl01 msgctl01 msgctl02 msgctl02 msgctl03 msgctl03 msgctl04 msgctl04 +msgctl05 msgctl05 msgstress01 msgstress01 msgstress02 msgstress02 msgstress03 msgstress03
runtest/syscalls-ipc +1 -0
@@ -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
@@ -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
cover syscalls: Add tests to verify the _time_high fields
In reply to Viresh KumarQuoted 7 lines · Viresh Kumar
Hello,
This patchset adds a new test to three syscalls to verify that the extended fields,
_time_high, are cleared by the kernel. This was suggested by Arnd.
Quoted 6 lines
I did run them, but on a 64 bit machine. Please see if you can check that they work properly on 32 bit machines, where we really want to test them. This is rebased over ltp master.
Cyril, This conflicts a bit with my other time64 syscall tests, I will rebase one of these, after you apply any of these first :)
The known bugs we had here were actually on 64-bit machines running compat 32-bit user space. You should be able to test this on most 64-bit distros using the compat libraries and building ltp against the 32-bit version (not sure what the best way is to configure that, but it should not be hard).
Arnd
PATCH 2/5 include: Add declaration of struct ipc64_perm
In reply to Viresh KumarQuoted 5 lines · Viresh Kumar
This adds declaration of struct
ipc64_perm, which will be used by following patches.Signed-off-by Viresh Kumar <[email protected]>
Like the other structures, there are multiple definitions in the kernel:
$ git grep ^struct.ipc64_perm arch/parisc/include/uapi/asm/ipcbuf.h:struct ipc64_perm arch/powerpc/include/uapi/asm/ipcbuf.h:struct ipc64_perm arch/s390/include/uapi/asm/ipcbuf.h:struct ipc64_perm arch/sparc/include/uapi/asm/ipcbuf.h:struct ipc64_perm arch/xtensa/include/uapi/asm/ipcbuf.h:struct ipc64_perm include/uapi/asm-generic/ipcbuf.h:struct ipc64_perm
Any reason you can't just #include <asm/ipcbuf.h> to get the kernel's definition for the correct architecture?
Arnd
PATCH 3/5 syscalls: semctl: Add new test to verify the _time_high fields
In reply to Viresh KumarQuoted 6 lines · Viresh Kumar
The
_time_highfields must be reset by the kernel, add a test to verify that.Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Viresh Kumar <[email protected]>
Right, here you do need to copy the struct definitions since I forgot to add a way to detect the presence in the kernel header files, sorry about that.
Possibly you could just have a check in the Makefile that lets skips the test if it fails to build because of old kernel headers? Or maybe check LINUX_VERSION_CODE to see if the headers are at least from linux-4.19?
Quoted 5 lines
configure.ac | 1 + include/sembuf.h | 234 ++++++++++++++++++ runtest/syscalls | 1 + runtest/syscalls-ipc | 1 + testcases/kernel/syscalls/ipc/msgctl/msgctl05 | Bin 0 -> 498784 bytes
stale file
Quoted 10 lines
testcases/kernel/syscalls/ipc/semctl/semctl08.c new file +10
-0+/* get an IPC resource key */ + key =GETIPCKEY (); + + semid =semget (key,1 ,SEM_RA |IPC_CREAT ); +if (semid ==-1 ) +tst_brk (TBROK |TERRNO ,"couldn't create semaphore" ); + + arg.buf = (struct semid_ds *)&buf_ds; +TEST (semctl (semid,0 ,IPC_STAT , arg)); +if (TST_RET ==-1 )
testcases/kernel/syscalls/ipc/semctl/semctl08.c line 44
Quoted 10 lines
testcases/kernel/syscalls/ipc/semctl/semctl08.c new file +10
-0+tst_brk (TFAIL |TTERRNO ,"semctl() failed" ); + +if (buf_ds.sem_otime_high || buf_ds.sem_ctime_high) +tst_res (TFAIL ,"time_high fields aren't cleared by the kernel" ); +else +tst_res (TPASS ,"time_high fields cleared by the kernel" ); + +if (semctl (semid,0 ,IPC_RMID , arg) ==-1 ) +tst_res (TINFO ,"WARNING: semaphore deletion failed." ); +}
The test looks good to me.
If we wanted to get fancy, you could check that the time is actually correct when setting the system clock past y2038 with clock_settime64() at the start and then setting it back at the end.
That might risk crashing the system though, depending what else is running at the same time that relies on the time fitting into a 32-bit time_t.
Arnd
cover syscalls: Add tests to verify the _time_high fields
In reply to Arnd BergmannHi!
Quoted 8 lines
Quoted 8 lines
This patchset adds a new test to three syscalls to verify that the extended fields,
_time_high, are cleared by the kernel. This was suggested by Arnd.I did run them, but on a 64 bit machine. Please see if you can check that they work properly on 32 bit machines, where we really want to test them. This is rebased over ltp master.
Quoted 8 lines
Quoted 2 lines
Cyril, This conflicts a bit with my other time64 syscall tests, I will rebase one of these, after you apply any of these first :)
The known bugs we had here were actually on 64-bit machines running compat 32-bit user space. You should be able to test this on most 64-bit distros using the compat libraries and building ltp against the 32-bit version (not sure what the best way is to configure that, but it should not be hard).
We run LTP compiled with -m32 in our automation in SUSE precisely because of these reasons. Not sure if somebody else does that.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 3/5 syscalls: semctl: Add new test to verify the _time_high fields
In reply to Arnd BergmannHi!
Quoted 6 lines
Quoted 5 lines
The
_time_highfields must be reset by the kernel, add a test to verify that.Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Viresh Kumar <[email protected]>
Quoted 8 lines
Right, here you do need to copy the struct definitions since I forgot to add a way to detect the presence in the kernel header files, sorry about that.
Possibly you could just have a check in the
Makefilethat lets skips the test if it fails to build because of old kernel headers? Or maybe checkLINUX_VERSION_CODEto see if the headers are at least from linux-4.19?
We usually include autotools checks and fallback definitions in include/lapi.h in this case.
Signature · 2 lines
Cyril Hrubis [email protected]
cover syscalls: Add tests to verify the _time_high fields
In reply to Cyril HrubisHi!
Quoted 8 lines
Quoted 5 lines
The known bugs we had here were actually on 64-bit machines running compat 32-bit user space. You should be able to test this on most 64-bit distros using the compat libraries and building ltp against the 32-bit version (not sure what the best way is to configure that, but it should not be hard).
We run LTP compiled with -m32 in our automation in SUSE precisely because of these reasons. Not sure if somebody else does that.
In addition to a normal runs. And we also run syscalls with various kernel debugging enabled, I guess we have one flavor with SLUB_DEBUG etc.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 2/5 include: Add declaration of struct ipc64_perm
In reply to Arnd BergmannQuoted 10 lines · Arnd Bergmann
Quoted 5 lines · Viresh Kumar
This adds declaration of struct
ipc64_perm, which will be used by following patches.Signed-off-by Viresh Kumar <[email protected]>Like the other structures, there are multiple definitions in the kernel:
$ git grep ^struct.ipc64_perm
I searched with a { at the end :)
Quoted 9 lines
arch/parisc/include/uapi/asm/ipcbuf.h:struct
ipc64_permarch/powerpc/include/uapi/asm/ipcbuf.h:structipc64_permarch/s390/include/uapi/asm/ipcbuf.h:structipc64_permarch/sparc/include/uapi/asm/ipcbuf.h:structipc64_permarch/xtensa/include/uapi/asm/ipcbuf.h:structipc64_perminclude/uapi/asm-generic/ipcbuf.h:structipc64_permAny reason you can't just #include <
asm/ipcbuf.h> to get the kernel's definition for the correct architecture?
Because the libc header may not have the definitions, and so we need to define our own.
Signature · 1 line
viresh
PATCH 3/5 syscalls: semctl: Add new test to verify the _time_high fields
In reply to Cyril HrubisQuoted 11 lines · Cyril Hrubis
Hi!
Quoted 10 lines
Quoted 5 lines
The
_time_highfields must be reset by the kernel, add a test to verify that.Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Viresh Kumar <[email protected]>Right, here you do need to copy the struct definitions since I forgot to add a way to detect the presence in the kernel header files, sorry about that.
Quoted 7 lines
Quoted 4 lines
Possibly you could just have a check in the
Makefilethat lets skips the test if it fails to build because of old kernel headers? Or maybe checkLINUX_VERSION_CODEto see if the headers are at least from linux-4.19?We usually include autotools checks and fallback definitions in
include/lapi.hin this case.
And that's what my patches are doing. They check for
#ifndef HAVE_MSQID64_DS
and then only go define them.
We can't work with kernel versions due to possible backporting of the patches to older kernels.
Signature · 1 line
viresh
PATCH v2 2/5 include: Add declaration of struct ipc64_perm
In reply to Viresh KumarThis adds declaration of struct ipc64_perm, which will be used by following patches.
---
V2: Include definitions for other architectures as well.
configure.ac | 1 + include/ipcbuf.h | 199 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 200 insertions(+) create mode 100644 include/ipcbuf.h
configure.ac +1 -0
@@ -150,6 +150,7 @@ AC_CHECK_TYPES([struct file_dedupe_range],,,[#include <linux/fs.h>]) 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 mmsghdr],,,[ #define _GNU_SOURCE
include/ipcbuf.h new file +199 -0
199 lines not on this page · raw message
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields
In reply to Viresh KumarThe _time_high fields must be reset by the kernel, add a test to verify that.
---
V2: Remove stale file.
configure.ac | 1 + include/sembuf.h | 234 ++++++++++++++++++ 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 ++++ 7 files changed, 294 insertions(+), 1 deletion(-) create mode 100644 include/sembuf.h create mode 100644 testcases/kernel/syscalls/ipc/semctl/semctl08.c
configure.ac +1 -0
@@ -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/sembuf.h new file +234 -0
234 lines not on this page · raw message
runtest/syscalls +1 -0
@@ -1156,6 +1156,7 @@ semctl04 semctl04 semctl05 semctl05 semctl06 semctl06 semctl07 semctl07 +semctl08 semctl08 semget01 semget01 semget02 semget02
runtest/syscalls-ipc +1 -0
@@ -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
@@ -5,3 +5,4 @@ /semctl05 /semctl06 /semctl07 +/semctl08
testcases/kernel/syscalls/ipc/semctl/Makefile +4 -1
@@ -5,7 +5,10 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc +semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpipc +semctl08: LDLIBS += -lltpnewipc + LDFLAGS += -L$(top_builddir)/libs/libltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpnewipc 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
cover syscalls: Add tests to verify the _time_high fields
In reply to Cyril HrubisQuoted 12 lines · Cyril Hrubis
Hi!
Quoted 11 lines
Quoted 10 lines
This patchset adds a new test to three syscalls to verify that the extended fields,
_time_high, are cleared by the kernel. This was suggested by Arnd.I did run them, but on a 64 bit machine. Please see if you can check that they work properly on 32 bit machines, where we really want to test them. This is rebased over ltp master.
Cyril, This conflicts a bit with my other time64 syscall tests, I will rebase one of these, after you apply any of these first :)
Quoted 8 lines
Quoted 5 lines
The known bugs we had here were actually on 64-bit machines running compat 32-bit user space. You should be able to test this on most 64-bit distros using the compat libraries and building ltp against the 32-bit version (not sure what the best way is to configure that, but it should not be hard).
We run LTP compiled with -m32 in our automation in SUSE precisely because of these reasons. Not sure if somebody else does that.
Okay, I tested LTP with:
LDFLAGS=-m32 CFLAGS=-m32 ./configure
and the time-high fields got cleared on my x86 machine with 5.5 kernel.
Signature · 1 line
viresh
PATCH 1/5 syscalls:ipc: Move libraries to libs/ director
In reply to Viresh KumarHi!
Quoted 3 lines
Move the ipc libraries to libs/ directory. One of the reasons to do this was to add the capability of adding tests with both old and new test frameworks in the same ipc test directory.
Pushed with following diff, thanks.
1) You cannot build two different libs in one directory
2) Setting LTPLIBS instead of LDFLAGS generates proper build dependencies as well
3) Limit the linker flags for the kill and mremap tests
libs/libltpipc/Makefile +1 -1
@@ -5,7 +5,7 @@ top_srcdir ?= ../.. include $(top_srcdir)/include/mk/env_pre.mk -LIB := libltpipc.a libltpmsgctl.a +LIB := libltpipc.a include $(top_srcdir)/include/mk/lib.mk include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgctl/Makefile +2 -1
@@ -3,9 +3,10 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpnewipc + include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpnewipc -LDFLAGS += -L$(top_builddir)/libs/libltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgget/Makefile +2 -1
@@ -3,9 +3,10 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpnewipc + include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpnewipc -LDFLAGS += -L$(top_builddir)/libs/libltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgrcv/Makefile +2 -1
@@ -3,9 +3,10 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpipc + include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpipc -LDFLAGS += -L$(top_builddir)/libs/libltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgsnd/Makefile +2 -1
@@ -3,6 +3,8 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpnewipc + ifeq ($(UCLINUX),1) FILTER_OUT_MAKE_TARGETS += msgsnd05 msgsnd06 endif
@@ -10,6 +12,5 @@ endif include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpnewipc -LDFLAGS += -L$(top_builddir)/libs/libltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/msgstress/Makefile +2 -2
@@ -3,10 +3,10 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpipc + include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpipc -LDLIBS += -lltpmsgctl -LDFLAGS += -L$(top_builddir)/libs/libltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semctl/Makefile +2 -1
@@ -3,9 +3,10 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpipc + include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpipc -LDFLAGS += -L$(top_builddir)/libs/libltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semget/Makefile +2 -1
@@ -3,9 +3,10 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpipc + include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpipc -LDFLAGS += -L$(top_builddir)/libs/libltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/semop/Makefile +2 -1
@@ -3,9 +3,10 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpipc + include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpipc -LDFLAGS += -L$(top_builddir)/libs/libltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmat/Makefile +2 -1
@@ -3,9 +3,10 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpnewipc + include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpnewipc -LDFLAGS += -L$(top_builddir)/libs/libltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmctl/Makefile +2 -1
@@ -3,12 +3,13 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpipc + shmctl05: CFLAGS += -pthread shmctl05: LDLIBS += -lrt include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpipc -LDFLAGS += -L$(top_builddir)/libs/libltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmdt/Makefile +2 -1
@@ -3,9 +3,10 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpipc + include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpipc -LDFLAGS += -L$(top_builddir)/libs/libltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/ipc/shmget/Makefile +2 -1
@@ -3,9 +3,10 @@ top_srcdir ?= ../../../../.. +LTPLIBS = ltpipc + include $(top_srcdir)/include/mk/testcases.mk LDLIBS += -lltpipc -LDFLAGS += -L$(top_builddir)/libs/libltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/kill/Makefile +4 -2
@@ -3,9 +3,11 @@ top_srcdir ?= ../../../.. +LTPLIBS = ltpipc + include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc -LDFLAGS += -L$(top_builddir)/libs/libltpipc +kill07: LDLIBS += -lltpipc +kill05: LDLIBS += -lltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/mremap/Makefile +3 -2
@@ -3,9 +3,10 @@ top_srcdir ?= ../../../.. +LTPLIBS = ltpipc + include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc -LDFLAGS += -L$(top_builddir)/libs/libltpipc +mremap04: LDLIBS += -lltpipc include $(top_srcdir)/include/mk/generic_leaf_target.mk
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/5 syscalls:ipc: Move libraries to libs/ director
Quoted 11 lines · Cyril Hrubis
Hi!
Quoted 3 lines
Move the ipc libraries to libs/ directory. One of the reasons to do this was to add the capability of adding tests with both old and new test frameworks in the same ipc test directory.
Pushed with following diff, thanks.
1) You cannot build two different libs in one directory
2) Setting LTPLIBS instead of LDFLAGS generates proper build dependencies as well
3) Limit the linker flags for the kill and mremap tests
I don't think you pushed the changes you made. I still see my original patch there. :)
Signature · 1 line
viresh
PATCH 1/5 syscalls:ipc: Move libraries to libs/ director
Hi Cyril
Quoted 8 lines · Cyril Hrubis
Quoted 7 lines
Hi!
Quoted 3 lines
Move the ipc libraries to libs/ directory. One of the reasons to do this was to add the capability of adding tests with both old and new test frameworks in the same ipc test directory.
Pushed with following diff, thanks.
Quoted 7 lines
Quoted 4 lines
1) You cannot build two different libs in one directory
2) Setting LTPLIBS instead of LDFLAGS generates proper build dependencies as well
3) Limit the linker flags for the kill and mremap testsI don't think you pushed the changes you made. I still see my original patch there. :)
It looks like you miss this change. It still uses
LDFLAGS instead of correct LTPLIBS.
Best Regards
Yang Xu
Quoted 1 line
PATCH 1/5 syscalls:ipc: Move libraries to libs/ director
In reply to Viresh KumarHi!
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Move the ipc libraries to libs/ directory. One of the reasons to do this was to add the capability of adding tests with both old and new test frameworks in the same ipc test directory.
Pushed with following diff, thanks.
Quoted 7 lines
Quoted 4 lines
1) You cannot build two different libs in one directory
2) Setting LTPLIBS instead of LDFLAGS generates proper build dependencies as well
3) Limit the linker flags for the kill and mremap testsI don't think you pushed the changes you made. I still see my original patch there. :)
Indeed, I messed up ammend when I was in a hurry, sorry for that. I've pushed a fix today.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 2/5 include: Add declaration of struct ipc64_perm
In reply to Viresh KumarHi!
Applied with two changes, thanks.
* The header is moved to lapi/ where it should have been
* I've removed a piece of GPL header that probably ended up in the source due to copy&paste
Quoted 5 lines
include/ipcbuf.h new file +5
-0+#if defined(__powerpc__) || defined(__powerpc64__) +#define HAVE_IPC64_PERM +/* +* The ipc64_perm structure for the powerpc is identical to +* kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the
include/ipcbuf.h line 56
Quoted 10 lines
include/ipcbuf.h new file +10
-0+* kernel. Note extra padding because this structure is passed back +* and forth between kernel and user space. Pad space is left for: +* - 1 32-bit value to fill up for 8-byte alignment +* - 2 miscellaneous 64-bit values +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +*/
^ This part.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields
In reply to Viresh KumarHi!
Quoted 258 lines
Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Viresh Kumar <[email protected]>---
V2: Remove stale file.configure.ac | 1 + include/sembuf.h | 234 ++++++++++++++++++ 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 ++++ 7 files changed, 294 insertions(+), 1 deletion(-) create mode 100644 include/sembuf.h create mode 100644 testcases/kernel/syscalls/ipc/semctl/semctl08.cconfigure.ac +1
-0@@ -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_SOURCEinclude/sembuf.h new file +224
-0@@ -0,0 +1,234 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2020 Linaro Limited. All rights reserved. +* Author: Viresh Kumar <[email protected]> +*/ + +#ifndef IPC_SEMBUF_H +#define IPC_SEMBUF_H + +#include <linux/posix_types.h> +#include <sys/sem.h> +#include "tst_timer.h" +#include "ipcbuf.h" + +#ifndef HAVE_SEMID64_DS + +#if defined(__mips__) +#define HAVE_SEMID64_DS +/* + * The semid64_ds structure for the MIPS architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for 2 miscellaneous 64-bit values on mips64, + * but used for the upper 32 bit of the time values on mips32. + */ +#if defined(__arch64__) +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused1; + unsigned long __unused2; +}; +#else +#define HAVE_SEMID64_DS_TIME_HIGH +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime; /* last change time */ + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long sem_otime_high; + unsigned long sem_ctime_high; +}; +#endif +#endif /* __mips__ */ + +#if defined(__hppa__) +#define HAVE_SEMID64_DS +/* + * The semid64_ds structure for parisc architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#if __BITS_PER_LONG == 64 + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ +#else +#define HAVE_SEMID64_DS_TIME_HIGH + unsigned long sem_otime_high; + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime_high; + unsigned long sem_ctime; /* last change time */ +#endif + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused1; + unsigned long __unused2; +}; +#endif /* __hppa__ */ + +#if defined(__powerpc__) || defined(__powerpc64__) +#define HAVE_SEMID64_DS +/* + * The semid64_ds structure for PPC architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32/64-bit values + */ + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#ifndef __powerpc64__ +#define HAVE_SEMID64_DS_TIME_HIGH + unsigned long sem_otime_high; + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime_high; + unsigned long sem_ctime; /* last change time */ +#else + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ +#endif + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused3; + unsigned long __unused4; +}; +#endif /* defined(__powerpc__) || defined(__powerpc64__) */ + +#if defined(__sparc__) +#define HAVE_SEMID64_DS +/* + * The semid64_ds structure for sparc architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + */ + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#if defined(__arch64__) + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ +#else +#define HAVE_SEMID64_DS_TIME_HIGH + unsigned long sem_otime_high; + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime_high; + unsigned long sem_ctime; /* last change time */ +#endif + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused1; + unsigned long __unused2; +}; +#endif /* __sparc__ */ + +#if defined(__x86_64__) +#define HAVE_SEMID64_DS +/* + * The semid64_ds structure for x86 architecture. + * Note extra padding because this structure is passed back and forth + * between kernel and user space. + * + * Pad space is left for: + * - 2 miscellaneous 32-bit values + * + * x86_64 and x32 incorrectly added padding here, so the structures + * are still incompatible with the padding on x86. + */ +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#ifdef __i386__ +#define HAVE_SEMID64_DS_TIME_HIGH + unsigned long sem_otime; /* last semop time */ + unsigned long sem_otime_high; + unsigned long sem_ctime; /* last change time */ + unsigned long sem_ctime_high; +#else + __kernel_long_t sem_otime; /* last semop time */ + __kernel_ulong_t __unused1; + __kernel_long_t sem_ctime; /* last change time */ + __kernel_ulong_t __unused2; +#endif + __kernel_ulong_t sem_nsems; /* no. of semaphores in array */ + __kernel_ulong_t __unused3; + __kernel_ulong_t __unused4; +}; +#endif /* defined(__x86_64__) */ + +#if defined(__xtensa__) +#define HAVE_SEMID64_DS +#define HAVE_SEMID64_DS_TIME_HIGH + +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#ifdef __XTENSA_EL__ + unsigned long sem_otime; /* last semop time */ + unsigned long sem_otime_high; + unsigned long sem_ctime; /* last change time */ + unsigned long sem_ctime_high; +#else + unsigned long sem_otime_high; + unsigned long sem_otime; /* last semop time */ + unsigned long sem_ctime_high; + unsigned long sem_ctime; /* last change time */ +#endif + unsigned long sem_nsems; /* no. of semaphores in array */ + unsigned long __unused3; + unsigned long __unused4; +}; + +#endif /* __xtensa__ */ + +#ifndef HAVE_SEMID64_DS +/* + * The semid64_ds structure for most architectures (though it came + * from x86_32 originally). Note extra padding because this structure + * is passed back and forth between kernel and user space. + * + * semid64_ds was originally meant to be architecture specific, but + * everyone just ended up making identical copies without specific + * optimizations, so we may just as well all use the same one. + * + * 64 bit architectures use a 64-bit long time field here, while + * 32 bit architectures have a pair of unsigned long values. + * + * On big-endian systems, the padding is in the wrong place for + * historic reasons, so user space has to reconstruct a time_t + * value using + * + * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime + + * ((long long)kernel_semid64_ds.sem_otime_high << 32) + * + * Pad space is left for 2 miscellaneous 32-bit values + */ +struct semid64_ds { + struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ +#if __BITS_PER_LONG == 64 + long sem_otime; /* last semop time */ + long sem_ctime; /* last change time */ +#else +#define HAVE_SEMID64_DS_TIME_HIGH + unsigned long sem_otime; /* last semop time */ + unsigned long sem_otime_high; + unsigned long sem_ctime; /* last change time */ + unsigned long sem_ctime_high;
include/sembuf.h line 234
Quoted 10 lines
include/sembuf.h new file +10
-0+#endif +unsigned long sem_nsems;/* no. of semaphores in array */ +unsigned long __unused3; +unsigned long __unused4; +}; +#endif /* semid64_ds */ + +#endif /* HAVE_SEMID64_DS */ + +#endif /* IPC_SEMBUF_H */
Can we please put the header into the lapi/ and also split this patch so that we have one for the the fallback definition and one for the actuall test?
Quoted 38 lines
runtest/syscalls +1
-0@@ -1156,6 +1156,7 @@ semctl04 semctl04 semctl05 semctl05 semctl06 semctl06 semctl07 semctl07 +semctl08 semctl08 semget01 semget01 semget02 semget02runtest/syscalls-ipc +1
-0@@ -33,6 +33,7 @@ semctl04 semctl04 semctl05 semctl05 semctl06 semctl06 semctl07 semctl07 +semctl08 semctl08 semget01 semget01 semget02 semget02testcases/kernel/syscalls/ipc/semctl/.gitignore +1
-0@@ -5,3 +5,4 @@ /semctl05 /semctl06 /semctl07 +/semctl08testcases/kernel/syscalls/ipc/semctl/Makefile +0
-0
testcases/kernel/syscalls/ipc/semctl/Makefile top_srcdir ?= ../../../../.. · line 12
Quoted 9 lines
testcases/kernel/syscalls/ipc/semctl/Makefile +4
-1@@ -5,7 +5,10 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc +semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpipc +semctl08: LDLIBS += -lltpnewipc + LDFLAGS += -L$(top_builddir)/libs/libltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
This does not apply anymore after my fix. This should be:
LTPLIBS = ltpipc ltpnewipc
Which would add a dependency on these libraries in the build system and also append the LDFLAGS, then all we need to do is to add the LDLIBS.
Quoted 49 lines
testcases/kernel/syscalls/ipc/semctl/Makefile +0
-0include $(top_srcdir)/include/mk/generic_leaf_target.mktestcases/kernel/syscalls/ipc/semctl/semctl08.c new file +42
-0@@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2020 Viresh Kumar <[email protected]> +* +* Description: +* Cross verify the _high fields being set to 0 by the kernel. +*/ +#include "lapi/semun.h" +#include "tst_test.h" +#include "libnewipc.h" +#include "sembuf.h" + +#ifdef HAVE_SEMID64_DS_TIME_HIGH + +static void run (void ) +{ +struct semid64_ds buf_ds = { + .sem_otime_high =0x0A0A , + .sem_ctime_high =0x0A0A , + }; +int semid; +union semun arg; +key_t key; + +/* get an IPC resource key */ + key =GETIPCKEY (); + + semid =semget (key,1 ,SEM_RA |IPC_CREAT ); +if (semid ==-1 ) +tst_brk (TBROK |TERRNO ,"couldn't create semaphore" ); + + arg.buf = (struct semid_ds *)&buf_ds; +TEST (semctl (semid,0 ,IPC_STAT , arg)); +if (TST_RET ==-1 ) +tst_brk (TFAIL |TTERRNO ,"semctl() failed" ); + +if (buf_ds.sem_otime_high || buf_ds.sem_ctime_high) +tst_res (TFAIL ,"time_high fields aren't cleared by the kernel" ); +else +tst_res (TPASS ,"time_high fields cleared by the kernel" ); + +if (semctl (semid,0 ,IPC_RMID , arg) ==-1 )
testcases/kernel/syscalls/ipc/semctl/semctl08.c line 52
Quoted 10 lines
testcases/kernel/syscalls/ipc/semctl/semctl08.c new file +10
-0+ tst_res(TINFO, "WARNING: semaphore deletion failed."); +} + +static struct tst_test test = { + .test_all = run, + .needs_tmpdir =1 , +}; +#else +TST_TEST_TCONF ("test requires struct semid64_ds to have the time_high fields" ); +#endif
Other than that the patch looks good.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 4/5 syscalls: shmctl: Add new test to verify the _time_high fields
In reply to Viresh KumarHi!
The same comments apply here as well.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 5/5 syscalls: msgctl: Add new test to verify the _time_high fields
In reply to Viresh KumarHi!
Quoted 5 lines
Suggested-by Arnd Bergmann <[email protected]>Signed-off-by Viresh Kumar <[email protected]>--- configure.ac | 1 + include/msgbuf.h | 306 ++++++++++++++++++
Here as well, I mainly do not like polluting the include/ with headers that belongs into lapi/
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields
In reply to Cyril HrubisQuoted 17 lines · Cyril Hrubis
Quoted 5 lines
testcases/kernel/syscalls/ipc/semctl/Makefile +0
-0testcases/kernel/syscalls/ipc/semctl/Makefile top_srcdir ?= ../../../../.. · line 12
Quoted 9 lines
testcases/kernel/syscalls/ipc/semctl/Makefile +4
-1@@ -5,7 +5,10 @@ top_srcdir ?= ../../../../.. include $(top_srcdir)/include/mk/testcases.mk -LDLIBS += -lltpipc +semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpipc +semctl08: LDLIBS += -lltpnewipc + LDFLAGS += -L$(top_builddir)/libs/libltpipc +LDFLAGS += -L$(top_builddir)/libs/libltpnewipcThis does not apply anymore after my fix. This should be:
Quoted 4 lines
LTPLIBS = ltpipc ltpnewipc
Which would add a dependency on these libraries in the build system and also append the LDFLAGS, then all we need to do is to add the LDLIBS.
testcases/kernel/syscalls/ipc/semctl/Makefile +1 -2
@@ -3,7 +3,7 @@ top_srcdir ?= ../../../../.. -LTPLIBS = ltpipc +LTPLIBS = ltpipc ltpnewipc include $(top_srcdir)/include/mk/testcases.mk
@@ -11,4 +11,4 @@ semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpi semctl08: LDLIBS += -lltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk -LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
This doesn't build for some reason.
make -C "/mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc /mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc" -f "/mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc /mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/Makefile" all make[1]: *** /mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc /mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc: No such file or directory. Stop.../../../../../include/mk/testcases.mk:52: recipe for target '/mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/libltpnewipc.a' failed
make: *** [/mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/libltpnewipc.a] Error 2
Signature · 1 line
viresh
PATCH v2 2/5 include: Add declaration of struct ipc64_perm
In reply to Cyril HrubisQuoted 17 lines · Cyril Hrubis
Hi!
Applied with two changes, thanks.* The header is moved to lapi/ where it should have been
* I've removed a piece of GPL header that probably ended up in the source due to copy&paste
Quoted 9 lines
include/ipcbuf.h new file +9
-0+#if defined(__powerpc__) || defined(__powerpc64__) +#define HAVE_IPC64_PERM +/* +* The ipc64_perm structure for the powerpc is identical to +* kern_ipc_perm as we have always had 32-bit UIDs and GIDs in the +* kernel. Note extra padding because this structure is passed back +* and forth between kernel and user space. Pad space is left for: +* - 1 32-bit value to fill up for 8-byte alignment +* - 2 miscellaneous 64-bit values
Quoted 8 lines
Quoted 6 lines
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */^ This part.
I don't see this patch in master yet.
Signature · 1 line
viresh
PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields
In reply to Viresh KumarHi!
Quoted 19 lines
testcases/kernel/syscalls/ipc/semctl/Makefile +1
-2@@ -3,7 +3,7 @@ top_srcdir ?= ../../../../.. -LTPLIBS = ltpipc +LTPLIBS = ltpipc ltpnewipc include $(top_srcdir)/include/mk/testcases.mk@@ -11,4 +11,4 @@ semctl01 semctl02 semctl03 semctl04 semctl05 semctl06 semctl07: LDLIBS += -lltpi semctl08: LDLIBS += -lltpnewipc include $(top_srcdir)/include/mk/generic_leaf_target.mk -LDFLAGS += -L$(top_builddir)/libs/libltpnewipc
Quoted 6 lines
This doesn't build for some reason.
make -C "
/mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc/mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc" -f "/mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc/mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/Makefile" all make[1]: ***/mnt/ssd/all/work/repos/tools/ltp/libs/libltpipc/mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc: No such file or directory. Stop.../../../../../include/mk/testcases.mk:52: recipe for target '/mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/libltpnewipc.a' failed
make: *** [/mnt/ssd/all/work/repos/tools/ltp/libs/libltpnewipc/libltpnewipc.a] Error 2
Ah, right, the rule that rebuilds the libraries does not work correctly for more than one library because I do pass "$^" there which is the list of directories and not a single directory.
As a quick hack this should fix it:
include/mk/testcases.mk +3 -1
@@ -49,7 +49,9 @@ LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach MAKE_DEPS += $(LTPLIBS_FILES) $(LTPLIBS_FILES): $(LTPLIBS_DIRS) - $(MAKE) -C "$^" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$^)/Makefile" all + for dir in $^; do \ + $(MAKE) -C "$$dir" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$$dir)/Makefile" all; \ + done LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS))
This does not parallelize the build but I guess that it would be fine since when we rebuild LTP from top directory the libraries are build first anyways and this is no-op.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 2/5 include: Add declaration of struct ipc64_perm
In reply to Viresh KumarHi!
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
+ * The
ipc64_permstructure for the powerpc is identical to
+ *kern_ipc_permas we have always had 32-bit UIDs and GIDs in the
+ * kernel. Note extra padding because this structure is passed back
+ * and forth between kernel and user space. Pad space is left for:
+ * - 1 32-bit value to fill up for 8-byte alignment
+ * - 2 miscellaneous 64-bit values
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
Quoted 4 lines
Quoted 2 lines
^ This part.I don't see this patch in master yet.
Sorry, haven't done git push at the end of my workday, should be there now.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields
In reply to Cyril HrubisQuoted 22 lines · Cyril Hrubis
Ah, right, the rule that rebuilds the libraries does not work correctly for more than one library because I do pass "$^" there which is the list of directories and not a single directory.
As a quick hack this should fix it:
include/mk/testcases.mk +3
-1@@ -49,7 +49,9 @@ LTPLIBS_FILES = $(addsuffix .a, $(addprefix $(abs_top_builddir)/libs/, $(foreach MAKE_DEPS += $(LTPLIBS_FILES) $(LTPLIBS_FILES): $(LTPLIBS_DIRS) - $(MAKE) -C "$^" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$^)/Makefile" all + for dir in $^; do \ + $(MAKE) -C "$$dir" -f "$(subst $(abs_top_builddir),$(abs_top_srcdir),$$dir)/Makefile" all; \ + done LDFLAGS += $(addprefix -L$(top_builddir)/libs/lib, $(LTPLIBS))
Quoted 3 lines
This does not parallelize the build but I guess that it would be fine since when we rebuild LTP from top directory the libraries are build first anyways and this is no-op.
Please merge it, I am sending my patches again based on this.
Signature · 1 line
viresh
PATCH v2 3/5 syscalls: semctl: Add new test to verify the _time_high fields
Hi!
Quoted 1 line
Please merge it, I am sending my patches again based on this.
I've just pushed a proper fix with a pattern rule instead.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 2/5 include: Add declaration of struct ipc64_perm
In reply to Viresh KumarHi,
Quoted 2 lines
include/ipcbuf.h new file +0
-0
...
Quoted 3 lines
include/ipcbuf.h new file +3
-0+#include <linux/posix_types.h> + +#ifndef HAVE_IPC64_PERM
...
include/ipcbuf.h line 41
Quoted 13 lines
include/ipcbuf.h new file +13
-0+struct ipc64_perm { +__kernel_key_t key; +__kernel_uid32_t uid; +__kernel_gid32_t gid; +__kernel_uid32_t cuid; +__kernel_gid32_t cgid; +__kernel_mode_t mode; +/* pad if mode_t is u16: */ +unsigned char __pad1[4 -sizeof (__kernel_mode_t)]; +unsigned short seq; +unsigned short __pad2; +__kernel_ulong_t __unused1; +__kernel_ulong_t __unused2;
Since this commit we depend on kernel headers from v3.4-rc1
- __kernel_ulong_t was defined in afead38d011a ("posix_types: Introduce __kernel_[u]long_t").
I'll send a RFC patch, because not sure, whether we should still support these old versions, or just drop the oldest distro from Travis and declare kernel v3.4 dependency. BTW current glibc requires v3.2.
Kind regards,
Petr