Accepting request 292570 from home:Andreas_Schwab:Factory

- 0001-aarch64-fix-rt_sigreturn-decoding.patch,
  0002-m68k-define-HAVE_SA_RESTORER.patch,
  0003-Fix-decoding-of-mmap2-for-arm.patch,
  0005-tests-select.test-handle-architectures-using-pselect.patch,
  0006-aarch64-fix-ioctl-decoding.patch,
  0007-m68k-fix-sigreturn-decoding.patch,
  0008-Fix-crash-in-ipc_sem-test.patch,
  0009-tests-ipc_-match-IPC_64-flag.patch,
  0010-semctl-fix-indirect-syscall-decoding.patch,
  0011-Fix-stat64-st_-acm-time-decoding-for-personalities-w.patch,
  0012-tests-verify-that-all-patterns-match.patch,
  0013-aarch64-properly-decode-generic-syscalls.patch,
  0014-stat64-v.test-add-newfstatat-syscall-support.patch,
  0015-tests-uid-use-fchown-instead-of-chown.patch: Patches from upstream
  to fix testsuite failure.
- Enable libunwind support (strace -k).

OBS-URL: https://build.opensuse.org/request/show/292570
OBS-URL: https://build.opensuse.org/package/show/devel:tools/strace?expand=0&rev=44
This commit is contained in:
Martin Pluskal 2015-03-24 18:25:03 +00:00 committed by Git OBS Bridge
parent 8d6c78d101
commit 0b44e76647
16 changed files with 1037 additions and 2 deletions

View File

@ -0,0 +1,26 @@
From d76d3069526c348e6fe5d40bbbceb2ae4a928d16 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Wed, 11 Mar 2015 14:32:25 +0000
Subject: [PATCH 01/15] aarch64: fix rt_sigreturn decoding
* sigreturn.c (sys_sigreturn) [AARCH64]: Fix personality check.
---
sigreturn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sigreturn.c b/sigreturn.c
index 648bd0a..c253a0c 100644
--- a/sigreturn.c
+++ b/sigreturn.c
@@ -23,7 +23,7 @@ sys_sigreturn(struct tcb *tcp)
# define OFFSETOF_STRUCT_UCONTEXT_UC_SIGMASK (5 * 4 + SIZEOF_STRUCT_SIGCONTEXT)
const long addr =
# ifdef AARCH64
- current_personality == 0 ?
+ current_personality == 1 ?
(*aarch64_sp_ptr + SIZEOF_STRUCT_SIGINFO +
offsetof(struct ucontext, uc_sigmask)) :
# endif
--
2.3.3

View File

@ -0,0 +1,29 @@
From a897136801816a3b68e640b2db35e3ec65cbec31 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Wed, 11 Mar 2015 14:15:34 +0100
Subject: [PATCH 02/15] m68k: define HAVE_SA_RESTORER
On m68k the kernel sigaction structure has the sa_restorer member for
historical reasons.
* signal.c (HAVE_SA_RESTORER): Define for M68K.
---
signal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/signal.c b/signal.c
index 710fb19..867e156 100644
--- a/signal.c
+++ b/signal.c
@@ -62,7 +62,7 @@
# define HAVE_SA_RESTORER 1
# endif
#else /* !SA_RESTORER */
-# if defined SPARC || defined SPARC64
+# if defined SPARC || defined SPARC64 || defined M68K
# define HAVE_SA_RESTORER 1
# else
# define HAVE_SA_RESTORER 0
--
2.3.3

View File

@ -0,0 +1,27 @@
From dbadf7bcc8995612d5ef737047b909e868387e37 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Mon, 9 Mar 2015 16:55:06 +0100
Subject: [PATCH 03/15] Fix decoding of mmap2 for arm
* syscallent.h (mmap2): Decode with sys_mmap_4koff, not
sys_mmap_pgoff.
---
linux/arm/syscallent.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linux/arm/syscallent.h b/linux/arm/syscallent.h
index 52aed9e..b66a5a2 100644
--- a/linux/arm/syscallent.h
+++ b/linux/arm/syscallent.h
@@ -218,7 +218,7 @@
[189] = { 5, 0, sys_putpmsg, "putpmsg" },
[190] = { 0, TP, sys_vfork, "vfork" },
[191] = { 2, 0, sys_getrlimit, "ugetrlimit" },
-[192] = { 6, TD|TM|SI, sys_mmap_pgoff, "mmap2" },
+[192] = { 6, TD|TM|SI, sys_mmap_4koff, "mmap2" },
[193] = { 4, TF, sys_truncate64, "truncate64" },
[194] = { 4, TD, sys_ftruncate64, "ftruncate64" },
[195] = { 2, TF, sys_stat64, "stat64" },
--
2.3.3

View File

