Commit Graph

28 Commits

Author SHA1 Message Date
Xiang Xiao 84ddfb5455 sched/assert: Simplify the fatal detection logic
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-04 11:29:10 -04:00
Gregory Nutt 717bb04cb7 Increase the number of real time signals. Two is not enough.
Refer to issue #8867 for details and rational.

Convert sigset_t to an array type so that more than 32 signals can be supported.

Why not use a uin64_t?
- Using a uin32_t is more flexible if we decide to increase the number of signals beyound 64.
- 64-bit accesses are not atomic, at least not on 32-bit ARMv7-M and similar
- Keeping the base type as uint32_t does not introduce additional overhead due to padding to achieve 64-bit alignment of uin64_t
- Some architectures still supported by NuttX do not support uin64_t
  types,

Increased the number of signals to 64. This matches Linux. This will support all xsignals defined by Linux and also 32 real time signals (also like Linux).

This is is a work in progress; a draft PR that you are encouraged to comment on.
2023-03-27 16:59:04 +03:00
lilei19 77f6319268 sync ps/assert output 2023-02-17 23:35:44 +08:00
Ville Juven 905cba3ee3 group/tg_info/argv: Make utility function to read argv as string
This creates a generic and safe way to read a process argument vector
as string from any context.
2023-02-17 01:27:16 +08:00
Ville Juven f4b82b6405 sched/addrenv: Remove up_addrenv_restore
The function is not relevant any longer, remove it. Also remove
save_addrenv_t, the parameter taken by up_addrenv_restore.

Implement addrenv_select() / addrenv_restore() to handle the temporary
instantiation of address environments, e.g. when a process is being
created.
2023-02-08 02:51:23 +08:00
Ville Juven 5713d85df0 group/group_addrenv: Move address environment from group -> tcb
Detach the address environment handling from the group structure to the
tcb. This is preparation to fix rare cases where the system (MMU) is left
without a valid page directory, e.g. when a process exits.
2023-02-08 02:51:23 +08:00
chao an dff2192c75 misc/assert: remove const string from assert expression
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 15:08:47 +08:00
Petro Karashchenko e5dbc3328c sched/misc/assert: remove extra indentations
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-26 10:26:09 +08:00
Xiang Xiao 99e89809d7 board: Pass the assertion expression to board_crashdump too
continue the follow work:
commit 43e7b13697
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Sun Jan 22 19:31:32 2023 +0800

    assert: Log the assertion expression in case of fail

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-25 16:00:48 -03:00
Xiang Xiao 43e7b13697 assert: Log the assertion expression in case of fail
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-24 15:00:19 -03:00
ligd c0aaaa94e1 assert: used %p to logout the pointer
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-17 09:46:40 -03:00
ligd 19f87e88b9 assert: fix build break.
misc/assert.c: In function 'show_tasks':
Error: misc/assert.c:411:10: error: format '%p' expects argument of type 'void *', but argument 3 has type 'uintptr_t' {aka 'long unsigned int'} [-Werror=format=]
  411 |   _alert("  ----   ---"
      |          ^~~~~~~~~~~~~~
......
  424 |          , up_get_intstackbase()
      |            ~~~~~~~~~~~~~~~~~~~~~
      |            |
      |            uintptr_t {aka long unsigned int}

Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-17 09:46:40 -03:00
ligd 940de60892 assert: add stackbase dump
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-17 11:04:12 +08:00
ligd 4de9317373 assert: add uname info to assert message
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-17 11:04:12 +08:00
anjiahao 9a32cf7a1a assert:add a last type to call notifier
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-01-05 22:58:00 +08:00
田昕 96a45e2c75 sched/misc:add linux-like reboot notifier list
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-12-29 19:18:42 +08:00
Xiang Xiao d5f729ed25 sched/assert: Dump the global state only when it's a fatal error
and merge assert_end into _assert

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-29 11:50:31 +09:00
Xiang Xiao d1497a8d08 sched/assert: Don't call up_check_tcbstack for the kernel stack
since up_check_tcbstack only check the userspace stack color

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-29 11:50:31 +09:00
Xiang Xiao 5f99e482b5 sched/assert: Don't call running_task more than once
and fix some minor style issue

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-29 11:50:31 +09:00
Xiang Xiao 2e59d832fc sched/misc: Rename panic.c to panic_notifier.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-28 21:42:38 +02:00
zhangyuan21 45394eb6dc arch: save user context in assert common code
This is the work continue with #7875

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2022-12-24 13:02:56 +08:00
Ville Juven 172b209f2d sched/assert: Re-implement assert() into user space
_assert is a kernel procedure, entered via system call to make the core
dump in privileged mode.

Running exit() from this context is not OK as it runs the registered
exit functions and flushes streams, which must not be done
from privileged mode as it is a security hole.

Thus, implement assert() into user space (again) and remove the exit()
call from the kernel procedure.
2022-12-22 21:07:47 +08:00
Ville Juven b0b352f784 sched/assert: Fix printing argv when address environments are in use
Instantiate the correct address environment when reading the process's
argument vector. Otherwise doing this will crash the system every time,
causing a recursive assert loop.

Also try to do a bit of sanity checking before attempting to read the
process's memory, it might be in a bad state in which case this will
fail anyway.
2022-12-22 20:35:57 +08:00
yinshengkai 1a8cbc0b99 sched/assert: modify assert message
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-12-22 20:08:27 +08:00
zhangyuan21 3462061624 task: show thread main entry when display thread name
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2022-12-17 14:53:59 +08:00
zhangyuan21 453a1a7332 arch: move stack and task dump to common code
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2022-12-17 01:59:35 +08:00
田昕 0382b63f5d move common assert logic together.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-12-12 17:05:02 +08:00
田昕 2719869ab2 Move _assert to kernel space.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-12-06 18:33:21 +08:00