From f729ab68dd05e2d911dceae4e9f69142f142751c Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Thu, 1 Feb 2018 12:48:44 +0100 Subject: [PATCH] Make shuffle_scno globally available * syscall.c (shuffle_scno): Move the declaration... * defs.h (shuffle_scno): ...here. Remove static qualifier. * linux/aarch64/shuffle_scno.c (shuffle_scno): Remove static qualifier. * linux/arm/shuffle_scno.c: Likewise. * linux/shuffle_scno.c: Likewise. * linux/x32/shuffle_scno.c: Likewise. * linux/x86_64/shuffle_scno.c: Likewise. --- defs.h | 8 ++++++++ linux/aarch64/shuffle_scno.c | 2 +- linux/arm/shuffle_scno.c | 2 +- linux/shuffle_scno.c | 2 +- linux/x32/shuffle_scno.c | 2 +- linux/x86_64/shuffle_scno.c | 2 +- syscall.c | 6 ------ 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/defs.h b/defs.h index bbe0ecc9..1a6c789b 100644 --- a/defs.h +++ b/defs.h @@ -407,6 +407,14 @@ extern kernel_ulong_t get_rt_sigframe_addr(struct tcb *); * is valid; NULL otherwise. */ extern const char *syscall_name(kernel_ulong_t scno); +/** + * 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. + * + * @param scno Raw or shuffled syscall number. + * @return Shuffled or raw syscall number, respectively. + */ +extern kernel_ulong_t shuffle_scno(kernel_ulong_t scno); extern const char *err_name(unsigned long err); extern bool is_erestart(struct tcb *); diff --git a/linux/aarch64/shuffle_scno.c b/linux/aarch64/shuffle_scno.c index 81846330..7d4de73c 100644 --- a/linux/aarch64/shuffle_scno.c +++ b/linux/aarch64/shuffle_scno.c @@ -2,7 +2,7 @@ #include "../arm/shuffle_scno.c" #undef shuffle_scno -static kernel_ulong_t +kernel_ulong_t shuffle_scno(kernel_ulong_t scno) { if (current_personality == 1) diff --git a/linux/arm/shuffle_scno.c b/linux/arm/shuffle_scno.c index af77f873..17a40d67 100644 --- a/linux/arm/shuffle_scno.c +++ b/linux/arm/shuffle_scno.c @@ -1,4 +1,4 @@ -static kernel_ulong_t +kernel_ulong_t shuffle_scno(kernel_ulong_t scno) { if (scno < ARM_FIRST_SHUFFLED_SYSCALL) diff --git a/linux/shuffle_scno.c b/linux/shuffle_scno.c index e99f55cd..0e6feaf2 100644 --- a/linux/shuffle_scno.c +++ b/linux/shuffle_scno.c @@ -1,4 +1,4 @@ -static kernel_ulong_t +kernel_ulong_t shuffle_scno(kernel_ulong_t scno) { return scno; diff --git a/linux/x32/shuffle_scno.c b/linux/x32/shuffle_scno.c index e576d885..d0db368f 100644 --- a/linux/x32/shuffle_scno.c +++ b/linux/x32/shuffle_scno.c @@ -1,4 +1,4 @@ -static kernel_ulong_t +kernel_ulong_t shuffle_scno(kernel_ulong_t scno) { if (current_personality == 0 && scno != (kernel_ulong_t) -1) diff --git a/linux/x86_64/shuffle_scno.c b/linux/x86_64/shuffle_scno.c index 7a67897f..77840c23 100644 --- a/linux/x86_64/shuffle_scno.c +++ b/linux/x86_64/shuffle_scno.c @@ -1,4 +1,4 @@ -static kernel_ulong_t +kernel_ulong_t shuffle_scno(kernel_ulong_t scno) { if (current_personality == 2) diff --git a/syscall.c b/syscall.c index e556d255..41353c0a 100644 --- a/syscall.c +++ b/syscall.c @@ -486,12 +486,6 @@ dumpio(struct tcb *tcp) } } -/* - * 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. - */ -static kernel_ulong_t shuffle_scno(kernel_ulong_t scno); - const char * err_name(unsigned long err) { -- 2.40.0