* [LTP] [PATCH 0/3] ptrace: Remove old autotools checks
@ 2023-11-28 9:15 Petr Vorel
2023-11-28 9:15 ` [LTP] [PATCH 1/3] " Petr Vorel
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Petr Vorel @ 2023-11-28 9:15 UTC (permalink / raw)
To: ltp; +Cc: Richard Palethorpe
CI: https://github.com/pevik/ltp/actions/runs/7016508622
Petr Vorel (3):
ptrace: Remove old autotools checks
ptrace: Build ptrace06, enable in runtest/syscalls
ptrace: Remove simple_tracer.c
configure.ac | 1 -
m4/ltp-ptrace.m4 | 26 ----
runtest/syscalls | 5 +-
testcases/kernel/controllers/freezer/vfork.c | 4 +-
testcases/kernel/syscalls/ptrace/.gitignore | 1 +
testcases/kernel/syscalls/ptrace/Makefile | 27 +---
.../syscalls/ptrace/make_syscall_list.sh | 7 -
testcases/kernel/syscalls/ptrace/ptrace.h | 38 -----
testcases/kernel/syscalls/ptrace/ptrace01.c | 3 +-
testcases/kernel/syscalls/ptrace/ptrace02.c | 3 +-
testcases/kernel/syscalls/ptrace/ptrace03.c | 3 +-
testcases/kernel/syscalls/ptrace/ptrace04.c | 4 +-
testcases/kernel/syscalls/ptrace/ptrace05.c | 4 +-
testcases/kernel/syscalls/ptrace/ptrace06.c | 5 +-
testcases/kernel/syscalls/ptrace/ptrace07.c | 3 +-
testcases/kernel/syscalls/ptrace/ptrace11.c | 3 +-
.../kernel/syscalls/ptrace/simple_tracer.c | 144 ------------------
testcases/kernel/syscalls/ptrace/syscalls.h | 17 ---
18 files changed, 14 insertions(+), 284 deletions(-)
delete mode 100644 m4/ltp-ptrace.m4
delete mode 100755 testcases/kernel/syscalls/ptrace/make_syscall_list.sh
delete mode 100644 testcases/kernel/syscalls/ptrace/ptrace.h
delete mode 100644 testcases/kernel/syscalls/ptrace/simple_tracer.c
delete mode 100644 testcases/kernel/syscalls/ptrace/syscalls.h
--
2.42.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH 1/3] ptrace: Remove old autotools checks
2023-11-28 9:15 [LTP] [PATCH 0/3] ptrace: Remove old autotools checks Petr Vorel
@ 2023-11-28 9:15 ` Petr Vorel
2023-11-28 9:15 ` [LTP] [PATCH 2/3] ptrace: Build ptrace06, enable in runtest/syscalls Petr Vorel
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2023-11-28 9:15 UTC (permalink / raw)
To: ltp; +Cc: Richard Palethorpe
ptrace fallbacks in ptrace.h and their autotools checks in
m4/ltp-ptrace.m4 are from 2009. CI shows that they aren't needed for our
current supported systems - the oldest used glibc 2.22 has
<sys/ptrace.h> new enough that it can be used.
m4/ltp-ptrace.m4 even checked <sys/reg.h> and <asm/ptrace.h> for kernel
change from v2.6.27-rc1 (2008), clearly not needed nowadays.
Using only <sys/ptrace.h> instead of both <sys/ptrace.h> and
<linux/ptrace.h> resolves header conflict (documented at
https://sourceware.org/glibc/wiki/Synchronizing_Headers):
$ make check-ptrace05
CHECK testcases/kernel/syscalls/ptrace/ptrace05.c
ptrace05.c: note: in included file (through ptrace.h):
/usr/include/linux/ptrace.h:50:9: warning: preprocessor token PTRACE_GETREGSET redefined
ptrace05.c: note: in included file (through ptrace.h):
/usr/include/sys/ptrace.h:153:9: this was the original definition
ptrace05.c: note: in included file (through ptrace.h):
/usr/include/linux/ptrace.h:51:9: warning: preprocessor token PTRACE_SETREGSET redefined
ptrace05.c: note: in included file (through ptrace.h):
/usr/include/sys/ptrace.h:157:9: this was the original definition
ptrace05.c: note: in included file (through ptrace.h):
/usr/include/linux/ptrace.h:53:9: warning: preprocessor token PTRACE_SEIZE redefined
...
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
configure.ac | 1 -
m4/ltp-ptrace.m4 | 26 -------------
testcases/kernel/controllers/freezer/vfork.c | 4 +-
testcases/kernel/syscalls/ptrace/ptrace.h | 38 -------------------
testcases/kernel/syscalls/ptrace/ptrace01.c | 3 +-
testcases/kernel/syscalls/ptrace/ptrace02.c | 3 +-
testcases/kernel/syscalls/ptrace/ptrace03.c | 3 +-
testcases/kernel/syscalls/ptrace/ptrace04.c | 4 +-
testcases/kernel/syscalls/ptrace/ptrace05.c | 4 +-
testcases/kernel/syscalls/ptrace/ptrace06.c | 5 +--
testcases/kernel/syscalls/ptrace/ptrace07.c | 3 +-
testcases/kernel/syscalls/ptrace/ptrace11.c | 3 +-
.../kernel/syscalls/ptrace/simple_tracer.c | 1 -
13 files changed, 10 insertions(+), 88 deletions(-)
delete mode 100644 m4/ltp-ptrace.m4
delete mode 100644 testcases/kernel/syscalls/ptrace/ptrace.h
diff --git a/configure.ac b/configure.ac
index e1a10a10e..1d7e862d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -383,7 +383,6 @@ LTP_CHECK_FORTIFY_SOURCE
LTP_CHECK_KERNEL_DEVEL
LTP_CHECK_KEYUTILS_SUPPORT
LTP_CHECK_LIBMNL
-LTP_CHECK_LINUX_PTRACE
LTP_CHECK_LINUXRANDOM
LTP_CHECK_NOMMU_LINUX
LTP_CHECK_SELINUX
diff --git a/m4/ltp-ptrace.m4 b/m4/ltp-ptrace.m4
deleted file mode 100644
index 6f03fa57e..000000000
--- a/m4/ltp-ptrace.m4
+++ /dev/null
@@ -1,26 +0,0 @@
-dnl SPDX-License-Identifier: GPL-2.0-or-later
-dnl Copyright (c) Jiri Palecek 2009
-
-AC_DEFUN([LTP_CHECK_LINUX_PTRACE],
-_LTP_CHECK_LINUX_PTRACE
-)
-
-dnl Check for ptrace support
-dnl in commit 016ae219 in July 2008
-AC_DEFUN([_LTP_CHECK_LINUX_PTRACE],[
-dnl order of headers checked here is significant
-AC_CHECK_HEADERS([ \
- sys/ptrace.h \
- sys/reg.h \
- asm/ptrace.h \
- linux/ptrace.h \
-])
-save_CPPFLAGS=$CPPFLAGS
-CPPFLAGS="$CPPFLAGS -I$srcdir/testcases/kernel/syscalls/ptrace"
-AC_CHECK_TYPES([struct user_regs_struct, struct pt_regs],,,[#include "ptrace.h"])
-AC_CHECK_DECLS([PTRACE_GETSIGINFO, PTRACE_O_TRACEVFORKDONE, PTRACE_SETOPTIONS],,,[#include "ptrace.h"])
-dnl glibc-2.18 defines ptrace_peeksiginfo_args in sys/ptrace.h which
-dnl conflicts with the one from linux kernel in linux/ptrace.h
-AC_CHECK_TYPES([struct ptrace_peeksiginfo_args],,,[#include <sys/ptrace.h>])
-CPPFLAGS=$save_CPPFLAGS
-])
diff --git a/testcases/kernel/controllers/freezer/vfork.c b/testcases/kernel/controllers/freezer/vfork.c
index 0b25e90c2..9f4359bf8 100644
--- a/testcases/kernel/controllers/freezer/vfork.c
+++ b/testcases/kernel/controllers/freezer/vfork.c
@@ -29,6 +29,7 @@
* until vfork returns. This can delay delivery of signals to the parent
* process, even delay or stop system suspend.
*/
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -39,9 +40,8 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/socket.h>
+#include <sys/ptrace.h>
#include "test.h"
-#include "config.h"
-#include "../../syscalls/ptrace/ptrace.h"
#define str_expand(s) str(s)
#define str(s) #s
diff --git a/testcases/kernel/syscalls/ptrace/ptrace.h b/testcases/kernel/syscalls/ptrace/ptrace.h
deleted file mode 100644
index 10178a283..000000000
--- a/testcases/kernel/syscalls/ptrace/ptrace.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * ptrace is a fickle beast and each arch sucks in a different way
- */
-
-#ifndef __LTP_PTRACE_H__
-#define __LTP_PTRACE_H__
-
-#ifdef HAVE_SYS_PTRACE_H
-# include <sys/ptrace.h>
-#endif
-#ifdef HAVE_SYS_REG_H
-# include <sys/reg.h>
-#endif
-#ifdef __ia64__ /* what a pos */
-# define ia64_fpreg FU_ia64_fpreg
-# define pt_all_user_regs FU_pt_all_user_regs
-#endif
-#ifdef HAVE_ASM_PTRACE_H
-# include <asm/ptrace.h>
-#endif
-#ifdef HAVE_LINUX_PTRACE_H
-# ifndef HAVE_STRUCT_PTRACE_PEEKSIGINFO_ARGS
-# include <linux/ptrace.h>
-# endif
-#endif
-#undef FU_ia64_fpreg
-#undef FU_pt_all_user_regs
-
-#define HAVE_STRUCT_PTRACE_REGS 1
-#if defined(HAVE_STRUCT_PT_REGS)
-typedef struct pt_regs ptrace_regs;
-#elif defined(HAVE_STRUCT_USER_REGS_STRUCT)
-typedef struct user_regs_struct ptrace_regs;
-#else
-#undef HAVE_STRUCT_PTRACE_REGS
-#endif
-
-#endif
diff --git a/testcases/kernel/syscalls/ptrace/ptrace01.c b/testcases/kernel/syscalls/ptrace/ptrace01.c
index 9071bbaba..53ddfb393 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace01.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace01.c
@@ -26,8 +26,7 @@
#include <errno.h>
#include <signal.h>
#include <sys/wait.h>
-#include <config.h>
-#include "ptrace.h"
+#include <sys/ptrace.h>
#include "tst_test.h"
static struct tcase {
diff --git a/testcases/kernel/syscalls/ptrace/ptrace02.c b/testcases/kernel/syscalls/ptrace/ptrace02.c
index e330f459e..a48ef58a5 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace02.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace02.c
@@ -11,9 +11,8 @@
#include <signal.h>
#include <sys/wait.h>
#include <pwd.h>
-#include <config.h>
#include <stdlib.h>
-#include "ptrace.h"
+#include <sys/ptrace.h>
#include "tst_test.h"
uid_t uid;
diff --git a/testcases/kernel/syscalls/ptrace/ptrace03.c b/testcases/kernel/syscalls/ptrace/ptrace03.c
index b2b3fb49d..42ac3e7cf 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace03.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace03.c
@@ -14,9 +14,8 @@
#include <signal.h>
#include <sys/wait.h>
#include <pwd.h>
-#include <config.h>
#include <stdlib.h>
-#include "ptrace.h"
+#include <sys/ptrace.h>
#include "tst_test.h"
static pid_t unused_pid;
diff --git a/testcases/kernel/syscalls/ptrace/ptrace04.c b/testcases/kernel/syscalls/ptrace/ptrace04.c
index 0b25e982b..8f1b5c6cc 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace04.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace04.c
@@ -13,9 +13,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-
-#include <config.h>
-#include "ptrace.h"
+#include <sys/ptrace.h>
#include "test.h"
#include "spawn_ptrace_child.h"
diff --git a/testcases/kernel/syscalls/ptrace/ptrace05.c b/testcases/kernel/syscalls/ptrace/ptrace05.c
index 54cfa4d7b..541018393 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace05.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace05.c
@@ -33,9 +33,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-
-#include <config.h>
-#include "ptrace.h"
+#include <sys/ptrace.h>
#include "test.h"
#include "lapi/signal.h"
diff --git a/testcases/kernel/syscalls/ptrace/ptrace06.c b/testcases/kernel/syscalls/ptrace/ptrace06.c
index c0cb3b9bd..a1db3bab8 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace06.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace06.c
@@ -16,13 +16,10 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-
-#include <config.h>
-#include "ptrace.h"
+#include <sys/ptrace.h>
#include "test.h"
#include "spawn_ptrace_child.h"
-#include "config.h"
/* this should be sizeof(struct user), but that info is only found
* in the kernel asm/user.h which is not exported to userspace.
diff --git a/testcases/kernel/syscalls/ptrace/ptrace07.c b/testcases/kernel/syscalls/ptrace/ptrace07.c
index 362cee543..a78243671 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace07.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace07.c
@@ -35,9 +35,8 @@
#include <stdlib.h>
#include <sys/uio.h>
#include <sys/wait.h>
+#include <sys/ptrace.h>
-#include "config.h"
-#include "ptrace.h"
#include "tst_safe_macros.h"
#include "lapi/cpuid.h"
diff --git a/testcases/kernel/syscalls/ptrace/ptrace11.c b/testcases/kernel/syscalls/ptrace/ptrace11.c
index c54441671..90154852f 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace11.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace11.c
@@ -16,9 +16,8 @@
#include <signal.h>
#include <sys/wait.h>
#include <pwd.h>
-#include <config.h>
#include <stdlib.h>
-#include "ptrace.h"
+#include <sys/ptrace.h>
#include "tst_test.h"
static void verify_ptrace(void)
diff --git a/testcases/kernel/syscalls/ptrace/simple_tracer.c b/testcases/kernel/syscalls/ptrace/simple_tracer.c
index ae1af7c2f..43026e317 100644
--- a/testcases/kernel/syscalls/ptrace/simple_tracer.c
+++ b/testcases/kernel/syscalls/ptrace/simple_tracer.c
@@ -17,7 +17,6 @@
#include <unistd.h>
#include <sys/ptrace.h>
#include <sys/syscall.h>
-#include "ptrace.h"
#include "test.h"
#include "spawn_ptrace_child.h"
--
2.42.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH 2/3] ptrace: Build ptrace06, enable in runtest/syscalls
2023-11-28 9:15 [LTP] [PATCH 0/3] ptrace: Remove old autotools checks Petr Vorel
2023-11-28 9:15 ` [LTP] [PATCH 1/3] " Petr Vorel
@ 2023-11-28 9:15 ` Petr Vorel
2023-11-28 9:15 ` [LTP] [RFC PATCH 3/3] ptrace: Remove simple_tracer.c Petr Vorel
2023-11-28 10:20 ` [LTP] [PATCH 0/3] ptrace: Remove old autotools checks Cyril Hrubis
3 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2023-11-28 9:15 UTC (permalink / raw)
To: ltp; +Cc: Richard Palethorpe
It was disabled in 91d5f18a5 due failures in RHEL 4 (kernel 2.6.9).
Although test is still in legacy API, it runs well, it should have been
enabled long time ago.
Test was also commented out in runtest/syscalls, enable it again.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
runtest/syscalls | 5 ++---
testcases/kernel/syscalls/ptrace/.gitignore | 1 +
testcases/kernel/syscalls/ptrace/Makefile | 6 ++----
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/runtest/syscalls b/runtest/syscalls
index b7ceb25d3..06db4604e 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -1,4 +1,4 @@
-#DESCRIPTION:Kernel system calls
+ based Kernel)#DESCRIPTION:Kernel system calls
abort01 abort01
accept01 accept01
@@ -1076,8 +1076,7 @@ ptrace02 ptrace02
ptrace03 ptrace03
ptrace04 ptrace04
ptrace05 ptrace05
-# Broken test; See: testcases/kernel/syscalls/ptrace/Makefile for more details.
-#ptrace06 ptrace06
+ptrace06 ptrace06
ptrace07 ptrace07
ptrace08 ptrace08
ptrace09 ptrace09
diff --git a/testcases/kernel/syscalls/ptrace/.gitignore b/testcases/kernel/syscalls/ptrace/.gitignore
index 01cbc6072..1ee6117e9 100644
--- a/testcases/kernel/syscalls/ptrace/.gitignore
+++ b/testcases/kernel/syscalls/ptrace/.gitignore
@@ -3,6 +3,7 @@
/ptrace03
/ptrace04
/ptrace05
+/ptrace06
/ptrace07
/ptrace08
/ptrace09
diff --git a/testcases/kernel/syscalls/ptrace/Makefile b/testcases/kernel/syscalls/ptrace/Makefile
index 9ee7b8374..b410a54be 100644
--- a/testcases/kernel/syscalls/ptrace/Makefile
+++ b/testcases/kernel/syscalls/ptrace/Makefile
@@ -1,13 +1,11 @@
# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) Linux Test Project, 2002-2023
# Copyright (c) International Business Machines Corp., 2001
top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-# - ptrace06 is a broken test ; it hangs the target consistently, chewing up
-# CPU. See: `Issue 3 - ptrace06 hung for 7 hours' --
-# http://sourceforge.net/mailarchive/forum.php?thread_name=364299f40910062300s65c43c93w9cccdfe8835c2334%40mail.gmail.com&forum_name=ltp-list
# - simple_tracer is a utility that Mike Frysinger added that shouldn't be
# compiled by default:
#
@@ -29,6 +27,6 @@ include $(top_srcdir)/include/mk/testcases.mk
# make: *** [testcases-all] Error 2
#
-FILTER_OUT_MAKE_TARGETS := ptrace06 simple_tracer
+FILTER_OUT_MAKE_TARGETS := simple_tracer
include $(top_srcdir)/include/mk/generic_leaf_target.mk
--
2.42.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [RFC PATCH 3/3] ptrace: Remove simple_tracer.c
2023-11-28 9:15 [LTP] [PATCH 0/3] ptrace: Remove old autotools checks Petr Vorel
2023-11-28 9:15 ` [LTP] [PATCH 1/3] " Petr Vorel
2023-11-28 9:15 ` [LTP] [PATCH 2/3] ptrace: Build ptrace06, enable in runtest/syscalls Petr Vorel
@ 2023-11-28 9:15 ` Petr Vorel
2023-11-28 10:20 ` [LTP] [PATCH 0/3] ptrace: Remove old autotools checks Cyril Hrubis
3 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2023-11-28 9:15 UTC (permalink / raw)
To: ltp; +Cc: Richard Palethorpe
Legacy test from 2009, which does not even compile.
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,
do you see any value in this test? Should it be rewritten? Or could it
be deleted and the goal of the test filled into issue so that we don't
forget on it? (IMHO test would need to be written from scratch).
Kind regards,
Petr
testcases/kernel/syscalls/ptrace/Makefile | 23 ---
.../syscalls/ptrace/make_syscall_list.sh | 7 -
.../kernel/syscalls/ptrace/simple_tracer.c | 143 ------------------
testcases/kernel/syscalls/ptrace/syscalls.h | 17 ---
4 files changed, 190 deletions(-)
delete mode 100755 testcases/kernel/syscalls/ptrace/make_syscall_list.sh
delete mode 100644 testcases/kernel/syscalls/ptrace/simple_tracer.c
delete mode 100644 testcases/kernel/syscalls/ptrace/syscalls.h
diff --git a/testcases/kernel/syscalls/ptrace/Makefile b/testcases/kernel/syscalls/ptrace/Makefile
index b410a54be..d7eca6837 100644
--- a/testcases/kernel/syscalls/ptrace/Makefile
+++ b/testcases/kernel/syscalls/ptrace/Makefile
@@ -6,27 +6,4 @@ top_srcdir ?= ../../../..
include $(top_srcdir)/include/mk/testcases.mk
-# - simple_tracer is a utility that Mike Frysinger added that shouldn't be
-# compiled by default:
-#
-# gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall
-# -I//scratch/ltp-install6/include -I../../../../include
-# -L//scratch/ltp-install6/lib simple_tracer.c -laio -lltp -o
-# simple_tracer
-# In file included from simple_tracer.c:25:
-# syscalls.h:6:23: error: _syscalls.h: No such file or directory
-# make[4]: *** [simple_tracer] Error 1
-# make[4]: Leaving directory
-# `/scratch/ltp-dev2/ltp/testcases/kernel/syscalls/ptrace'
-# make[3]: *** [all] Error 2
-# make[3]: Leaving directory `/scratch/ltp-dev2/ltp/testcases/kernel/syscalls'
-# make[2]: *** [all] Error 2
-# make[2]: Leaving directory `/scratch/ltp-dev2/ltp/testcases/kernel'
-# make[1]: *** [all] Error 2
-# make[1]: Leaving directory `/scratch/ltp-dev2/ltp/testcases'
-# make: *** [testcases-all] Error 2
-#
-
-FILTER_OUT_MAKE_TARGETS := simple_tracer
-
include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/kernel/syscalls/ptrace/make_syscall_list.sh b/testcases/kernel/syscalls/ptrace/make_syscall_list.sh
deleted file mode 100755
index e5d6d2765..000000000
--- a/testcases/kernel/syscalls/ptrace/make_syscall_list.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-set -- $( \
- printf '#include <sys/syscall.h>' | \
- ${CC:-gcc} -E -dD - | \
- awk '$2 ~ /^SYS_/ { sub(/SYS_/,"",$2); print $2; }'
-)
-printf 'P(%s)\n' "$@"
diff --git a/testcases/kernel/syscalls/ptrace/simple_tracer.c b/testcases/kernel/syscalls/ptrace/simple_tracer.c
deleted file mode 100644
index 43026e317..000000000
--- a/testcases/kernel/syscalls/ptrace/simple_tracer.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * simple example ptrace() code to help build basis for other tests
- *
- * Copyright (c) 2009 Analog Devices Inc.
- *
- * Licensed under the GPL-2 or later
- */
-
-#define _GNU_SOURCE
-
-#include <config.h>
-
-#include <errno.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/ptrace.h>
-#include <sys/syscall.h>
-
-#include "test.h"
-#include "spawn_ptrace_child.h"
-
-#include "syscalls.h"
-
-char *TCID = "simple_tracer";
-int TST_TOTAL = 0;
-
-#define _decode(name, val) \
-({ \
- if (sizeof(long) == 4) \
- printf(name ":%08lx ", val); \
- else if (sizeof(long) == 8) \
- printf(name ":%016lx ", val); \
- else \
- printf(name ":%lx ", val); \
- val; \
-})
-#define decode(reg) _decode(#reg, pt->reg)
-#define decode_user(name, offset) \
- _decode(name, vptrace(PTRACE_PEEKUSER, pid, offset, NULL));
-#define decode_sysnum(nr) printf("%s ", get_sysnum(nr))
-static void decode_regs(struct pt_regs *pt)
-{
-#if defined(__bfin__)
- long nr = decode_user("orig_p0", PT_ORIG_P0);
- decode(p0);
- decode(r0);
- decode(r1);
- decode(r2);
- decode(r3);
- decode(r4);
- decode(r5);
- decode_sysnum(nr);
- puts("");
-#elif defined(__i386__)
- long nr = decode_user("orig_eax", 4 * ORIG_EAX);
- decode(eax);
- decode(ebx);
- decode(ecx);
- decode(edx);
- decode(esi);
- decode(edi);
- decode(ebp);
- decode_sysnum(nr);
- puts("");
-#elif defined(__x86_64__)
- long nr = decode_user("orig_rax", 8 * ORIG_RAX);
- decode(rax);
- decode(rbx);
- decode(rcx);
- decode(rdx);
- decode(rsi);
- decode(rdi);
- decode(rbp);
- decode_sysnum(nr);
- puts("");
-#elif defined(__sparc__)
-#define G1 u_regs[0]
-#define G2 u_regs[1]
-#define G3 u_regs[2]
-#define G4 u_regs[3]
-#define G5 u_regs[4]
-#define G6 u_regs[5]
-#define G7 u_regs[6]
-#define O0 u_regs[7]
-#define O1 u_regs[8]
-#define O2 u_regs[9]
-#define O3 u_regs[10]
-#define O4 u_regs[11]
-#define O5 u_regs[12]
-#define O6 u_regs[13]
-#define O7 u_regs[14]
- decode(G1);
- decode(G2);
- decode(G3);
- decode(G4);
- decode(G5);
- decode(G6);
- decode(G7);
- decode(O0);
- decode(O1);
- decode(O2);
- decode(O3);
- decode(O4);
- decode(O5);
- decode(O6);
- decode(O7);
- decode_sysnum(pt->G1);
- puts("");
-#else
-#warning "no idea how to decode your arch"
- puts("no idea how to decode your arch");
-#endif
-}
-
-int main(int argc, char *argv[])
-{
- struct pt_regs pt_regs;
- long ret;
- int status;
-
- make_a_baby(argc, argv);
-
- while (1) {
- ret = vptrace(PTRACE_GETREGS, pid, NULL, &pt_regs);
- if (ret)
- break;
- decode_regs(&pt_regs);
-
- ret = vptrace(PTRACE_SYSCALL, pid, NULL, NULL);
- if (ret)
- break;
-
- if (waitpid(pid, &status, 0) == -1)
- break;
- }
-
- /* hopefully this worked */
- vptrace(PTRACE_KILL, pid, NULL, NULL);
-
- tst_exit();
-}
diff --git a/testcases/kernel/syscalls/ptrace/syscalls.h b/testcases/kernel/syscalls/ptrace/syscalls.h
deleted file mode 100644
index 2d9c5ceb6..000000000
--- a/testcases/kernel/syscalls/ptrace/syscalls.h
+++ /dev/null
@@ -1,17 +0,0 @@
-const struct sysnums {
- long nr;
- const char *snr;
-} sysnums[] = {
-#define P(NR) { .nr = SYS_##NR, .snr = #NR, },
-#include "_syscalls.h"
-#undef P
-};
-
-const char *get_sysnum(long nr)
-{
- int i;
- for (i = 0; i < ARRAY_SIZE(sysnums); ++i)
- if (sysnums[i].nr == nr)
- break;
- return i == ARRAY_SIZE(sysnums) ? "???" : sysnums[i].snr;
-}
--
2.42.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 0/3] ptrace: Remove old autotools checks
2023-11-28 9:15 [LTP] [PATCH 0/3] ptrace: Remove old autotools checks Petr Vorel
` (2 preceding siblings ...)
2023-11-28 9:15 ` [LTP] [RFC PATCH 3/3] ptrace: Remove simple_tracer.c Petr Vorel
@ 2023-11-28 10:20 ` Cyril Hrubis
2023-11-30 11:07 ` Petr Vorel
3 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2023-11-28 10:20 UTC (permalink / raw)
To: Petr Vorel; +Cc: Richard Palethorpe, ltp
Hi!
Looks good, feel free to push as long as this builds cleanly on CI.
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [LTP] [PATCH 0/3] ptrace: Remove old autotools checks
2023-11-28 10:20 ` [LTP] [PATCH 0/3] ptrace: Remove old autotools checks Cyril Hrubis
@ 2023-11-30 11:07 ` Petr Vorel
0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2023-11-30 11:07 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: Richard Palethorpe, ltp
Hi Cyril,
> Hi!
> Looks good, feel free to push as long as this builds cleanly on CI.
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Thanks!
BTW I added in the second patch copy paste error, thus fixed before merge
(reverted this unwanted change).
Kind regards,
Petr
+++ runtest/syscalls
@@ -1,4 +1,4 @@
- based Kernel)#DESCRIPTION:Kernel system calls
+#DESCRIPTION:Kernel system calls
abort01 abort01
accept01 accept01
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-11-30 11:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-28 9:15 [LTP] [PATCH 0/3] ptrace: Remove old autotools checks Petr Vorel
2023-11-28 9:15 ` [LTP] [PATCH 1/3] " Petr Vorel
2023-11-28 9:15 ` [LTP] [PATCH 2/3] ptrace: Build ptrace06, enable in runtest/syscalls Petr Vorel
2023-11-28 9:15 ` [LTP] [RFC PATCH 3/3] ptrace: Remove simple_tracer.c Petr Vorel
2023-11-28 10:20 ` [LTP] [PATCH 0/3] ptrace: Remove old autotools checks Cyril Hrubis
2023-11-30 11:07 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox