Skip to content

signal handler is called within "kernel" #10326

@yamt

Description

@yamt

nuttx, at least w/o CONFIG_LIB_SYSCALL, calls user-specified signal hander within the "kernel" part of the code directly.
it isn't safe because user handler can call system calls.

in the extreme case, the user handler escapes with a longjmp. it likely crashes the kernel later.
unfortunately it's somehow common for apps for posix environment to use longjmp within a signal handler.

while CONFIG_LIB_SYSCALL seems to defer signal delivery as expected (i haven't tested this. just glancing the code)
it isn't always desirable because:

  • it has considerable overhead like linking otherwise unused system calls
  • you need to write arch-dependent code (eg. sim doesn't have an implementation right now)

i guess a lighter-weight fix is nicer to have. eg. making every syscall-type functions call, say,enter_kernel/leave_kernel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions