From ed20cef6a068a67d2e3bc7be886ad8b09ee91f1d Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Thu, 14 Nov 2013 19:19:53 +0400 Subject: [PATCH] headers: Move prctl constants to prctl.h Move prctl constants into own header. They are arch independent. The x86 specific ARCH_SET_GS should be fetched from (instead of defining own ones). Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- arch/arm/include/asm/types.h | 25 ---------------------- arch/x86/include/asm/types.h | 31 --------------------------- arch/x86/restorer.c | 1 + cr-check.c | 1 + include/prctl.h | 41 ++++++++++++++++++++++++++++++++++++ pie/parasite.c | 1 + pie/restorer.c | 1 + 7 files changed, 45 insertions(+), 56 deletions(-) create mode 100644 include/prctl.h diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h index 4dcb7ed98..e59e01faa 100644 --- a/arch/arm/include/asm/types.h +++ b/arch/arm/include/asm/types.h @@ -9,33 +9,8 @@ #include "asm/bitops.h" #include "asm/int.h" -/* prctl.h */ -#define PR_SET_NAME 15 -#define PR_GET_NAME 16 - -#define PR_CAPBSET_DROP 24 -#define PR_GET_SECUREBITS 27 -#define PR_SET_SECUREBITS 28 - #define SECURE_NO_SETUID_FIXUP 2 -#define PR_SET_MM 35 -# define PR_SET_MM_START_CODE 1 -# define PR_SET_MM_END_CODE 2 -# define PR_SET_MM_START_DATA 3 -# define PR_SET_MM_END_DATA 4 -# define PR_SET_MM_START_STACK 5 -# define PR_SET_MM_START_BRK 6 -# define PR_SET_MM_BRK 7 -# define PR_SET_MM_ARG_START 8 -# define PR_SET_MM_ARG_END 9 -# define PR_SET_MM_ENV_START 10 -# define PR_SET_MM_ENV_END 11 -# define PR_SET_MM_AUXV 12 -# define PR_SET_MM_EXE_FILE 13 - -#define PR_GET_TID_ADDRESS 40 - #define CLONE_CHILD_USEPID 0x02000000 #define CLONE_VFORK 0x00004000 diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h index 079bd05a8..4e259db1c 100644 --- a/arch/x86/include/asm/types.h +++ b/arch/x86/include/asm/types.h @@ -10,42 +10,11 @@ #include "protobuf/core.pb-c.h" -/* prctl */ -#define ARCH_SET_GS 0x1001 -#define ARCH_SET_FS 0x1002 -#define ARCH_GET_FS 0x1003 -#define ARCH_GET_GS 0x1004 - #define FS_TLS 0 #define GS_TLS 1 -/* prctl.h */ -#define PR_SET_NAME 15 -#define PR_GET_NAME 16 - -#define PR_CAPBSET_DROP 24 -#define PR_GET_SECUREBITS 27 -#define PR_SET_SECUREBITS 28 - #define SECURE_NO_SETUID_FIXUP 2 -#define PR_SET_MM 35 -# define PR_SET_MM_START_CODE 1 -# define PR_SET_MM_END_CODE 2 -# define PR_SET_MM_START_DATA 3 -# define PR_SET_MM_END_DATA 4 -# define PR_SET_MM_START_STACK 5 -# define PR_SET_MM_START_BRK 6 -# define PR_SET_MM_BRK 7 -# define PR_SET_MM_ARG_START 8 -# define PR_SET_MM_ARG_END 9 -# define PR_SET_MM_ENV_START 10 -# define PR_SET_MM_ENV_END 11 -# define PR_SET_MM_AUXV 12 -# define PR_SET_MM_EXE_FILE 13 - -#define PR_GET_TID_ADDRESS 40 - #define CLONE_CHILD_USEPID 0x02000000 #define CLONE_VFORK 0x00004000 diff --git a/arch/x86/restorer.c b/arch/x86/restorer.c index dd7975e00..8dc5ac452 100644 --- a/arch/x86/restorer.c +++ b/arch/x86/restorer.c @@ -1,3 +1,4 @@ +#include #include #include "restorer.h" diff --git a/cr-check.c b/cr-check.c index 23b11e16e..6fd327365 100644 --- a/cr-check.c +++ b/cr-check.c @@ -19,6 +19,7 @@ #include "log.h" #include "util-pie.h" #include "syscall.h" +#include "prctl.h" #include "files.h" #include "sk-inet.h" #include "proc_parse.h" diff --git a/include/prctl.h b/include/prctl.h new file mode 100644 index 000000000..2bf1a13c0 --- /dev/null +++ b/include/prctl.h @@ -0,0 +1,41 @@ +#ifndef __CR_PRCTL_H__ +#define __CR_PRCTL_H__ + +#ifndef PR_SET_NAME +# define PR_SET_NAME 15 +#endif +#ifndef PR_GET_NAME +# define PR_GET_NAME 16 +#endif +#ifndef PR_CAPBSET_DROP +# define PR_CAPBSET_DROP 24 +#endif +#ifndef PR_GET_SECUREBITS +# define PR_GET_SECUREBITS 27 +#endif +#ifndef PR_SET_SECUREBITS +# define PR_SET_SECUREBITS 28 +#endif + +#ifndef PR_SET_MM +#define PR_SET_MM 35 +# define PR_SET_MM_START_CODE 1 +# define PR_SET_MM_END_CODE 2 +# define PR_SET_MM_START_DATA 3 +# define PR_SET_MM_END_DATA 4 +# define PR_SET_MM_START_STACK 5 +# define PR_SET_MM_START_BRK 6 +# define PR_SET_MM_BRK 7 +# define PR_SET_MM_ARG_START 8 +# define PR_SET_MM_ARG_END 9 +# define PR_SET_MM_ENV_START 10 +# define PR_SET_MM_ENV_END 11 +# define PR_SET_MM_AUXV 12 +# define PR_SET_MM_EXE_FILE 13 +#endif + +#ifndef PR_GET_TID_ADDRESS +# define PR_GET_TID_ADDRESS 40 +#endif + +#endif /* __CR_PRCTL_H__ */ diff --git a/pie/parasite.c b/pie/parasite.c index cd388ada9..7378df57d 100644 --- a/pie/parasite.c +++ b/pie/parasite.c @@ -9,6 +9,7 @@ #include "syscall.h" #include "parasite.h" #include "fcntl.h" +#include "prctl.h" #include "lock.h" #include "vdso.h" #include "log.h" diff --git a/pie/restorer.c b/pie/restorer.c index 82f3a3544..728f6f01a 100644 --- a/pie/restorer.c +++ b/pie/restorer.c @@ -16,6 +16,7 @@ #include "compiler.h" #include "asm/types.h" #include "syscall.h" +#include "prctl.h" #include "log.h" #include "util.h" #include "image.h"