Commit Graph

54674 Commits

Author SHA1 Message Date
wangyingdong
84f326a66b Fix the bug that netlink receive wait does not hang up
Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
2024-09-19 03:19:15 +08:00
wanggang26
ff0194fb74 mmcsd: make a compatibility change for cmd12 and cmd23
For some sd cards don't support cmd23 or support cmd23 indicated by
bit33 in scr

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-19 03:17:48 +08:00
buxiasen
395c449884 critmon: update document about the critmon configurations usage.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-19 03:16:14 +08:00
yanghuatao
236678d730 toolchain/ghs: Fix CONFIG_SCHED_CRITMONITOR_MAXTIME_XXX "zero used for undefined preprocessing identifier" warnings
"~/nuttx/include/nuttx/sched.h", line 631: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 637: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 642: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 789: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 793: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 631: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 637: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 642: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 789: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_PREEMPTION >= 0
      ^

"~/nuttx/include/nuttx/sched.h", line 793: warning #193-D:
          zero used for undefined preprocessing identifier
          "CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION"
  #if CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2024-09-19 03:16:14 +08:00
buxiasen
b33e20a586 critmon: fix context switch critmon pause err.
Elapsed time statistic up to now when sched happen

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-19 03:16:14 +08:00
ligd
90dcd5edd3 critmonitor: add caller support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-19 03:16:14 +08:00
yinshengkai
e28b311b78 Make each function of SCHED_CRITMONITOR independent
There will be a large performance loss after SCHED_CRITMONITOR is enabled.
By isolating thread running time-related functions, CPU load can be run with less overhead.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-19 03:16:14 +08:00
yinshengkai
6b07284c61 sched/cpuload: fix SMP situation CPULOAD statistics are inaccurate
When statistics when sched_cpuload_critMonitor, thread switching only
calculates the current CPU's running time. Other CPU running threads
are updated for updates

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:16:14 +08:00
guohao15
f95b73f9a8 add inotify doc
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-09-19 03:15:51 +08:00
wangmingrong1
969a5b510e compiler.h: AVR 2-byte PC and 3-byte PC do not support returnaddress
Compilation error:
Kasan/book. c: In the function '__hwasanloaded 16_noabort':
Kasan/book. c: 76:5: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
kasan_check_report(addr, size, false, return_address(0)); \
^
Kasan/book. c: 423:1: Note: in expansion of macro 'DEFINE-HWASAN_LOAD-STORE'
DEFINE_HWASAN_LOAD_STORE(16)
^
Kasan/book. c: In the function '__hwasan_store16_noabort':
Kasan/book. c: 80:5: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
kasan_check_report(addr, size, true, return_address(0)); \
^
Kasan/book. c: 423:1: Note: in expansion of macro 'DEFINE-HWASAN_LOAD-STORE'
DEFINE_HWASAN_LOAD_STORE(16)
^
CC: hello. min c hello. min c: In the function 'hello. min':
Hello. main. c: 39:3: Warning: 'builtin-turn_dedress' contains only 2 bytes of address
printf("Hello, World: %p!!\n", return_address(0));

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
23981cdf3d mm/kasan: Add branch prediction and constant prediction
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
63a371b261 mm/kasan: Change the init flag
predict_false(g_region_init == KASAN_INIT_VALUE))
   c:	e3003000 	movw	r3, #0
  10:	e3403000 	movt	r3, #0
  if (predict_false(size == 0) ||
  14:	e5932000 	ldr	r2, [r3]
  18:	e30e3adf 	movw	r3, #60127	; 0xeadf
if KASAN_INIT_VALUE is 0xdeadcafe, run function movw will again and load twice

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
b49eef7f4e mm/kasan: The complete implementation of inline instrumentation functions
1. Use always_inline_function instead of inline, inline does not take effect
2. Activate Kasan acceleration by 1/7

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
27f8f87331 mm/kasan: Fix the issue where Kasan Global cannot be used
1. The shadow area of global variables is different from heap
2. This modification has little impact on performance under O3 optimization

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
4473f2f847 mm/kasan: Increase size alignment
The following situations cannot be detected by Kasan:
On a 32-bit machine, only 12 bytes were poisoned, but 13 bytes were accessed. Due to the lack of upward alignment, only 3 bits were detected

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
b7d5a30f85 include/nuttx.h: add common align definitions for nuttx
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
430820e7ec mm/sw_tags: Add API for register
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
1da8cf8104 kasan: No citation removed
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
87dc91b588 mm/kasan: add kasan watch point implementation
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
e154c6d071 mm/kasan: add null pointer access configuration
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
xuxingliang
38010adc02 nuttx/mm: fix cmake kasan flags
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
496e44db7f mm: kasan supports checking 0 address access
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
ae7a3d7071 mm: move kasna_start/stop to hook.c
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
anjiahao
2d8b582ce6 kasan:add kasan_start/stop api to control kasan check
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
be86b03794 mm/kasan: support Disable Kasan read Panic
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
d365be9f2f kasan: remove kasan report recursive check
PANIC never returns and abort is called to exit the process after calling assert
When BOARD_RESET_ON_ASSERT < 2, the second kasan_report will not be executed.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
5ee7c563a5 mm: add kasan_unregister implementaion
In mm_uninitialize should unregister kasan

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
1771d233c9 mm/kasan: fix kasan_is_poisoned check error
When size is less than or equal to KASAN_SHADOW_SCALE, no check will be performed
We need to check whether the memory is accessible based on bit

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
ligd
13a0682340 kasan: disable the built-in 'memset' function
In function kasan_set_poison:
{
  ...

  while (size--)
    {
      p[size] = value;
    }
}
This will optimize to 'memset' function when compile option > O2.

But the memset must be instrument by kasan, so there is recursive

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-19 03:15:29 +08:00
ligd
8a272511d5 kasan: remove unused statement
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-09-19 03:15:29 +08:00
yinshengkai
e0c8189818 mm/kasan: fix kasan false positives
When using memset via __asan_storeN check, not checking if all memory is accessible

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong1
30652291b5 nxstyle.c: Eliminate case issues with compiler-generated functions
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
wangmingrong
ae3facda53 kasan: Implementation of Kasan based on software tags.
Currently, only aarch64 is supported

Signed-off-by: wangmingrong <wangmingrong@xiaomi.com>
2024-09-19 03:15:29 +08:00
Xiang Xiao
9c6bed4b00 mm: Move kasan.h from mm/kasan to include/nuttx/mm
so other parts of the system can use it.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-09-19 03:15:29 +08:00
Xiang Xiao
47ffb9019f mm: Support the different kasan implementation
Split kasan.c to incorporate label based kasan:
hook.c: Implement compiler instrumentation function
generic.c: Implementation software kasan algorithm

Signed-off-by: wangmingrong <wangmingrong1@xiaomi.com>
2024-09-19 03:15:29 +08:00
anjiahao
70b9f63985 kasan:fix arch_xxx size is 0,kasan report
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-19 03:15:29 +08:00
anjiahao
e26e1ab2ab kasan:fix bug if kasan_mem_to_shadow mod size is 0 just return
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-19 03:15:29 +08:00
anjiahao
745611f800 kasan:fix bug for kasan_mem_to_shadow
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-19 03:15:29 +08:00
anjiahao
780abec239 kasan:support kasan_mem_to_shadow can check any size
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-19 03:15:29 +08:00
anjiahao
5952bc7392 fs_dup2:fix inode->i_crefs counting error
file_ioctl failed, but close success, inode need release

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-09-19 02:55:13 +08:00
zhangshoukui
3fb6b4c9ec fix mmap compile error.
mmap/fs_rammap.c:81:39: error: expected ‘)’ before ‘PRIdOFF’
   81 |       ferr("ERRORL Seek to position %"PRIdOFF" failed\n", fpos);
      |                                       ^~~~~~~