@ -0,0 +1,55 @@
From 95336102eb836ba69a2b51a3bbe733abd63bbe77 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Thu, 12 Mar 2015 16:47:38 +0100
Subject: [PATCH 05/15] tests/select.test: handle architectures using pselect6
syscall
* tests/select.awk (BEGIN): Update regexps to match both select
and pselect6 syscalls.
* tests/select.test: Probe for both select and pselect6 syscall.
---
tests/select.awk | 6 +++---
tests/select.test | 7 +++++--
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/tests/select.awk b/tests/select.awk
index 142504a..688cefe 100644
--- a/tests/select.awk
+++ b/tests/select.awk
@@ -1,7 +1,7 @@
BEGIN {
- r[1] = "^select\\(2, \\[0 1\\], \\[0 1\\], \\[0 1\\], NULL\\) += 1 \\(\\)$"
- r[2] = "^select\\(-1, NULL, 0x[0-9a-f]+, NULL, NULL\\) += -1 "
- r[3] = "^select\\(1025, \\[0\\], \\[\\], NULL, \\{0, 100\\}\\) += 0 \\(Timeout\\)$"
+ r[1] = "^p?select6?\\(2, \\[0 1\\], \\[0 1\\], \\[0 1\\], NULL(, 0)?\\) += 1 \\(\\)$"
+ r[2] = "^p?select6?\\(-1, NULL, 0x[0-9a-f]+, NULL, NULL(, 0)?\\) += -1 "
+ r[3] = "^p?select6?\\(1025, \\[0\\], \\[\\], NULL, \\{0, 100(000)?\\}(, 0)?\\) += 0 \\(Timeout\\)$"
r[4] = "^\\+\\+\\+ exited with 0 \\+\\+\\+$"
lines = 4
fail = 0
diff --git a/tests/select.test b/tests/select.test
index bd3066b..5d5fe54 100755
--- a/tests/select.test
+++ b/tests/select.test
@@ -6,13 +6,16 @@
check_prog awk
-$STRACE -eselect -h > /dev/null ||
+syscall=
+$STRACE -epselect6 -h > /dev/null && syscall=$syscall,pselect6
+$STRACE -eselect -h > /dev/null && syscall=$syscall,select
+test -n "$syscall" ||
skip_ 'select syscall is not supported on this architecture'
./select ||
framework_skip_ 'select syscall does not behave as expected'
-args='-eselect ./select'
+args="-e$syscall ./select"
$STRACE -o "$LOG" $args || {
cat "$LOG"
fail_ "$STRACE $args failed"
--
2.3.3

View File

@ -0,0 +1,47 @@
From 0e3811d7914f209858cf4e445221fd65644cc94b Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Thu, 12 Mar 2015 18:07:00 +0100
Subject: [PATCH 06/15] aarch64: fix ioctl decoding
* linux/aarch64/ioctls_inc0.h: Rename from ioctls_inc1.h.
* linux/aarch64/ioctls_inc1.h: Rename from ioctls_inc0.h.
* linux/aarch64/ioctls_arch0.h: Rename from ioctls_arch1.h.
* linux/aarch64/ioctls_arch1.h: Rename from ioctls_arch0.h.
---
linux/aarch64/ioctls_arch0.h | 2 +-
linux/aarch64/ioctls_arch1.h | 2 +-
linux/aarch64/ioctls_inc0.h | 2 +-
linux/aarch64/ioctls_inc1.h | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/linux/aarch64/ioctls_arch0.h b/linux/aarch64/ioctls_arch0.h
index 6a674cc..b722d22 100644
--- a/linux/aarch64/ioctls_arch0.h
+++ b/linux/aarch64/ioctls_arch0.h
@@ -1 +1 @@
-/* Generated by ioctls_gen.sh from definitions found in $linux/arch/arm64/include/ tree. */
+#include "arm/ioctls_arch0.h"
diff --git a/linux/aarch64/ioctls_arch1.h b/linux/aarch64/ioctls_arch1.h
index b722d22..6a674cc 100644
--- a/linux/aarch64/ioctls_arch1.h
+++ b/linux/aarch64/ioctls_arch1.h
@@ -1 +1 @@
-#include "arm/ioctls_arch0.h"
+/* Generated by ioctls_gen.sh from definitions found in $linux/arch/arm64/include/ tree. */
diff --git a/linux/aarch64/ioctls_inc0.h b/linux/aarch64/ioctls_inc0.h
index f9939fa..46c11b1 100644
--- a/linux/aarch64/ioctls_inc0.h
+++ b/linux/aarch64/ioctls_inc0.h
@@ -1 +1 @@
-#include "64/ioctls_inc.h"
+#include "arm/ioctls_inc0.h"
diff --git a/linux/aarch64/ioctls_inc1.h b/linux/aarch64/ioctls_inc1.h
index 46c11b1..f9939fa 100644
--- a/linux/aarch64/ioctls_inc1.h
+++ b/linux/aarch64/ioctls_inc1.h
@@ -1 +1 @@
-#include "arm/ioctls_inc0.h"
+#include "64/ioctls_inc.h"
--
2.3.3

View File

@ -0,0 +1,40 @@
From 712f0e12bd3cc2059229cbe301192768ab7fea07 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Wed, 11 Mar 2015 15:08:42 +0100
Subject: [PATCH 07/15] m68k: fix sigreturn decoding
* sigreturn.c (sys_sigreturn) [M68K]: Fetch the words of the
signal mask from the proper place.
---
sigreturn.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/sigreturn.c b/sigreturn.c
index c253a0c..365ef1a 100644
--- a/sigreturn.c
+++ b/sigreturn.c
@@ -128,8 +128,20 @@ sys_sigreturn(struct tcb *tcp)
long addr;
if (upeek(tcp->pid, 4*PT_USP, &addr) < 0)
return 0;
+ /* Fetch pointer to struct sigcontext. */
+ if (umove(tcp, addr + 2 * sizeof(int), &addr) < 0)
+ return 0;
+ unsigned long mask[NSIG / 8 / sizeof(long)];
+ /* Fetch first word of signal mask. */
+ if (umove(tcp, addr, &mask[0]) < 0)
+ return 0;
+ /* Fetch remaining words of signal mask, located
+ immediately before. */
+ addr -= sizeof(mask) - sizeof(long);
+ if (umoven(tcp, addr, sizeof(mask) - sizeof(long), (char *) &mask[1]) < 0)
+ return 0;
tprints("{mask=");
- print_sigset_addr_len(tcp, addr, NSIG / 8);
+ tprintsigmask_addr("", mask);
tprints("}");
}
#elif defined(ALPHA)
--
2.3.3

View File

@ -0,0 +1,109 @@
From fa5ce3724646faf3d1a1f379e4046e307df92952 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Wed, 11 Mar 2015 12:33:30 +0100
Subject: [PATCH 08/15] Fix crash in ipc_sem test
Properly use union semun as argument of semctl.
* tests/ipc_sem.c (main): Properly use union semun as argument of
semctl. Don't handle EFAULT specially.
* tests/ipc_sem.test: Revert last change.
---
tests/ipc_sem.c | 24 ++++++++++++++++--------
tests/ipc_sem.test | 19 ++++---------------
2 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c
index eddddd4..9373482 100644
--- a/tests/ipc_sem.c
+++ b/tests/ipc_sem.c
@@ -2,10 +2,19 @@
#include <errno.h>
#include <sys/sem.h>
+union semun {
+ int val; /* Value for SETVAL */
+ struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
+ unsigned short *array; /* Array for GETALL, SETALL */
+ struct seminfo *__buf; /* Buffer for IPC_INFO
+ (Linux-specific) */
+};
+
int
main(void)
{
int rc, id;
+ union semun un;
struct semid_ds ds;
struct seminfo info;
@@ -14,16 +23,19 @@ main(void)
return 77;
printf("semget\\(IPC_PRIVATE, 1, 0600\\) += %d\n", id);
- if (semctl(id, 0, IPC_STAT, &ds))
+ un.buf = &ds;
+ if (semctl(id, 0, IPC_STAT, un))
goto fail;
printf("semctl\\(%d, 0, IPC_STAT, %p\\) += 0\n", id, &ds);
- int max = semctl(0, 0, SEM_INFO, &info);
+ un.__buf = &info;
+ int max = semctl(0, 0, SEM_INFO, un);
if (max < 0)
goto fail;
printf("semctl\\(0, 0, SEM_INFO, %p\\) += %d\n", &info, max);
- rc = semctl(id, 0, SEM_STAT, &ds);
+ un.buf = &ds;
+ rc = semctl(id, 0, SEM_STAT, un);
if (rc != id) {
/*
* In linux < v2.6.24-rc1 the first argument must be
@@ -44,10 +56,6 @@ done:
return rc;
fail:
- /*
- * If the kernel failed, SKIP the test. We want to ignore
- * such failures as they're out of scope for this project.
- */
- rc = errno == EFAULT ? 77 : 1;
+ rc = 1;
goto done;
}
diff --git a/tests/ipc_sem.test b/tests/ipc_sem.test
index f448b66..b8fa545 100755
--- a/tests/ipc_sem.test
+++ b/tests/ipc_sem.test
@@ -8,23 +8,12 @@ check_prog grep
OUT="$LOG.out"
-./ipc_sem > "$OUT" || {
- case $? in
- 77)
- rm -f "$OUT"
+./ipc_sem > /dev/null || {
+ if [ $? -eq 77 ]; then
framework_skip_ 'ipc semget/semctl syscalls do not behave as expected'
- ;;
- 99)
- cat "$OUT"
- rm -f "$OUT"
- framework_failure_ 'broken kernel detected'
- ;;
- *)
- cat "$OUT"
- rm -f "$OUT"
+ else
fail_ 'ipc_sem failed'
- ;;
- esac
+ fi
}
args='-eipc ./ipc_sem'
--
2.3.3

