kernel_samsung_a53x/security/apparmor
Guenter Roeck 5eaeb4f69e apparmor: fix policy_unpack_test on big endian systems
[ Upstream commit 98c0cc48e27e9d269a3e4db2acd72b486c88ec77 ]

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: 4d944bcd4e73 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:20:55 +01:00
..
include ima: Avoid blocking in RCU read-side critical section 2024-11-19 14:19:42 +01:00
apparmorfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
audit.c ima: Avoid blocking in RCU read-side critical section 2024-11-19 14:19:42 +01:00
capability.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
crypto.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
domain.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
file.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
label.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lib.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lsm.c apparmor: Fix null pointer deref when receiving skb during sock creation 2024-11-23 23:20:18 +01:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
match.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mount.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
net.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nulldfa.in Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
path.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
policy.c apparmor: use kvfree_sensitive to free data->data 2024-11-23 23:20:13 +01:00
policy_ns.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
policy_unpack.c apparmor: use kvfree_sensitive to free data->data 2024-11-23 23:20:13 +01:00
policy_unpack_test.c apparmor: fix policy_unpack_test on big endian systems 2024-11-23 23:20:55 +01:00
procattr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
resource.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
secid.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stacksplitdfa.in Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
task.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00