diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2012-10-10 10:50:03 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2012-10-11 05:39:08 -0400 |
commit | 7606c37d4a447ea3b0efb2165d3ccf516b7d8696 (patch) | |
tree | 91b61e142e160dc67342291f1863d2333059174e /arch/arm64 | |
parent | f3d447a97f24f7c1e14767e1974b8e5bc219bc07 (diff) |
arm64: Do not export the compat-specific definitions to the user
This patch adds #ifdef __KERNEL__ guards around the COMPAT_* definitions
to avoid exporting them to user. AArch32 user requiring the kernel
headers must use those generated with ARCH=arm.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/include/asm/hwcap.h | 2 | ||||
-rw-r--r-- | arch/arm64/include/asm/ptrace.h | 12 | ||||
-rw-r--r-- | arch/arm64/kernel/ptrace.c | 6 |
3 files changed, 13 insertions, 7 deletions
diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h index db05f9766112..2cb430082edf 100644 --- a/arch/arm64/include/asm/hwcap.h +++ b/arch/arm64/include/asm/hwcap.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #define HWCAP_FP (1 << 0) | 22 | #define HWCAP_FP (1 << 0) |
23 | #define HWCAP_ASIMD (1 << 1) | 23 | #define HWCAP_ASIMD (1 << 1) |
24 | 24 | ||
25 | #ifdef __KERNEL__ | ||
25 | #define COMPAT_HWCAP_HALF (1 << 1) | 26 | #define COMPAT_HWCAP_HALF (1 << 1) |
26 | #define COMPAT_HWCAP_THUMB (1 << 2) | 27 | #define COMPAT_HWCAP_THUMB (1 << 2) |
27 | #define COMPAT_HWCAP_FAST_MULT (1 << 4) | 28 | #define COMPAT_HWCAP_FAST_MULT (1 << 4) |
@@ -35,7 +36,6 @@ | |||
35 | #define COMPAT_HWCAP_IDIVT (1 << 18) | 36 | #define COMPAT_HWCAP_IDIVT (1 << 18) |
36 | #define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT) | 37 | #define COMPAT_HWCAP_IDIV (COMPAT_HWCAP_IDIVA|COMPAT_HWCAP_IDIVT) |
37 | 38 | ||
38 | #ifdef __KERNEL__ | ||
39 | #ifndef __ASSEMBLY__ | 39 | #ifndef __ASSEMBLY__ |
40 | /* | 40 | /* |
41 | * This yields a mask that user programs can use to figure out what | 41 | * This yields a mask that user programs can use to figure out what |
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h index 0fa5d6c9ef76..fc2772a27c78 100644 --- a/arch/arm64/include/asm/ptrace.h +++ b/arch/arm64/include/asm/ptrace.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <asm/hwcap.h> | 24 | #include <asm/hwcap.h> |
25 | 25 | ||
26 | #ifdef __KERNEL__ | ||
26 | /* AArch32-specific ptrace requests */ | 27 | /* AArch32-specific ptrace requests */ |
27 | #define COMPAT_PTRACE_GETREGS 12 | 28 | #define COMPAT_PTRACE_GETREGS 12 |
28 | #define COMPAT_PTRACE_SETREGS 13 | 29 | #define COMPAT_PTRACE_SETREGS 13 |
@@ -32,6 +33,7 @@ | |||
32 | #define COMPAT_PTRACE_SETVFPREGS 28 | 33 | #define COMPAT_PTRACE_SETVFPREGS 28 |
33 | #define COMPAT_PTRACE_GETHBPREGS 29 | 34 | #define COMPAT_PTRACE_GETHBPREGS 29 |
34 | #define COMPAT_PTRACE_SETHBPREGS 30 | 35 | #define COMPAT_PTRACE_SETHBPREGS 30 |
36 | #endif | ||
35 | 37 | ||
36 | /* | 38 | /* |
37 | * PSR bits | 39 | * PSR bits |
@@ -47,9 +49,11 @@ | |||
47 | 49 | ||
48 | /* AArch32 CPSR bits */ | 50 | /* AArch32 CPSR bits */ |
49 | #define PSR_MODE32_BIT 0x00000010 | 51 | #define PSR_MODE32_BIT 0x00000010 |
52 | #ifdef __KERNEL__ | ||
50 | #define COMPAT_PSR_MODE_USR 0x00000010 | 53 | #define COMPAT_PSR_MODE_USR 0x00000010 |
51 | #define COMPAT_PSR_T_BIT 0x00000020 | 54 | #define COMPAT_PSR_T_BIT 0x00000020 |
52 | #define COMPAT_PSR_IT_MASK 0x0600fc00 /* If-Then execution state mask */ | 55 | #define COMPAT_PSR_IT_MASK 0x0600fc00 /* If-Then execution state mask */ |
56 | #endif | ||
53 | 57 | ||
54 | /* AArch64 SPSR bits */ | 58 | /* AArch64 SPSR bits */ |
55 | #define PSR_F_BIT 0x00000040 | 59 | #define PSR_F_BIT 0x00000040 |
@@ -70,13 +74,15 @@ | |||
70 | #define PSR_x 0x0000ff00 /* Extension */ | 74 | #define PSR_x 0x0000ff00 /* Extension */ |
71 | #define PSR_c 0x000000ff /* Control */ | 75 | #define PSR_c 0x000000ff /* Control */ |
72 | 76 | ||
77 | #ifdef __KERNEL__ | ||
73 | /* | 78 | /* |
74 | * These are 'magic' values for PTRACE_PEEKUSR that return info about where a | 79 | * These are 'magic' values for PTRACE_PEEKUSR that return info about where a |
75 | * process is located in memory. | 80 | * process is located in memory. |
76 | */ | 81 | */ |
77 | #define PT_TEXT_ADDR 0x10000 | 82 | #define COMPAT_PT_TEXT_ADDR 0x10000 |
78 | #define PT_DATA_ADDR 0x10004 | 83 | #define COMPAT_PT_DATA_ADDR 0x10004 |
79 | #define PT_TEXT_END_ADDR 0x10008 | 84 | #define COMPAT_PT_TEXT_END_ADDR 0x10008 |
85 | #endif | ||
80 | 86 | ||
81 | #ifndef __ASSEMBLY__ | 87 | #ifndef __ASSEMBLY__ |
82 | 88 | ||
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index ac3550ecc7b5..2ea3968367c2 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c | |||
@@ -823,11 +823,11 @@ static int compat_ptrace_read_user(struct task_struct *tsk, compat_ulong_t off, | |||
823 | if (off & 3) | 823 | if (off & 3) |
824 | return -EIO; | 824 | return -EIO; |
825 | 825 | ||
826 | if (off == PT_TEXT_ADDR) | 826 | if (off == COMPAT_PT_TEXT_ADDR) |
827 | tmp = tsk->mm->start_code; | 827 | tmp = tsk->mm->start_code; |
828 | else if (off == PT_DATA_ADDR) | 828 | else if (off == COMPAT_PT_DATA_ADDR) |
829 | tmp = tsk->mm->start_data; | 829 | tmp = tsk->mm->start_data; |
830 | else if (off == PT_TEXT_END_ADDR) | 830 | else if (off == COMPAT_PT_TEXT_END_ADDR) |
831 | tmp = tsk->mm->end_code; | 831 | tmp = tsk->mm->end_code; |
832 | else if (off < sizeof(compat_elf_gregset_t)) | 832 | else if (off < sizeof(compat_elf_gregset_t)) |
833 | return copy_regset_to_user(tsk, &user_aarch32_view, | 833 | return copy_regset_to_user(tsk, &user_aarch32_view, |