View File

@ -0,0 +1,136 @@
From 3aa45f3cc2103c7bf80c45452c29e7b7e7dda089 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Wed, 11 Mar 2015 17:47:56 +0100
Subject: [PATCH 09/15] tests/ipc_*: match IPC_64 flag
* tests/ipc_msg.c (main): Optionally match "IPC_64|" in the third
argument of the ipc call.
* tests/ipc_sem.c (main): Likewise.
* tests/ipc_shm.c (main): Likewise.
---
tests/ipc_msg.c | 10 +++++-----
tests/ipc_sem.c | 10 +++++-----
tests/ipc_shm.c | 10 +++++-----
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/tests/ipc_msg.c b/tests/ipc_msg.c
index 1917086..ed2bfd6 100644
--- a/tests/ipc_msg.c
+++ b/tests/ipc_msg.c
@@ -15,12 +15,12 @@ main(void)
if (msgctl(id, IPC_STAT, &ds))
goto fail;
- printf("msgctl\\(%d, IPC_STAT, %p\\) += 0\n", id, &ds);
+ printf("msgctl\\(%d, (IPC_64\\|)?IPC_STAT, %p\\) += 0\n", id, &ds);
int max = msgctl(0, MSG_INFO, &ds);
if (max < 0)
goto fail;
- printf("msgctl\\(0, MSG_INFO, %p\\) += %d\n", &ds, max);
+ printf("msgctl\\(0, (IPC_64\\|)?MSG_INFO, %p\\) += %d\n", &ds, max);
rc = msgctl(id, MSG_STAT, &ds);
if (rc != id) {
@@ -30,16 +30,16 @@ main(void)
*/
if (-1 != rc || EINVAL != errno)
goto fail;
- printf("msgctl\\(%d, MSG_STAT, %p\\) += -1 EINVAL \\(Invalid argument\\)\n", id, &ds);
+ printf("msgctl\\(%d, (IPC_64\\|)?MSG_STAT, %p\\) += -1 EINVAL \\(Invalid argument\\)\n", id, &ds);
} else {
- printf("msgctl\\(%d, MSG_STAT, %p\\) += %d\n", id, &ds, id);
+ printf("msgctl\\(%d, (IPC_64\\|)?MSG_STAT, %p\\) += %d\n", id, &ds, id);
}
rc = 0;
done:
if (msgctl(id, IPC_RMID, 0) < 0)
return 1;
- printf("msgctl\\(%d, IPC_RMID, 0\\) += 0\n", id);
+ printf("msgctl\\(%d, (IPC_64\\|)?IPC_RMID, 0\\) += 0\n", id);
return rc;
fail:
diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c
index 9373482..d92ec60 100644
--- a/tests/ipc_sem.c
+++ b/tests/ipc_sem.c
@@ -26,13 +26,13 @@ main(void)
un.buf = &ds;
if (semctl(id, 0, IPC_STAT, un))
goto fail;
- printf("semctl\\(%d, 0, IPC_STAT, %p\\) += 0\n", id, &ds);
+ printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_STAT, %p\\) += 0\n", id, &ds);
un.__buf = &info;
int max = semctl(0, 0, SEM_INFO, un);
if (max < 0)
goto fail;
- printf("semctl\\(0, 0, SEM_INFO, %p\\) += %d\n", &info, max);
+ printf("semctl\\(0, 0, (IPC_64\\|)?SEM_INFO, %p\\) += %d\n", &info, max);
un.buf = &ds;
rc = semctl(id, 0, SEM_STAT, un);
@@ -43,16 +43,16 @@ main(void)
*/
if (-1 != rc || EINVAL != errno)
goto fail;
- printf("semctl\\(%d, 0, SEM_STAT, %p\\) += -1 EINVAL \\(Invalid argument\\)\n", id, &ds);
+ printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, %p\\) += -1 EINVAL \\(Invalid argument\\)\n", id, &ds);
} else {
- printf("semctl\\(%d, 0, SEM_STAT, %p\\) += %d\n", id, &ds, id);
+ printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, %p\\) += %d\n", id, &ds, id);
}
rc = 0;
done:
if (semctl(id, 0, IPC_RMID, 0) < 0)
return 1;
- printf("semctl\\(%d, 0, IPC_RMID, 0\\) += 0\n", id);
+ printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_RMID, 0\\) += 0\n", id);
return rc;
fail:
diff --git a/tests/ipc_shm.c b/tests/ipc_shm.c
index f1995d3..5888dc6 100644
--- a/tests/ipc_shm.c
+++ b/tests/ipc_shm.c
@@ -15,12 +15,12 @@ main(void)
if (shmctl(id, IPC_STAT, &ds))
goto fail;
- printf("shmctl\\(%d, IPC_STAT, %p\\) += 0\n", id, &ds);
+ printf("shmctl\\(%d, (IPC_64\\|)?IPC_STAT, %p\\) += 0\n", id, &ds);
int max = shmctl(0, SHM_INFO, &ds);
if (max < 0)
goto fail;
- printf("shmctl\\(0, SHM_INFO, %p\\) += %d\n", &ds, max);
+ printf("shmctl\\(0, (IPC_64\\|)?SHM_INFO, %p\\) += %d\n", &ds, max);
rc = shmctl(id, SHM_STAT, &ds);
if (rc != id) {
@@ -30,16 +30,16 @@ main(void)
*/
if (-1 != rc || EINVAL != errno)
goto fail;
- printf("shmctl\\(%d, SHM_STAT, %p\\) += -1 EINVAL \\(Invalid argument\\)\n", id, &ds);
+ printf("shmctl\\(%d, (IPC_64\\|)?SHM_STAT, %p\\) += -1 EINVAL \\(Invalid argument\\)\n", id, &ds);
} else {
- printf("shmctl\\(%d, SHM_STAT, %p\\) += %d\n", id, &ds, id);
+ printf("shmctl\\(%d, (IPC_64\\|)?SHM_STAT, %p\\) += %d\n", id, &ds, id);
}
rc = 0;
done:
if (shmctl(id, IPC_RMID, 0) < 0)
return 1;
- printf("shmctl\\(%d, IPC_RMID, 0\\) += 0\n", id);
+ printf("shmctl\\(%d, (IPC_64\\|)?IPC_RMID, 0\\) += 0\n", id);
return rc;
fail:
--
2.3.3

