Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: tests/kernel/mem_protect/mem_map/kernel.memory_protection.mem_map fails on qemu_x86_tiny #65509

Closed
henrikbrixandersen opened this issue Nov 21, 2023 · 2 comments · Fixed by #65539
Assignees
Labels
area: Kernel bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug

Comments

@henrikbrixandersen
Copy link
Member

Describe the bug
CI on main shows tests/kernel/mem_protect/mem_map/kernel.memory_protection.mem_map failing on qemu_x86_tiny. Git bisect shows that this was introduced in commit 7a5fcb8.

See https://github.com/zephyrproject-rtos/zephyr/actions/runs/6933236823/job/18859012701

To Reproduce
Steps to reproduce the behavior:

  1. west twister -p qemu_x86_tiny -s tests/kernel/mem_protect/mem_map/kernel.memory_protection.mem_map
  2. See error

Expected behavior
CI successful.

Impact
CI failures on main.

Logs and console output

Running TESTSUITE mem_map
===================================================================
START - test_z_phys_map_exec
 SKIP - test_z_phys_map_exec in 0.001 seconds
===================================================================
START - test_z_phys_map_rw
E: Page fault at address 0x403f84d6 (error code 0x3)
E: Access violation: supervisor thread not allowed to write
E: PTE: 0x403f8000 -> 0x0011f000: A 
E: EAX: 0x403f84d6, EBX: 0x0000138b, ECX: 0x0000008a, EDX: 0x0000008a
E: ESI: 0x00000000, EDI: 0x401120d0, EBP: 0x40133fa8, ESP: 0x40133f9c
E: EFLAGS: 0x00000246 CS: 0x0008 CR3: 0x0011c000
E: call trace:
E: EIP: 0x4012962b
E:      0x401299ae (0x0)
E:      0x4010d80a (0x401120d0)
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x4012d0a0 (test_z_phys_map_rw)
Caught system error -- reason 0
 PASS - test_z_phys_map_rw in 0.026 seconds
===================================================================
START - test_z_phys_map_side_effect
E: Page fault at address 0x403f6000 (error code 0x3)
E: Access violation: supervisor thread not allowed to write
E: PTE: 0x403f6000 -> 0x0011f000: 
E: EAX: 0x403f6000, EBX: 0x40112130, ECX: 0x4011d654, EDX: 0x00000001
E: ESI: 0x00000000, EDI: 0x401120d0, EBP: 0x40133fa8, ESP: 0x40133fa4
E: EFLAGS: 0x00000202 CS: 0x0008 CR3: 0x0011c000
E: call trace:
E: EIP: 0x40129070
E:      0x401299ae (0x0)
E:      0x4010d80a (0x401120d0)
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x4012d0a0 (test_z_phys_map_side_effect)
Caught system error -- reason 0
 PASS - test_z_phys_map_side_effect in 0.004 seconds
===================================================================
START - test_z_phys_map_unmap_reclaim_addr
Mapped (1st time): 0x403f44d6
Mapped (2nd time): 0x403f44d6
 PASS - test_z_phys_map_unmap_reclaim_addr in 0.001 seconds
===================================================================
START - test_z_phys_unmap
E: Page fault at address 0x403f2000 (error code 0x2)
E: Linear address not present in page tables
E: Access violation: supervisor thread not allowed to write
E: PTE: not present
E: EAX: 0x403f2000, EBX: 0x40112158, ECX: 0x4011d654, EDX: 0x00002000
E: ESI: 0x00000000, EDI: 0x401120d0, EBP: 0x40133fa8, ESP: 0x40133fa4
E: EFLAGS: 0x00000203 CS: 0x0008 CR3: 0x0011c000
E: call trace:
E: EIP: 0x401290dd
E:      0x401299ae (0x0)
E:      0x4010d80a (0x401120d0)
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x4012d0a0 (test_z_phys_unmap)
Caught system error -- reason 0
 PASS - test_z_phys_unmap in 0.004 seconds
===================================================================
TESTSUITE mem_map succeeded
Running TESTSUITE mem_map_api
===================================================================
START - test_k_mem_map_exhaustion
 SKIP - test_k_mem_map_exhaustion in 0.001 seconds
===================================================================
START - test_k_mem_map_guard_after
mapped a page: 0x403f2000 - 0x403f3000
trying to access 0x403f3004
E: Page fault at address 0x403f3004 (error code 0x2)
E: Linear address not present in page tables
E: Access violation: supervisor thread not allowed to write
E: PTE: not present
E: EAX: 0x401167f7, EBX: 0x403f2000, ECX: 0x4011818c, EDX: 0x403f3004
E: ESI: 0x00000000, EDI: 0x401120ec, EBP: 0x40133fa8, ESP: 0x40133fa4
E: EFLAGS: 0x00000216 CS: 0x0008 CR3: 0x0011c000
E: call trace:
E: EIP: 0x40129375
E:      0x401299ae (0x0)
E:      0x4010d80a (0x401120ec)
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x4012d0a0 (test_k_mem_map_guard_after)
Caught system error -- reason 0
 PASS - test_k_mem_map_guard_after in 0.004 seconds
