Backport set of upstream patches to get it buildable on AArch64 - RHBZ: 1201777

This commit is contained in:
Marcin Juszkiewicz 2015-05-11 12:34:32 +02:00
parent a7873e858d
commit d2b947c550
9 changed files with 455 additions and 1 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 02/68] 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.5

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 06/68] 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.5

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 07/68] 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.5

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 14/68] 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.5

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 15/68] 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.5

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 16/68] 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.5

View File

@ -0,0 +1,32 @@
From 1b5b5670eb17787fa1c2e7d34a722b7330e2d78b Mon Sep 17 00:00:00 2001
From: Elliott Hughes <enh@google.com>
Date: Tue, 17 Mar 2015 16:00:31 -0700
Subject: [PATCH 17/68] Show f_flags field in printstatfs
printstatfs64 was right, but printstatfs was missing f_flags.
Noticed on aarch64.
* statfs.c (printstatfs) [_STATFS_F_FLAGS]: Print statfs.f_flags.
Signed-off-by: Elliott Hughes <enh@google.com>
---
statfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/statfs.c b/statfs.c
index 6f5e4d3..f1e9fc3 100644
--- a/statfs.c
+++ b/statfs.c
@@ -46,6 +46,9 @@ printstatfs(struct tcb *tcp, const long addr)
#ifdef _STATFS_F_FRSIZE
tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
#endif
+#ifdef _STATFS_F_FLAGS
+ tprintf(", f_flags=%lu", (unsigned long)statbuf.f_flags);
+#endif
tprints("}");
}
--
2.3.5

7
aarch64.patch Normal file
View File

@ -0,0 +1,7 @@
diff -Naur strace-4.10/linux/aarch64/arch_regs.h strace-4.10-/linux/aarch64/arch_regs.h
--- strace-4.10/linux/aarch64/arch_regs.h 1970-01-01 01:00:00.000000000 +0100
+++ strace-4.10-/linux/aarch64/arch_regs.h 2015-03-10 10:52:02.168318024 +0100
@@ -0,0 +1,3 @@
+
+extern uint64_t *const aarch64_sp_ptr;
+extern uint32_t *const arm_sp_ptr;

View File

@ -1,11 +1,26 @@
Summary: Tracks and displays system calls associated with a running process
Name: strace
Version: 4.10
Release: 1%{?dist}
Release: 2%{?dist}
License: BSD
Group: Development/Debuggers
URL: http://sourceforge.net/projects/strace/
Source: http://downloads.sourceforge.net/strace/%{name}-%{version}.tar.xz
Patch0: aarch64.patch
#
# RHBZ https://bugzilla.redhat.com/show_bug.cgi?id=1201777
#
# Patches created with git format-patch -o A dfabccf997dbad325442353926270d5b1289943f
#
# Selected minimal set to get package back into buildable state.
#
Patch0002: 0002-aarch64-fix-rt_sigreturn-decoding.patch
Patch0006: 0006-tests-select.test-handle-architectures-using-pselect.patch
Patch0007: 0007-aarch64-fix-ioctl-decoding.patch
Patch0014: 0014-aarch64-properly-decode-generic-syscalls.patch
Patch0015: 0015-stat64-v.test-add-newfstatat-syscall-support.patch
Patch0016: 0016-tests-uid-use-fchown-instead-of-chown.patch
Patch0017: 0017-Show-f_flags-field-in-printstatfs.patch
BuildRequires: libacl-devel, libaio-devel, time
@ -42,6 +57,14 @@ The `strace' program in the `strace' package is for 32-bit processes.
%prep
%setup -q
%patch0 -p1
%patch0002 -p1
%patch0006 -p1
%patch0007 -p1
%patch0014 -p1
%patch0015 -p1
%patch0016 -p1
%patch0017 -p1
%build
%configure
@ -79,6 +102,9 @@ make -k check VERBOSE=1
%endif
%changelog
* Mon May 11 2015 Marcin Juszkiewicz <mjuszkiewicz@redhat.com> - 4.10-2
- Backport set of upstream patches to get it buildable on AArch64
* Fri Mar 06 2015 Dmitry V. Levin <ldv@altlinux.org> - 4.10-1
- New upstream release:
+ enhanced ioctl decoding (#902788).