View File

@ -0,0 +1,87 @@
From 499c5aad0c2a4204ce28bd7761cabe9ceba57bec Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Wed, 11 Mar 2015 14:57:57 +0000
Subject: [PATCH 10/15] semctl: fix indirect syscall decoding
On architectures where the semctl call is implemented by the ipc syscall
the 4th argument is passed by reference.
* ipc.c (sys_semctl): Handle the indirect ipc subcall case.
* tests/ipc_sem.c (main): Optionally match indirection
in the 4th argument of semctl calls.
Reported-by: Andreas Schwab <schwab@suse.de>
---
ipc.c | 11 ++++++++++-
tests/ipc_sem.c | 14 +++++++++-----
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/ipc.c b/ipc.c
index 4387772..a94f572 100644
--- a/ipc.c
+++ b/ipc.c
@@ -281,7 +281,16 @@ int sys_semctl(struct tcb *tcp)
if (entering(tcp)) {
tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
- tprintf(", %#lx", tcp->u_arg[3]);
+ tprints(", ");
+ if (indirect_ipccall(tcp)) {
+ if (current_wordsize == sizeof(int)) {
+ printnum_int(tcp, tcp->u_arg[3], "%#x");
+ } else {
+ printnum_long(tcp, tcp->u_arg[3], "%#lx");
+ }
+ } else {
+ tprintf("%#lx", tcp->u_arg[3]);
+ }
}
return 0;
}
diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c
index d92ec60..64450b8 100644
--- a/tests/ipc_sem.c
+++ b/tests/ipc_sem.c
@@ -26,13 +26,15 @@ main(void)
un.buf = &ds;
if (semctl(id, 0, IPC_STAT, un))
goto fail;
- printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_STAT, %p\\) += 0\n", id, &ds);
+ printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_STAT, \\[?%p\\]?\\) += 0\n",
+ id, &ds);
un.__buf = &info;
int max = semctl(0, 0, SEM_INFO, un);
if (max < 0)
goto fail;
- printf("semctl\\(0, 0, (IPC_64\\|)?SEM_INFO, %p\\) += %d\n", &info, max);
+ printf("semctl\\(0, 0, (IPC_64\\|)?SEM_INFO, \\[?%p\\]?\\) += %d\n",
+ &info, max);
un.buf = &ds;
rc = semctl(id, 0, SEM_STAT, un);
@@ -43,16 +45,18 @@ main(void)
*/
if (-1 != rc || EINVAL != errno)
goto fail;
- printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, %p\\) += -1 EINVAL \\(Invalid argument\\)\n", id, &ds);
+ printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, \\[?%p\\]?\\)"
+ " += -1 EINVAL \\(Invalid argument\\)\n", id, &ds);
} else {
- printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, %p\\) += %d\n", id, &ds, id);
+ printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, \\[?%p\\]?\\)"
+ " += %d\n", id, &ds, id);
}
rc = 0;
done:
if (semctl(id, 0, IPC_RMID, 0) < 0)
return 1;
- printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_RMID, 0\\) += 0\n", id);
+ printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_RMID, \\[?0\\]?\\) += 0\n", id);
return rc;
fail:
--
2.3.3

