diff options
author | Daniel Verkamp <dverkamp@chromium.org> | 2021-10-11 12:34:00 -0700 |
---|---|---|
committer | Treehugger Robot <treehugger-gerrit@google.com> | 2022-03-19 01:29:27 +0000 |
commit | 7e146a20db9a5765cc2fda83fc83698106307a40 (patch) | |
tree | f99504fdf3545dc0fea3fc9410dbfab062224730 | |
parent | 7587aa062de0eafabb0931ea9c4ae99d8402e72d (diff) | |
download | minijail-7e146a20db9a5765cc2fda83fc83698106307a40.tar.gz |
tools/compile_seccomp_policy: align BPF buffer
The BPF opcodes emitted by the --output-header-file option are stored in
an array of unsigned char, but if other code accesses the data as an
array of struct sock_filter, the alignment of the buffer may not be
sufficient. Since struct sock_filter contains a __u32 field, its
natural alignment is 4 bytes, so add an align(4) attribute.
Change-Id: Ic8b2c9d4c7cbdcfc6b69d49c24fa21485fc6a04b
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
-rwxr-xr-x | tools/compile_seccomp_policy.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/compile_seccomp_policy.py b/tools/compile_seccomp_policy.py index 3487357..2219ae5 100755 --- a/tools/compile_seccomp_policy.py +++ b/tools/compile_seccomp_policy.py @@ -45,7 +45,7 @@ HEADER_TEMPLATE = """/* DO NOT EDIT GENERATED FILE */ #define MJ_SECCOMP_%(upper_name)s_H #include <stdint.h> -static const unsigned char %(name)s_binary_seccomp_policy[] = { +static const unsigned char %(name)s_binary_seccomp_policy[] __attribute__((__aligned__(4))) = { %(program)s }; |