kernel-hacking-2024-linux-s.../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
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
crypto.c
domain.c
file.c apparmor: remove useless static inline function is_deleted 2024-05-10 08:44:43 -07:00
ipc.c
Kconfig
label.c
lib.c
lsm.c apparmor-pr-2024-07-24 PR 2024-07-25 2024-07-27 13:28:39 -07:00
Makefile
match.c
mount.c apparmor: take nosymfollow flag into account 2024-07-24 10:33:58 -07:00
net.c
nulldfa.in
path.c
policy.c apparmor: use kvfree_sensitive to free data->data 2024-05-10 08:32:35 -07:00
policy_compat.c
policy_ns.c
policy_unpack.c apparmor: unpack transition table if dfa is not present 2024-07-24 11:15:06 -07:00
policy_unpack_test.c apparmor: fix policy_unpack_test on big endian systems 2024-08-25 15:26:30 -07:00
procattr.c
resource.c
secid.c
stacksplitdfa.in
task.c