View File

@ -0,0 +1,61 @@
From bce1ff5f881c3fe7b921637af2ee06dd0cdceef4 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Thu, 12 Mar 2015 16:59:01 +0000
Subject: [PATCH 11/15] Fix stat64 st_[acm]time decoding for personalities with
32-bit time_t
STRUCT_STAT.st_[acm]time are declared as unsigned int for some
personalities, while time_t is signed.
* printstat.h (DO_PRINTSTAT): If st_[acm]time have the same size as int,
explicitly cast them to int.
* tests/stat64-v.test: Test that negative time_t is decoded properly.
Reported-by: Andreas Schwab <schwab@suse.de>
---
printstat.h | 14 +++++++++++---
tests/stat64-v.test | 3 +--
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/printstat.h b/printstat.h
index dd0b02e..53112fe 100644
--- a/printstat.h
+++ b/printstat.h
@@ -57,9 +57,17 @@ DO_PRINTSTAT(struct tcb *tcp, const STRUCT_STAT *statbuf)
}
if (!abbrev(tcp)) {
- tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
- tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
- tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
+ const bool cast = sizeof(statbuf->st_atime) == sizeof(int);
+
+ tprintf("st_atime=%s, ",
+ sprinttime(cast ? (time_t) (int) statbuf->st_atime:
+ (time_t) statbuf->st_atime));
+ tprintf("st_mtime=%s, ",
+ sprinttime(cast ? (time_t) (int) statbuf->st_mtime:
+ (time_t) statbuf->st_mtime));
+ tprintf("st_ctime=%s",
+ sprinttime(cast ? (time_t) (int) statbuf->st_ctime:
+ (time_t) statbuf->st_ctime));
#if HAVE_STRUCT_STAT_ST_FLAGS
tprintf(", st_flags=%u", (unsigned int) statbuf->st_flags);
#endif
diff --git a/tests/stat64-v.test b/tests/stat64-v.test
index 4915386..f03254a 100755
--- a/tests/stat64-v.test
+++ b/tests/stat64-v.test
@@ -22,8 +22,7 @@ $truncate_cmd > "$OUT" 2>&1 || {
./stat $sample > /dev/null ||
fail_ 'stat failed'
-touch -d '1970-01-01 36028797018963968 seconds' $sample ||
-touch -t 0102030405 $sample
+touch -d '1970-01-01 -42 seconds' $sample
for f in $sample . /dev/null; do
args="-v -efile ./stat $f"
--
2.3.3

View File

@ -0,0 +1,102 @@
From 33557845adbd7b516e9113306515d9b107177830 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Wed, 11 Mar 2015 17:49:06 +0100
Subject: [PATCH 12/15] tests: verify that all patterns match
* tests/ipc_msg.test: Count matches to verify that all patterns match.
* tests/ipc_sem.test: Likewise.
* tests/ipc_shm.test: Likewise.
* tests/stat32-v.test: Likewise.
* tests/stat64-v.test: Likewise.
---
tests/ipc_msg.test | 6 ++++--
tests/ipc_sem.test | 4 +++-
tests/ipc_shm.test | 6 ++++--
tests/stat32-v.test | 4 +++-
tests/stat64-v.test | 4 +++-
5 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/tests/ipc_msg.test b/tests/ipc_msg.test
index b1ebe6d..e0d27ed 100755
--- a/tests/ipc_msg.test
+++ b/tests/ipc_msg.test
@@ -16,9 +16,11 @@ OUT="$LOG.out"
fi
}
-args="-eipc ./ipc_msg $f"
+args="-eipc ./ipc_msg"
$STRACE -o "$LOG" $args > "$OUT" &&
-LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+exp_lines=$(wc -l < "$OUT") &&
+matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+test $exp_lines -eq $matched_lines || {
cat "$OUT" "$LOG"
fail_ "$STRACE $args output mismatch"
}
diff --git a/tests/ipc_sem.test b/tests/ipc_sem.test
index b8fa545..ef957c3 100755
--- a/tests/ipc_sem.test
+++ b/tests/ipc_sem.test
@@ -18,7 +18,9 @@ OUT="$LOG.out"
args='-eipc ./ipc_sem'
$STRACE -o "$LOG" $args > "$OUT" &&
-LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+exp_lines=$(wc -l < "$OUT") &&
+matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+test $exp_lines -eq $matched_lines || {
cat "$OUT" "$LOG"
fail_ "$STRACE $args output mismatch"
}
diff --git a/tests/ipc_shm.test b/tests/ipc_shm.test
index b09dc2b..de8b47c 100755
--- a/tests/ipc_shm.test
+++ b/tests/ipc_shm.test
@@ -16,9 +16,11 @@ OUT="$LOG.out"
fi
}
-args="-eipc ./ipc_shm $f"
+args="-eipc ./ipc_shm"
$STRACE -o "$LOG" $args > "$OUT" &&
-LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+exp_lines=$(wc -l < "$OUT") &&
+matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+test $exp_lines -eq $matched_lines || {
cat "$OUT" "$LOG"
fail_ "$STRACE $args output mismatch"
}
diff --git a/tests/stat32-v.test b/tests/stat32-v.test
index 7f8cb4a..67eb5ed 100755
--- a/tests/stat32-v.test
+++ b/tests/stat32-v.test
@@ -33,7 +33,9 @@ touch -t 0102030405 $sample
for f in $sample . /dev/null; do
args="-v -efile ./stat32 $f"
$STRACE -o "$LOG" $args > "$OUT" &&
- LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+ exp_lines=$(wc -l < "$OUT") &&
+ matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+ test $exp_lines -eq $matched_lines || {
cat "$OUT" "$LOG"
fail_ "$STRACE $args output mismatch"
}
diff --git a/tests/stat64-v.test b/tests/stat64-v.test
index f03254a..785403d 100755
--- a/tests/stat64-v.test
+++ b/tests/stat64-v.test
@@ -27,7 +27,9 @@ touch -d '1970-01-01 -42 seconds' $sample
for f in $sample . /dev/null; do
args="-v -efile ./stat $f"
$STRACE -o "$LOG" $args > "$OUT" &&
- LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+ exp_lines=$(wc -l < "$OUT") &&
+ matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+ test $exp_lines -eq $matched_lines || {
cat "$OUT" "$LOG"
fail_ "$STRACE $args output mismatch"
}
--
2.3.3