===================================================================
START - test_k_mem_map_guard_before
mapped a page: 0x403ef000 - 0x403f0000
trying to access 0x403eeffc
E: Page fault at address 0x403eeffc (error code 0x2)
E: Linear address not present in page tables
E: Access violation: supervisor thread not allowed to write
E: PTE: not present
E: EAX: 0x401167f7, EBX: 0x403ef000, ECX: 0x4011818c, EDX: 0x403eeffc
E: ESI: 0x00000000, EDI: 0x401120ec, EBP: 0x40133fa8, ESP: 0x40133fa4
E: EFLAGS: 0x00000216 CS: 0x0008 CR3: 0x0011c000
E: call trace:
E: EIP: 0x40129403
E:      0x401299ae (0x0)
E:      0x4010d80a (0x401120ec)
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x4012d0a0 (test_k_mem_map_guard_before)
Caught system error -- reason 0
 PASS - test_k_mem_map_guard_before in 0.004 seconds
===================================================================
START - test_k_mem_map_unmap

    Assertion failed at WEST_TOPDIR/zephyr/tests/kernel/mem_protect/mem_map/src/main.c:273: mem_map_api_test_k_mem_map_unmap: (free_mem equal to 0)
no free memory
 FAIL - test_k_mem_map_unmap in 0.002 seconds
===================================================================
START - test_k_mem_map_user
mapped a page: 0x403ec000 - 0x403ed000 (with K_MEM_PERM_USER)
trying to access 0x403ec000 from userspace
mapped a page: 0x403ec000 - 0x403ed000 (without K_MEM_PERM_USER)
trying to access 0x403ec000 from userspace
E: Page fault at address 0x403ec000 (error code 0x7)
E: Access violation: user thread not allowed to write
E: PTE: 0x403ec000 -> 0x0011f000: RW 
E: EAX: 0x403ec000, EBX: 0x40130ffc, ECX: 0x00000000, EDX: 0x00000000
E: ESI: 0x0000003d, EDI: 0x40130fe4, EBP: 0x40130fe0, ESP: 0x40130fc8
E: EFLAGS: 0x00000246 CS: 0x002b CR3: 0x0011c000
E: call trace:
E: EIP: 0x40129005
E: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
E: Current thread: 0x4012d000 (unknown)
Caught system error -- reason 0
 PASS - test_k_mem_map_user in 0.005 seconds
===================================================================
TESTSUITE mem_map_api failed.

------ TESTSUITE SUMMARY START ------

SUITE PASS - 100.00% [mem_map]: pass = 4, fail = 0, skip = 1, total = 5 duration = 0.036 seconds
 - SKIP - [mem_map.test_z_phys_map_exec] duration = 0.001 seconds
 - PASS - [mem_map.test_z_phys_map_rw] duration = 0.026 seconds
 - PASS - [mem_map.test_z_phys_map_side_effect] duration = 0.004 seconds
 - PASS - [mem_map.test_z_phys_map_unmap_reclaim_addr] duration = 0.001 seconds
 - PASS - [mem_map.test_z_phys_unmap] duration = 0.004 seconds

SUITE FAIL -  75.00% [mem_map_api]: pass = 3, fail = 1, skip = 1, total = 5 duration = 0.016 seconds
 - SKIP - [mem_map_api.test_k_mem_map_exhaustion] duration = 0.001 seconds
 - PASS - [mem_map_api.test_k_mem_map_guard_after] duration = 0.004 seconds
 - PASS - [mem_map_api.test_k_mem_map_guard_before] duration = 0.004 seconds
 - FAIL - [mem_map_api.test_k_mem_map_unmap] duration = 0.002 seconds
 - PASS - [mem_map_api.test_k_mem_map_user] duration = 0.005 seconds

------ TESTSUITE SUMMARY END ------

===================================================================
RunID: 98260ca5179c7cb70655ff35712566d1
PROJECT EXECUTION FAILED

Environment (please complete the following information):

@henrikbrixandersen henrikbrixandersen added bug The issue is a bug, or the PR is fixing a bug area: Kernel labels Nov 21, 2023
@henrikbrixandersen henrikbrixandersen added the priority: high High impact/importance bug label Nov 21, 2023
@keith-packard
Copy link
Collaborator

Fails with SDK 0.16.3. Passes with SDK 0.16.4.

@keith-packard
Copy link
Collaborator

Also passes if I reduce the size of printf from SDK 0.16.3 using this patch:

diff --git a/tests/kernel/mem_protect/mem_map/testcase.yaml b/tests/kernel/mem_protect/mem_map/testcase.yaml
index ff42310403..860c76dcb6 100644
--- a/tests/kernel/mem_protect/mem_map/testcase.yaml
+++ b/tests/kernel/mem_protect/mem_map/testcase.yaml
@@ -7,7 +7,9 @@ tests:
   kernel.memory_protection.mem_map:
     filter: CONFIG_MMU and not CONFIG_X86_64
     extra_sections: _TRANSPLANTED_FUNC
-    extra_args: CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=0
+    extra_configs:
+      - CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=0
+      - CONFIG_CBPRINTF_REDUCED_INTEGRAL=y
     platform_exclude: qemu_x86_64
     integration_platforms:
       - qemu_x86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Kernel bug The issue is a bug, or the PR is fixing a bug priority: high High impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants