Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Side by Side Diff: sandbox/linux/bpf_dsl/seccomp_macros.h

Issue 1128733002: Update from https://crrev.com/328418 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SANDBOX_LINUX_BPF_DSL_SECCOMP_MACROS_H_ 5 #ifndef SANDBOX_LINUX_BPF_DSL_SECCOMP_MACROS_H_
6 #define SANDBOX_LINUX_BPF_DSL_SECCOMP_MACROS_H_ 6 #define SANDBOX_LINUX_BPF_DSL_SECCOMP_MACROS_H_
7 7
8 #include <sys/cdefs.h> 8 #include <sys/cdefs.h>
9 // Old Bionic versions do not have sys/user.h. The if can be removed once we no 9 // Old Bionic versions do not have sys/user.h. The if can be removed once we no
10 // longer need to support these old Bionic versions. 10 // longer need to support these old Bionic versions.
11 // All x86_64 builds use a new enough bionic to have sys/user.h. 11 // All x86_64 builds use a new enough bionic to have sys/user.h.
12 #if !defined(__BIONIC__) || defined(__x86_64__) 12 #if !defined(__BIONIC__) || defined(__x86_64__)
13 #include <sys/types.h> // Fix for gcc 4.7, make sure __uint16_t is defined. 13 #include <sys/types.h> // Fix for gcc 4.7, make sure __uint16_t is defined.
14 #if !defined(__native_client_nonsfi__)
14 #include <sys/user.h> 15 #include <sys/user.h>
16 #endif
15 #if defined(__mips__) 17 #if defined(__mips__)
16 // sys/user.h in eglibc misses size_t definition 18 // sys/user.h in eglibc misses size_t definition
17 #include <stddef.h> 19 #include <stddef.h>
18 #endif 20 #endif
19 #endif 21 #endif
20 22
21 #include "sandbox/linux/system_headers/linux_seccomp.h" // For AUDIT_ARCH_* 23 #include "sandbox/linux/system_headers/linux_seccomp.h" // For AUDIT_ARCH_*
22 24
23 // Impose some reasonable maximum BPF program size. Realistically, the 25 // Impose some reasonable maximum BPF program size. Realistically, the
24 // kernel probably has much lower limits. But by limiting to less than 26 // kernel probably has much lower limits. But by limiting to less than
(...skipping 18 matching lines...) Expand all
43 #define SECCOMP_IP_MSB_IDX (offsetof(struct arch_seccomp_data, \ 45 #define SECCOMP_IP_MSB_IDX (offsetof(struct arch_seccomp_data, \
44 instruction_pointer) + 4) 46 instruction_pointer) + 4)
45 #define SECCOMP_IP_LSB_IDX (offsetof(struct arch_seccomp_data, \ 47 #define SECCOMP_IP_LSB_IDX (offsetof(struct arch_seccomp_data, \
46 instruction_pointer) + 0) 48 instruction_pointer) + 0)
47 #define SECCOMP_ARG_MSB_IDX(nr) (offsetof(struct arch_seccomp_data, args) + \ 49 #define SECCOMP_ARG_MSB_IDX(nr) (offsetof(struct arch_seccomp_data, args) + \
48 8*(nr) + 4) 50 8*(nr) + 4)
49 #define SECCOMP_ARG_LSB_IDX(nr) (offsetof(struct arch_seccomp_data, args) + \ 51 #define SECCOMP_ARG_LSB_IDX(nr) (offsetof(struct arch_seccomp_data, args) + \
50 8*(nr) + 0) 52 8*(nr) + 0)
51 53
52 54
53 #if defined(__BIONIC__) 55 #if defined(__BIONIC__) || defined(__native_client_nonsfi__)
54 // Old Bionic versions don't have sys/user.h, so we just define regs_struct 56 // Old Bionic versions and PNaCl toolchain don't have sys/user.h, so we just
55 // directly. This can be removed once we no longer need to support these old 57 // define regs_struct directly. This can be removed once we no longer need to
56 // Bionic versions. 58 // support these old Bionic versions and PNaCl toolchain.
57 struct regs_struct { 59 struct regs_struct {
58 long int ebx; 60 long int ebx;
59 long int ecx; 61 long int ecx;
60 long int edx; 62 long int edx;
61 long int esi; 63 long int esi;
62 long int edi; 64 long int edi;
63 long int ebp; 65 long int ebp;
64 long int eax; 66 long int eax;
65 long int xds; 67 long int xds;
66 long int xes; 68 long int xes;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 #define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch)) 144 #define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
143 #define SECCOMP_IP_MSB_IDX (offsetof(struct arch_seccomp_data, \ 145 #define SECCOMP_IP_MSB_IDX (offsetof(struct arch_seccomp_data, \
144 instruction_pointer) + 4) 146 instruction_pointer) + 4)
145 #define SECCOMP_IP_LSB_IDX (offsetof(struct arch_seccomp_data, \ 147 #define SECCOMP_IP_LSB_IDX (offsetof(struct arch_seccomp_data, \
146 instruction_pointer) + 0) 148 instruction_pointer) + 0)
147 #define SECCOMP_ARG_MSB_IDX(nr) (offsetof(struct arch_seccomp_data, args) + \ 149 #define SECCOMP_ARG_MSB_IDX(nr) (offsetof(struct arch_seccomp_data, args) + \
148 8*(nr) + 4) 150 8*(nr) + 4)
149 #define SECCOMP_ARG_LSB_IDX(nr) (offsetof(struct arch_seccomp_data, args) + \ 151 #define SECCOMP_ARG_LSB_IDX(nr) (offsetof(struct arch_seccomp_data, args) + \
150 8*(nr) + 0) 152 8*(nr) + 0)
151 153
152 #if defined(__BIONIC__) 154 #if defined(__BIONIC__) || defined(__native_client_nonsfi__)
153 // Old Bionic versions don't have sys/user.h, so we just define regs_struct 155 // Old Bionic versions and PNaCl toolchain don't have sys/user.h, so we just
154 // directly. This can be removed once we no longer need to support these old 156 // define regs_struct directly. This can be removed once we no longer need to
155 // Bionic versions. 157 // support these old Bionic versions and PNaCl toolchain.
156 struct regs_struct { 158 struct regs_struct {
157 unsigned long uregs[18]; 159 unsigned long uregs[18];
158 }; 160 };
159 #else 161 #else
160 typedef user_regs regs_struct; 162 typedef user_regs regs_struct;
161 #endif 163 #endif
162 164
163 #define REG_cpsr uregs[16] 165 #define REG_cpsr uregs[16]
164 #define REG_pc uregs[15] 166 #define REG_pc uregs[15]
165 #define REG_lr uregs[14] 167 #define REG_lr uregs[14]
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 #define SECCOMP_PT_PARM3(_regs) (_regs).regs[2] 286 #define SECCOMP_PT_PARM3(_regs) (_regs).regs[2]
285 #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3] 287 #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
286 #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4] 288 #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
287 #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5] 289 #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
288 #else 290 #else
289 #error Unsupported target platform 291 #error Unsupported target platform
290 292
291 #endif 293 #endif
292 294
293 #endif // SANDBOX_LINUX_BPF_DSL_SECCOMP_MACROS_H_ 295 #endif // SANDBOX_LINUX_BPF_DSL_SECCOMP_MACROS_H_
OLDNEW
« no previous file with comments | « sandbox/linux/bpf_dsl/policy_compiler.cc ('k') | sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698