linux/security/apparmor
Guenter Roeck 98c0cc48e2 apparmor: fix policy_unpack_test on big endian systems
policy_unpack_test fails on big endian systems because data byte order
is expected to be little endian but is generated in host byte order.
This results in test failures such as:

 # policy_unpack_test_unpack_array_with_null_name: EXPECTATION FAILED at security/apparmor/policy_unpack_test.c:150
    Expected array_size == (u16)16, but
        array_size == 4096 (0x1000)
        (u16)16 == 16 (0x10)
    # policy_unpack_test_unpack_array_with_null_name: pass:0 fail:1 skip:0 total:1
    not ok 3 policy_unpack_test_unpack_array_with_null_name
    # policy_unpack_test_unpack_array_with_name: EXPECTATION FAILED at security/apparmor/policy_unpack_test.c:164
    Expected array_size == (u16)16, but
        array_size == 4096 (0x1000)
        (u16)16 == 16 (0x10)
    # policy_unpack_test_unpack_array_with_name: pass:0 fail:1 skip:0 total:1

Add the missing endianness conversions when generating test data.

Fixes: 4d944bcd4e ("apparmor: add AppArmor KUnit tests for policy unpack")
Cc: Brendan Higgins <brendanhiggins@google.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-25 15:26:30 -07:00
..
include apparmor-pr-2024-07-24 PR 2024-07-25 2024-07-27 13:28:39 -07:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
apparmorfs.c apparmor: fix possible NULL pointer dereference 2024-05-10 08:59:05 -07:00
audit.c ima: Avoid blocking in RCU read-side critical section 2024-06-13 14:26:50 -04:00
capability.c apparmor: Fix some kernel-doc comments 2023-10-23 00:25:49 -07:00
crypto.c apparmor: switch SECURITY_APPARMOR_HASH from sha1 to sha256 2023-11-19 00:47:56 -08:00
domain.c apparmor: declare stack_msg as static 2023-11-19 00:48:12 -08:00
file.c apparmor: remove useless static inline function is_deleted 2024-05-10 08:44:43 -07:00
ipc.c apparmor: refcount the pdb 2023-10-18 15:30:47 -07:00
Kconfig apparmor: switch SECURITY_APPARMOR_HASH from sha1 to sha256 2023-11-19 00:47:56 -08:00
label.c apparmor: refcount the pdb 2023-10-18 15:30:47 -07:00
lib.c apparmor: fix possible memory leak in unpack_trans_table 2024-01-04 01:34:00 -08:00
lsm.c apparmor-pr-2024-07-24 PR 2024-07-25 2024-07-27 13:28:39 -07:00
Makefile + Features 2022-12-14 13:42:09 -08:00
match.c apparmor: refcount the pdb 2023-10-18 15:30:47 -07:00
mount.c apparmor: take nosymfollow flag into account 2024-07-24 10:33:58 -07:00
net.c apparmor: refcount the pdb 2023-10-18 15:30:47 -07:00
nulldfa.in apparmor: cleanup add proper line wrapping to nulldfa.in 2018-02-09 11:30:01 -08:00
path.c security: apparmor: delete repeated words in comments 2021-02-07 04:15:46 -08:00
policy_compat.c apparmor: fixup return comments for kernel doc cleanups by Gaosheng Cui 2023-08-08 13:12:19 -07:00
policy_ns.c apparmor: remove unused functions in policy_ns.c/.h 2023-10-15 21:44:31 -07:00
policy_unpack_test.c apparmor: fix policy_unpack_test on big endian systems 2024-08-25 15:26:30 -07:00
policy_unpack.c apparmor: unpack transition table if dfa is not present 2024-07-24 11:15:06 -07:00
policy.c apparmor: use kvfree_sensitive to free data->data 2024-05-10 08:32:35 -07:00
procattr.c AppArmor: Add selfattr hooks 2023-11-12 22:54:42 -05:00
resource.c apparmor: pass cred through to audit info. 2023-10-18 15:30:38 -07:00
secid.c apparmor: fix kernel-doc complaints 2023-01-10 10:04:35 -08:00
stacksplitdfa.in apparmor: use the dfa to do label parse string splitting 2018-02-09 11:30:01 -08:00
task.c apparmor: add missing params to aa_may_ptrace kernel-doc comments 2023-11-19 01:19:41 -08:00