WSL2-Linux-Kernel/security
Guenter Roeck a979b02d85 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: 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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-04 13:23:42 +02:00
..
apparmor apparmor: fix policy_unpack_test on big endian systems 2024-09-04 13:23:42 +02:00
bpf
integrity ima: Avoid blocking in RCU read-side critical section 2024-07-18 13:07:34 +02:00
keys task_work: s/task_work_cancel()/task_work_cancel_func()/ 2024-08-19 05:45:13 +02:00
landlock landlock: Don't lose track of restrictions on cred_transfer 2024-08-19 05:45:10 +02:00
loadpin
lockdown
safesetid
selinux selinux: fix potential counting error in avc_add_xperms_decision() 2024-09-04 13:23:17 +02:00
smack ima: Avoid blocking in RCU read-side critical section 2024-07-18 13:07:34 +02:00
tomoyo
yama
Kconfig
Kconfig.hardening
Makefile
commoncap.c
device_cgroup.c
inode.c
lsm_audit.c
min_addr.c
security.c ima: Avoid blocking in RCU read-side critical section 2024-07-18 13:07:34 +02:00