pinktrace: update to 0.9.2.

This commit is contained in:
Duncaen 2015-12-19 17:15:14 +01:00
parent b5b03ce686
commit 586f1ecc0a
3 changed files with 130 additions and 4 deletions

View file

@ -0,0 +1,125 @@
From fe89eb08d1e70e31d6a9a71fc447d6fa1626b9cd Mon Sep 17 00:00:00 2001
From: Marvin Schmidt <marv@exherbo.org>
Date: Thu, 27 Aug 2015 16:02:42 +0000
Subject: Update syscall table and fix shuffle_scno for ARM
The shuffle_scno function was broken in commit 2ca0b96 due to the
removal of the ARM_LAST_ORDINARY_SYSCALL definition.
This updates the syscall table and makes the shuffle_scno function
more readable analogue to the way it was changed in strace
Change-Id: Id2c9bd196d2e1950f87e548bef5c28abcc305aad
Reviewed-on: https://galileo.mailstation.de/gerrit/3392
Reviewed-by: Jenkins <philantrop@gmail.com>
Reviewed-by: Kylie McClain <somasis@exherbo.org>
---
pinktrace/linux/arm/syscallent.h | 29 +++++++++++++++++++++++++++++
pinktrace/name.c | 40 +++++++++++++++++++++-------------------
2 files changed, 50 insertions(+), 19 deletions(-)
diff --git pinktrace/linux/arm/syscallent.h pinktrace/linux/arm/syscallent.h
index a6315a4..545f8f5 100644
--- pinktrace/linux/arm/syscallent.h
+++ pinktrace/linux/arm/syscallent.h
@@ -378,3 +378,32 @@
"process_vm_writev", /* 377 */
"kcmp", /* 378 */
"finit_module", /* 379 */
+ "sched_setattr", /* 380 */
+ "sched_getattr", /* 381 */
+ "renameat2", /* 382 */
+ "seccomp", /* 383 */
+ "getrandom", /* 384 */
+ "memfd_create", /* 385 */
+ "bpf", /* 386 */
+ "execveat", /* 387 */
+
+#define ARM_FIRST_SHUFFLED_SYSCALL 388
+
+ /* __ARM_NR_cmpxchg (0x000ffff0).
+ * Remapped by shuffle_scno() to be directly after ordinary syscalls
+ * in this table.
+ */
+ "cmpxchg", /* ARM_FIRST_SHUFFLED_SYSCALL */
+
+ /* ARM specific syscalls. Encoded with scno 0x000f00xx.
+ * Remapped by shuffle_scno() to be directly after __ARM_NR_cmpxchg.
+ */
+ NULL, /* 0 */
+ "breakpoint", /* 1 */
+ "cacheflush", /* 2 */
+ "usr26", /* 3 */
+ "usr32", /* 4 */
+ "set_tls" /* 5 */
+
+#define ARM_LAST_SPECIAL_SYSCALL 5
+
diff --git pinktrace/name.c pinktrace/name.c
index b3e3d13..df3461f 100644
--- pinktrace/name.c
+++ pinktrace/name.c
@@ -247,39 +247,41 @@ static const struct xlat addrfams[] = {
{ 0, NULL },
};
-/* Shuffle syscall numbers so that we don't have huge gaps in syscall table.
- * The shuffling should be reversible: shuffle_scno(shuffle_scno(n)) == n.
+/*
+ * Shuffle syscall numbers so that we don't have huge gaps in syscall table.
+ * The shuffling should be an involution: shuffle_scno(shuffle_scno(n)) == n.
*/
-#if PINK_ARCH_ARM /* So far only ARM needs this */
-static long shuffle_scno(unsigned long scno)
+#if defined(ARM) || defined(AARCH64) /* So far only 32-bit ARM needs this */
+static long
+shuffle_scno(unsigned long scno)
{
- if (scno <= ARM_LAST_ORDINARY_SYSCALL)
+ if (scno < ARM_FIRST_SHUFFLED_SYSCALL)
return scno;
/* __ARM_NR_cmpxchg? Swap with LAST_ORDINARY+1 */
- if (scno == 0x000ffff0)
- return ARM_LAST_ORDINARY_SYSCALL+1;
- if (scno == ARM_LAST_ORDINARY_SYSCALL+1)
+ if (scno == ARM_FIRST_SHUFFLED_SYSCALL)
return 0x000ffff0;
+ if (scno == 0x000ffff0)
+ return ARM_FIRST_SHUFFLED_SYSCALL;
- /* Is it ARM specific syscall?
- * Swap with [LAST_ORDINARY+2, LAST_ORDINARY+2 + LAST_SPECIAL] range.
+#define ARM_SECOND_SHUFFLED_SYSCALL (ARM_FIRST_SHUFFLED_SYSCALL + 1)
+ /*
+ * Is it ARM specific syscall?
+ * Swap [0x000f0000, 0x000f0000 + LAST_SPECIAL] range
+ * with [SECOND_SHUFFLED, SECOND_SHUFFLED + LAST_SPECIAL] range.
*/
- if (scno >= 0x000f0000
- && scno <= 0x000f0000 + ARM_LAST_SPECIAL_SYSCALL
- ) {
- return scno - 0x000f0000 + (ARM_LAST_ORDINARY_SYSCALL+2);
+ if (scno >= 0x000f0000 &&
+ scno <= 0x000f0000 + ARM_LAST_SPECIAL_SYSCALL) {
+ return scno - 0x000f0000 + ARM_SECOND_SHUFFLED_SYSCALL;
}
- if (/* scno >= ARM_LAST_ORDINARY_SYSCALL+2 - always true */ 1
- && scno <= (ARM_LAST_ORDINARY_SYSCALL+2) + ARM_LAST_SPECIAL_SYSCALL
- ) {
- return scno + 0x000f0000 - (ARM_LAST_ORDINARY_SYSCALL+2);
+ if (scno <= ARM_SECOND_SHUFFLED_SYSCALL + ARM_LAST_SPECIAL_SYSCALL) {
+ return scno + 0x000f0000 - ARM_SECOND_SHUFFLED_SYSCALL;
}
return scno;
}
#else
-# define shuffle_scno(scno) (long)(scno)
+# define shuffle_scno(scno) ((long)(scno))
#endif
PINK_GCC_ATTR((pure))
--
cgit v0.11.2

View file

@ -1,10 +1,11 @@
# Template file for 'pinktrace' # Template file for 'pinktrace'
pkgname=pinktrace pkgname=pinktrace
version=0.9.1 version=0.9.2
revision=1 revision=1
wrksrc="$pkgname-1-$version" wrksrc="$pkgname-1-$version"
build_style=gnu-configure build_style=gnu-configure
configure_args="--enable-python" configure_args="--enable-python"
make_build_args="PYTHON_CFLAGS=-I${XBPS_CROSS_BASE}/usr/include/python2.7"
hostmakedepends="automake pkg-config libtool python" hostmakedepends="automake pkg-config libtool python"
makedepends="python-devel" makedepends="python-devel"
short_desc="A ptrace() wrapper library" short_desc="A ptrace() wrapper library"
@ -12,9 +13,7 @@ maintainer="Andrea Brancaleoni <miwaxe@gmail.com>"
license="MIT" license="MIT"
homepage="http://dev.exherbo.org/~alip/pinktrace/" homepage="http://dev.exherbo.org/~alip/pinktrace/"
distfiles="http://git.exherbo.org/$pkgname-1.git/snapshot/$pkgname-1-$version.tar.gz" distfiles="http://git.exherbo.org/$pkgname-1.git/snapshot/$pkgname-1-$version.tar.gz"
checksum=04394d69d24fbfb6e7ba42ecfc21e3426359c8d0d7f90d39cc043359b2c74dc8 checksum=bebc724e3006e5a0f2019cd6ee64c868c835e8a24e69f172397de3a017913f68
only_for_archs="x86_64-musl x86_64 i686 i686-musl"
pre_configure() { pre_configure() {
./autogen.sh ./autogen.sh

2
srcpkgs/pinktrace/update Normal file
View file

@ -0,0 +1,2 @@
site="http://git.exherbo.org/pinktrace-1.git/refs/"
pkgname="pinktrace-1"