View File

@ -0,0 +1,27 @@
From 71d6ffc6ed0a539257f0ec1a28d34c8d88bebce8 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Thu, 12 Mar 2015 16:17:45 +0100
Subject: [PATCH 13/15] aarch64: properly decode generic syscalls
* linux/aarch64/syscallent1.h: Don't override entries 277 to 1023.
---
linux/aarch64/syscallent1.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/linux/aarch64/syscallent1.h b/linux/aarch64/syscallent1.h
index 4ec9665..a72bb7b 100644
--- a/linux/aarch64/syscallent1.h
+++ b/linux/aarch64/syscallent1.h
@@ -3,9 +3,6 @@
/* Arch-specific block, not used on AArch64 */
[244 ... 259] = { },
-/* Blank down to 1023 */
-[277 ... 1023] = { },
-
/* Quote from asm-generic/unistd.h:
*
* All syscalls below here should go away really,
--
2.3.3

View File

@ -0,0 +1,92 @@
From f79252f072a193bdff435afeaa6b6cd6d5c79947 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Mon, 16 Mar 2015 17:18:40 +0000
Subject: [PATCH 14/15] stat64-v.test: add newfstatat syscall support
Newer architectures have no stat syscall, so stat() is implemented there
using newfstatat syscall.
* tests/stat.c (STAT_FNAME): Rename to STAT_PREFIX. Update callers.
[_FILE_OFFSET_BITS == 64] (STAT_PREFIX): Add newfstatat support.
(main) [!NR_stat]: Add newfstatat support.
Reported-by: Andreas Schwab <schwab@suse.de>
---
tests/stat.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/tests/stat.c b/tests/stat.c
index 21e37fb..2b04010 100644
--- a/tests/stat.c
+++ b/tests/stat.c
@@ -14,22 +14,22 @@
# include <sys/types.h>
#endif
-#undef STAT_FNAME
+#undef STAT_PREFIX
#undef NR_stat
#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
# include <sys/stat.h>
-# define STAT_FNAME "stat(64)?"
+# define STAT_PREFIX "(stat(64)?\\(|newfstatat\\(AT_FDCWD, )"
#else
# include <sys/syscall.h>
# if defined __NR_stat
# define NR_stat __NR_stat
-# define STAT_FNAME "stat"
+# define STAT_PREFIX "stat\\("
# elif defined __NR_newstat
# define NR_stat __NR_newstat
-# define STAT_FNAME "newstat"
+# define STAT_PREFIX "newstat\\("
# endif
-# ifdef STAT_FNAME
+# ifdef STAT_PREFIX
/* for S_IFMT */
# define stat libc_stat
# define stat64 libc_stat64
@@ -57,10 +57,10 @@
# define off_t __kernel_off_t
# define loff_t __kernel_loff_t
# include <asm/stat.h>
-# endif /* STAT_FNAME */
+# endif /* STAT_PREFIX */
#endif /* _FILE_OFFSET_BITS */
-#ifdef STAT_FNAME
+#ifdef STAT_PREFIX
static void
print_ftype(unsigned int mode)
@@ -115,7 +115,7 @@ main(int ac, const char **av)
assert(stat(av[1], &stb) == 0);
#endif
- printf(STAT_FNAME "\\(\"%s\", \\{", av[1]);
+ printf(STAT_PREFIX "\"%s\", \\{", av[1]);
printf("st_dev=makedev\\(%u, %u\\)",
(unsigned int) major(stb.st_dev),
(unsigned int) minor(stb.st_dev));
@@ -159,11 +159,15 @@ main(int ac, const char **av)
printf("(, st_flags=[0-9]+)?");
printf("(, st_fstype=[^,]*)?");
printf("(, st_gen=[0-9]+)?");
- printf("\\}\\) += 0\n");
+ printf("\\}");
+#ifndef NR_stat
+ printf("(, 0)?");
+#endif
+ printf("\\) += 0\n");
return 0;
}
-#else /* !STAT_FNAME */
+#else /* !STAT_PREFIX */
int main(void)
{
return 77;
--
2.3.3

View File

@ -0,0 +1,142 @@
From 68804b326709fadc7bb03f510a11771f07216a59 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Mon, 16 Mar 2015 18:10:21 +0000
Subject: [PATCH 15/15] tests/uid*: use fchown* instead of chown*
Newer architectures have no chown syscall, so use fchown* syscalls
for testing printuid.
* tests/uid.test: Use fchown instead of chown.
* tests/uid.c: Test __NR_fchown instead of __NR_chown.
(main): Use __NR_fchown instead of __NR_chown.
* tests/uid32.c: Test __NR_fchown32 instead of __NR_chown32.
(main): Use __NR_fchown32 instead of __NR_chown32.
* tests/uid16.c: Test __NR_fchown and __NR_fchown32 instead
of __NR_chown and __NR_chown32.
(main): Use __NR_fchown instead of __NR_chown.
* tests/uid.awk: Update regexp.
---
tests/uid.awk | 6 +++---
tests/uid.c | 4 ++--
tests/uid.test | 2 +-
tests/uid16.c | 8 ++++----
tests/uid32.c | 4 ++--
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/tests/uid.awk b/tests/uid.awk
index c6e891a..6f07b44 100644
--- a/tests/uid.awk
+++ b/tests/uid.awk
@@ -26,9 +26,9 @@ regexp == "" {
expected = "setresuid"
regexp = "^setresuid" suffix "\\(" uid ", -1, -1\\)[[:space:]]+= 0$"
} else if (expected == "setresuid") {
- expected = "chown"
- regexp = "^chown" suffix "\\(\".\", -1, -1\\)[[:space:]]+= 0$"
- } else if (expected == "chown") {
+ expected = "fchown"
+ regexp = "^fchown" suffix "\\(1, -1, -1\\)[[:space:]]+= 0$"
+ } else if (expected == "fchown") {
expected = "1st getgroups"
regexp = "^getgroups" suffix "\\(0, NULL\\)[[:space:]]+= " r_uint "$"
} else if (expected == "1st getgroups") {
diff --git a/tests/uid.c b/tests/uid.c
index 1972044..28f548b 100644
--- a/tests/uid.c
+++ b/tests/uid.c
@@ -14,7 +14,7 @@ main(void)
&& defined(__NR_getresuid) \
&& defined(__NR_setreuid) \
&& defined(__NR_setresuid) \
- && defined(__NR_chown) \
+ && defined(__NR_fchown) \
&& defined(__NR_getgroups)
int uid;
int size;
@@ -32,7 +32,7 @@ main(void)
}
assert(syscall(__NR_setreuid, -1, -1L) == 0);
assert(syscall(__NR_setresuid, uid, -1, -1L) == 0);
- assert(syscall(__NR_chown, ".", -1, -1L) == 0);
+ assert(syscall(__NR_fchown, 1, -1, -1L) == 0);
assert((size = syscall(__NR_getgroups, 0, list)) >= 0);
assert(list = calloc(size + 1, sizeof(*list)));
assert(syscall(__NR_getgroups, size, list) == size);
diff --git a/tests/uid.test b/tests/uid.test
index f4cb8e7..d8b0261 100755
--- a/tests/uid.test
+++ b/tests/uid.test
@@ -17,7 +17,7 @@ uid="uid$s$w"
fi
}
-syscalls="getuid$s,setuid$s,getresuid$s,setreuid$s,setresuid$s,chown$s,getgroups$s"
+syscalls="getuid$s,setuid$s,getresuid$s,setreuid$s,setresuid$s,fchown$s,getgroups$s"
args="-e trace=$syscalls"
$STRACE -o "$LOG" $args ./"$uid"|| {
cat "$LOG"
diff --git a/tests/uid16.c b/tests/uid16.c
index a2006d7..c0ef120 100644
--- a/tests/uid16.c
+++ b/tests/uid16.c
@@ -15,7 +15,7 @@ main(void)
&& defined(__NR_getresuid) \
&& defined(__NR_setreuid) \
&& defined(__NR_setresuid) \
- && defined(__NR_chown) \
+ && defined(__NR_fchown) \
&& defined(__NR_getgroups) \
\
&& defined(__NR_getuid32) \
@@ -23,7 +23,7 @@ main(void)
&& defined(__NR_getresuid32) \
&& defined(__NR_setreuid32) \
&& defined(__NR_setresuid32) \
- && defined(__NR_chown32) \
+ && defined(__NR_fchown32) \
&& defined(__NR_getgroups32) \
\
&& __NR_getuid != __NR_getuid32 \
@@ -31,7 +31,7 @@ main(void)
&& __NR_getresuid != __NR_getresuid32 \
&& __NR_setreuid != __NR_setreuid32 \
&& __NR_setresuid != __NR_setresuid32 \
- && __NR_chown != __NR_chown32 \
+ && __NR_fchown != __NR_fchown32 \
&& __NR_getgroups != __NR_getgroups32 \
/**/
int uid;
@@ -65,7 +65,7 @@ main(void)
}
assert(syscall(__NR_setreuid, -1, 0xffff) == 0);
assert(syscall(__NR_setresuid, uid, -1, 0xffff) == 0);
- assert(syscall(__NR_chown, ".", -1, 0xffff) == 0);
+ assert(syscall(__NR_fchown, 1, -1, 0xffff) == 0);
assert((size = syscall(__NR_getgroups, 0, list)) >= 0);
assert(list = calloc(size + 1, sizeof(*list)));
assert(syscall(__NR_getgroups, size, list) == size);
diff --git a/tests/uid32.c b/tests/uid32.c
index 15f1202..472461f 100644
--- a/tests/uid32.c
+++ b/tests/uid32.c
@@ -14,7 +14,7 @@ main(void)
&& defined(__NR_getresuid32) \
&& defined(__NR_setreuid32) \
&& defined(__NR_setresuid32) \
- && defined(__NR_chown32) \
+ && defined(__NR_fchown32) \
&& defined(__NR_getgroups32)
int r, e, s;
int size;
@@ -25,7 +25,7 @@ main(void)
assert(syscall(__NR_getresuid32, &r, &e, &s) == 0);
assert(syscall(__NR_setreuid32, -1, -1L) == 0);
assert(syscall(__NR_setresuid32, r, -1, -1L) == 0);
- assert(syscall(__NR_chown32, ".", -1, -1L) == 0);
+ assert(syscall(__NR_fchown32, 1, -1, -1L) == 0);
assert((size = syscall(__NR_getgroups32, 0, list)) >= 0);
assert(list = calloc(size + 1, sizeof(*list)));
assert(syscall(__NR_getgroups32, size, list) == size);
--
2.3.3

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Tue Mar 24 09:02:49 UTC 2015 - schwab@suse.de
- 0001-aarch64-fix-rt_sigreturn-decoding.patch,
0002-m68k-define-HAVE_SA_RESTORER.patch,
0003-Fix-decoding-of-mmap2-for-arm.patch,
0005-tests-select.test-handle-architectures-using-pselect.patch,
0006-aarch64-fix-ioctl-decoding.patch,
0007-m68k-fix-sigreturn-decoding.patch,
0008-Fix-crash-in-ipc_sem-test.patch,
0009-tests-ipc_-match-IPC_64-flag.patch,
0010-semctl-fix-indirect-syscall-decoding.patch,
0011-Fix-stat64-st_-acm-time-decoding-for-personalities-w.patch,
0012-tests-verify-that-all-patterns-match.patch,
0013-aarch64-properly-decode-generic-syscalls.patch,
0014-stat64-v.test-add-newfstatat-syscall-support.patch,
0015-tests-uid-use-fchown-instead-of-chown.patch: Patches from upstream
to fix testsuite failure.
- Enable libunwind support (strace -k).
-------------------------------------------------------------------
Fri Mar 20 20:32:38 UTC 2015 - crrodriguez@opensuse.org