mmap/fs_rammap.c:81:12: warning: spurious trailing ‘%’ in format [-Wformat=]
   81 |       ferr("ERRORL Seek to position %"PRIdOFF" failed\n", fpos);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
mmap/fs_rammap.c:81:37: note: format string is defined here
   81 |       ferr("ERRORL Seek to position %"PRIdOFF" failed\n", fpos);
      |                                     ^
In file included from mmap/fs_rammap.c:30:
mmap/fs_rammap.c:98:51: error: expected ‘)’ before ‘PRIdOFF’
   98 |               ferr("ERROR: Write failed: offset=%"PRIdOFF" nwrite=%zd\n",
      |                                                   ^~~~~~~
mmap/fs_rammap.c:98:20: warning: spurious trailing ‘%’ in format [-Wformat=]
   98 |               ferr("ERROR: Write failed: offset=%"PRIdOFF" nwrite=%zd\n",
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mmap/fs_rammap.c:98:49: note: format string is defined here
   98 |               ferr("ERROR: Write failed: offset=%"PRIdOFF" nwrite=%zd\n",

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-09-19 01:43:50 +08:00
chenrun1
250353240c rammap:Adjust the lower two bits to represent type
Summary:
  In rammap:
   1.0 - User
   2.1 - Kernel
   3.2 - XIP
  Therefore we need to use 2 bits to represent the type

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-19 01:43:50 +08:00
chenrun1
c9148fbb0a fs_msync:Fix crash caused under the anonymous mapping
Summary:
 Limitations of using fs putfile

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-19 01:43:50 +08:00
chenrun1
d04205aa3d fs/mmap/msync:support msync.
Summary:
  1.Added msync callback in struct mm_map_entry_s
  2.Added msync API in fs_msync.c
  3.Added static msync_rammap for rammap.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-19 01:43:50 +08:00
wanggang26
484600bd75 mmap: add xip mmap type support
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-09-19 01:43:50 +08:00
p-szafonimateusz
545774eb88 serial/pci_16550: make sure that interrupts are disabled during init
Make sure that interrups are disabled during initialization.
This is a proper fix for an unexpected MSI interrupt for PCI serial driver.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-18 23:54:12 +08:00
Xiang Xiao
f76c2ed83b can: Add g_ prefix to can_dlc_to_len and len_to_can_dlc.
detail: Add g_ prefix to can_dlc_to_len and len_to_can_dlc to
follow NuttX coding style conventions for global symbols,
improving code readability and maintainability.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2024-09-18 23:50:11 +08:00
chao an
3cce16dd0c fs/dump: correct SCHED_DUMP_ON_EXIT to DUMP_ON_EXIT
1. correct SCHED_DUMP_ON_EXIT to DUMP_ON_EXIT
2. dump file list only if DUMP_ON_EXIT enabled

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-18 23:48:31 +08:00
zhangshoukui
baa716a85d fs: Dump the list of files when the file description runs out
Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-09-18 13:48:45 +08:00
zhangshoukui
8e4e09be2d shm: The limits have been made in Make.defs and remove useless macro in code
ifeq ($(CONFIG_MM_SHM),y)
CSRCS += shmat.c shmctl.c shmdt.c shmget.c

DEPPATH += --dep-path shm
VPATH += :shm
endif

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-09-18 13:42:11 +08:00