Undefined behavior of the kernel #204

Open
opened 2025-04-08 08:22:14 +02:00 by Doczom · 2 comments
Owner

Various errors and failures may occur when executing the user code provided in the file(sorry, listing of code).
Some identified errors:

  • When checking on real hardware (laptop), the laptop reboots after 5-8 minutes, in the last case of the check, the reboot was unsuccessful and the laptop simply froze (without even reaching the bios screen saver)
  • When testing in Vbox, a VM error occurred almost immediately - VINF_EM_TRIPLE_FAULT , logs are attached
  use32
  org    0
  db     'MENUET01'
  dd     1
  dd     START
  dd     I_END, MEM, STACKTOP, 0, 0
START:
        xor     eax, eax
.loop:
        cmp     eax, -1
        jne     .create
        mov     eax, 68
        mov     ebx, 1
        int     0x40
.create:
        mov     eax, 51
        mov     ebx, 1
        mov     ecx, thread
        mov     edx, STACKTOP - 1024
        int     0x40
        cmp     eax, -2
        jnz     .loop

thread:
        mov     eax, -1
        int     0x40
I_END:
  rb 4096
align 16
STACKTOP:
MEM:
Various errors and failures may occur when executing the user code provided in the file(sorry, listing of code). Some identified errors: - When checking on real hardware (laptop), the laptop reboots after 5-8 minutes, in the last case of the check, the reboot was unsuccessful and the laptop simply froze (without even reaching the bios screen saver) - When testing in Vbox, a VM error occurred almost immediately - VINF_EM_TRIPLE_FAULT , logs are attached ```asm use32 org 0 db 'MENUET01' dd 1 dd START dd I_END, MEM, STACKTOP, 0, 0 START: xor eax, eax .loop: cmp eax, -1 jne .create mov eax, 68 mov ebx, 1 int 0x40 .create: mov eax, 51 mov ebx, 1 mov ecx, thread mov edx, STACKTOP - 1024 int 0x40 cmp eax, -2 jnz .loop thread: mov eax, -1 int 0x40 I_END: rb 4096 align 16 STACKTOP: MEM: ```
438 KiB
Doczom added the
Category/Kernel
Kind
Breaking
labels 2025-04-08 08:23:24 +02:00
Owner

On my Linux laptop:

$ cat /proc/sys/kernel/threads-max
53848

This seems to be the whole system limit but I didn't try to reach it.

UPD: Oh, the issue is not about the number of active threads but about the TID counter. Sorry.

On my Linux laptop: ``` $ cat /proc/sys/kernel/threads-max 53848 ``` This seems to be the whole system limit but I didn't try to reach it. UPD: Oh, the issue is not about the number of active threads but about the TID counter. Sorry.
Author
Owner

Possible locations of the problem:

  • Physical memory allocator
  • The code for creating a new thread
  • Task Scheduler
  • The table of memory regions available for use (not used for hardware)
Possible locations of the problem: - Physical memory allocator - The code for creating a new thread - Task Scheduler - The table of memory regions available for use (not used for hardware)
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: KolibriOS/kolibrios#204
No description provided.