View File

@ -30,9 +30,27 @@ Source: http://downloads.sourceforge.net/strace/%name-%version.tar.xz
Source2: http://downloads.sourceforge.net/strace/%name-%version.tar.xz.asc
Source3: %name.keyring
Source4: baselibs.conf
Patch1: 0001-aarch64-fix-rt_sigreturn-decoding.patch
Patch2: 0002-m68k-define-HAVE_SA_RESTORER.patch
Patch3: 0003-Fix-decoding-of-mmap2-for-arm.patch
Patch5: 0005-tests-select.test-handle-architectures-using-pselect.patch
Patch6: 0006-aarch64-fix-ioctl-decoding.patch
Patch7: 0007-m68k-fix-sigreturn-decoding.patch
Patch8: 0008-Fix-crash-in-ipc_sem-test.patch
Patch9: 0009-tests-ipc_-match-IPC_64-flag.patch
Patch10: 0010-semctl-fix-indirect-syscall-decoding.patch
Patch11: 0011-Fix-stat64-st_-acm-time-decoding-for-personalities-w.patch
Patch12: 0012-tests-verify-that-all-patterns-match.patch
Patch13: 0013-aarch64-properly-decode-generic-syscalls.patch
Patch14: 0014-stat64-v.test-add-newfstatat-syscall-support.patch
Patch15: 0015-tests-uid-use-fchown-instead-of-chown.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: libacl-devel
BuildRequires: libaio-devel
# libunwind is broken on ppc and ppc64
%ifarch %ix86 ia64 x86_64 %{arm} ppc64le aarch64
BuildRequires: libunwind-devel
%endif
BuildRequires: lksctp-tools-devel
BuildRequires: xz
# bug437293
@ -55,6 +73,23 @@ Authors:
%prep
%setup -q
# This file is missing in the tarball
echo 'extern uint64_t *const aarch64_sp_ptr;
extern uint32_t *const arm_sp_ptr;' > linux/aarch64/arch_regs.h
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%build
export CFLAGS="$RPM_OPT_FLAGS"
@ -71,7 +106,7 @@ make %{?_smp_mflags}
# Have to exclude make check for qemu builds, which apparently don't support PTRACE.
%if !(0%{?qemu_user_space_build})
%check
make check
make check || { cat tests/test-suite.log; exit 1; }
%endif
%install
@ -79,7 +114,7 @@ make install DESTDIR=$RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc README NEWS
%doc CREDITS README README-linux-ptrace NEWS
%{_prefix}/bin/strace
%{_prefix}/bin/strace-graph
%{_prefix}/bin/strace-log-merge