Commit Graph

54026 Commits

Author SHA1 Message Date
wangchen
9147c955dc local:local socket sendto with adding binding path info
For udp localsocket current implementation,the sent information only carries the packet info.
The receiver receives the information,it don't know who the information comes from.
Thus the receiver doesn't know who to send the response message to.

We add sender's binding path info in the information,the receiver knows who sent the information
based on the parsed information.
The receiver knows who to send the response message to.

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-23 16:14:39 -03:00
Zhe Weng
a591adc6d5 drivers/pipes: Add offset support for PIPEIOC_PEEK
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-08-23 16:14:39 -03:00
wangchen
6a267fe019 drivers/pipes:add PIPEPOLICY_0 check in pipecommon_read & pipecommon_write.
From the current implementation,udp localsoket receiver's pipe is closed, the sender write failed in the pipe;
we change the implementation to check if buffer is free(PIPE_IS_POLICY_0),if not free,the sender could write in the pipe;

From the current implementation,udp localsoket sender's pipe is empty,the recevier directly return end of file;
we change the implementation to check if buffer is free(PIPE_IS_POLICY_0),if not free,the receiver wait for data

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-23 16:14:39 -03:00
ligd
1a21445877 pipes: use priv refs instead of inode to resolve memleak
thread1                 thread2
open pipe               open pipe
close()
-> pipecommon_close()
  -> check inode refs
  -> do NOT free dev    close()
                        -> pipecommon_close()
                          -> check inode refs
                          -> do NOT free dev
-> inode_release
   inode refs--
                        -> inode_release
                           inode refs--

Then, you will see the pipe hasn't free its resource, memleak

Resolve:
replace the inode refs with priv refs

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-08-23 16:14:39 -03:00
wangchen
f811b78d8c local:add check to the localsocket binding the path
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-23 16:14:39 -03:00
yinshengkai
624fc5a9b8 sched: support dumping all file information during assert
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 16:12:31 -03:00
yinshengkai
20b357abde assert: pause all other CPUs when assert
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 16:12:31 -03:00
yinshengkai
b3794c8af7 assert: Avoid recursive calls of Assert
After the structure of the kernel core is wrong, dump_stack, dumpstack is easy to appear crash

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 16:12:31 -03:00
Felipe Moura
75f81e6e24 stm32f4discovery - add mfrc522 rfid support 2024-08-23 16:11:46 -03:00
makejian
9769816385 crypto: fix wrong implementation in crypto module
(1) RSA_PKCS15_VERIFY Misspell
(2) if iv not provided during decryption, iv should get from data.
It was not discovered before because all symmetric decryption comes with iv.
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-23 12:57:37 -03:00
makejian
7c763f67a6 crypto/poly1305: Fix false positive '-Wstringop-overflow' warning in poly1305.c
poly1305.c:241:40: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  241 |           st->buffer[st->leftover + i] = m[i];
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
Signed-off-by: makejian <makejian@xiaomi.com>
2024-08-23 12:57:37 -03:00
guohao15
c812007f8c mtd:use part->name as partition name when CONFIG_MTD_PARTITION_NAMES set
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-23 11:27:39 -03:00
Ville Juven
b3e511c5a8 arm64/qemu: Add knsh target for armv8a qemu board
This adds a qemu test target for testing kernel mode with arm64
2024-08-23 10:26:34 -03:00
Ville Juven
29f8648ecc arm64: Initial implementation of CONFIG_BUILD_KERNEL
This is the initial version for kernel mode build on the arm64 platform.
It works much in the same way as the risc-v implementation so any
highlights can be read from there.

Features that have been tested working:
- Creating address environments
- Loading init (nsh) from elf file
- Booting to nsh
- Starting other processes from nsh
- ostest runs to completion

Features that are not tested / do not work:
- SHM / shared memory support
- Kernel memory mapping (MM_KMAP)
- fork/vfork

An example qemu target is provided as a separate patch:
tools/configure.sh qemu-armv8a:knsh
2024-08-23 10:26:34 -03:00
Ville Juven
7f228b1554 arm64/barriers.h: Generalize barrier macros
Make it possible to define arguments for barriers
2024-08-23 10:26:34 -03:00
Ville Juven
52781221b3 arm64_sync_exc: Use temporaries x9/x10 instead of x0/x1
Why? Because this allows optimizing the user system call path in such
a way that the parameter registers don't have to be read from the saved
integer register context when the system call is executed.
2024-08-23 10:26:34 -03:00
Windrow14
b27bf82b6e Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit|esp32s3-korvo-2: document update for sdmmc support
boards/xtensa/esp32s3/esp32s3-devkit|esp32s3-korvo-2/configs/sdmmc/defconfig: defconfig for sdmmc support

Add description for sdmmc support on esp32s3 in the board specific documentation.
Add defconfig for esp32s3-devkit with external adapter and emmc module.
Add defconfig for esp32s3-korvo-2 with SD slot enabled.

Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
2024-08-23 20:21:49 +08:00
wangchen
f0cdaca660 nuttx-names.in:add popen & pclose assign to glibc interface
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-23 20:20:25 +08:00
chao an
a0afd38f24 arm/spinlock: up_testset() sould not depends on SMP
up_testset() sould not depends on SMP

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-23 20:20:06 +08:00
gaohedong
12a44bd974 can: CAN code optimization
Some macro definitions have already been defined in other header files, redundant macro definitions have been removed in include/nuttx/can.h. Align some code. Remove no use struct (can_response_s) and some variables.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-23 20:18:17 +08:00
yinshengkai
7b02d788ef sched/signal: fix pthread_kill use after free
When a low-priority thread sends a kill signal to a high-priority thread,
the high-priority thread will exit and release tcb. When the thread returns
to the low-priority thread, it will access the released stcb.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 20:02:46 +08:00
chao an
aedef71070 sim/nsh: add nxevent into nsh demo
1. add nxevent into nsh demo
2. enable ostest

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-23 17:00:35 +08:00
chao an
75fac7dbc6 sched/nxevent: add support of kernel event group
Events groups are synchronization primitives that allow tasks to wait
for multiple conditions to be met before proceeding. They are particularly
useful in scenarios where a task needs to wait for several events to occur
simultaneously.

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-23 17:00:35 +08:00
Xu Xingliang
cfdbc856ff sim/lcd: fix compile break
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-08-23 15:26:16 +08:00
jianglianfang
a5afa11238 sim: Support to use of non-consecutive framebuffers
Some hardware devices use discontinuous framebuffers, which require SIM support for simulating discontinuous framebuffers.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-23 15:26:16 +08:00
wangchen
5fc016ef2d ipv6_frag.c:modify the type of the parameters to solve runtime error
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-08-23 15:23:19 +08:00
Yanfeng Liu
74080e8659 arm/qemu: use WFI to avoid busy loop
This adds WFI based up_idle() for arm/qemu to fix busy loop.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-23 15:09:44 +08:00
Matheus Catarino
93b520f7b0 swift6 embedded support 2024-08-23 09:02:20 +08:00
renjianguang
7ff17d0627 nuttx/audio: ap_buffer_s add nsamples Field for non-pcm formats
Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2024-08-23 08:57:00 +08:00
renjianguang
e655d8f992 nuttx/audio: Add amr and opus format control switches
Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2024-08-23 08:57:00 +08:00
renjianguang
87e24d13b4 nuttx/audio: add opus format support
Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2024-08-23 08:57:00 +08:00
yinshengkai
667de7be32 mutex: add nxrmutex_is_recursive api
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
a2b8c83e0e mutex: align nxmutex_breaklock interface with nxrmutex_breaklock
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
eee7cb6efa libc: nxmutex_clocklock abstime supports NULL pointer
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
01864d262c sched: add mutex_holder and mutex_clocklock API
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
4af6db7c80 mutex: remove mutex trylock holder check
The standard describes trylock as follows, trylock should never cause the system to stop running:

The pthread_mutex_trylock() function shall be equivalent to
pthread_mutex_lock(), except that if the mutex object referenced by
mutex is currently locked (by any thread, including the current thread),
the call shall return immediately.

https://linux.die.net/man/3/pthread_mutex_trylock

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:56:00 +08:00
yinshengkai
53ddc3ef7f arch/sim: suppress libasan checks
There is a false positive in asan of gcc-13, we need to mask it to ensure that other parts work properly

sanitizer_common/sanitizer_common_interceptors.inc:
   // FIXME: under ASan the call below may write to freed memory and corrupt
   // its metadata. See
   // https://github.com/google/sanitizers/issues/321.

==572161==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0xed3d3f00 at pc 0xef46af64 bp 0xed3d3de8 sp 0xed3d39bc
WRITE of size 128 at 0xed3d3f00 thread T0
     #0 0xef46af63 in __interceptor_pthread_sigmask ../../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4419
     #1 0x5486aa7d in up_irq_save sim/posix/sim_hostirq.c:97

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:53:52 +08:00
yinshengkai
0111cb73f1 sim: update sim_asan dependencies
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:53:52 +08:00
wangzhi16
bf957348ef [BugFix]Command "critmon" error
Command "critmon" has some format errors and information errors, such as:

PRE-EMPTION CALLER            CSECTION CALLER               RUN         TIME             PID   DESCRIPTION
1.679000000                   3.704000000
                         None None             0     CPU0 IDLE
0.002000000                   0.003000000
                         None None             1     CPU1 IDLE
0.000000000                   0.000000000
                         None None             2     CPU2 IDLE
0.000000000                   0.000000000
                         None None             3     CPU3 IDLE
0.001000000                   0.001000000
                         None None             4     hpwork
0.002000000                   0.006000000
                         None None             5     nsh_main
0.000000000                   0.000000000
                         None None             6     critmon

After bug fix:

PRE-EMPTION CALLER            CSECTION CALLER               RUN              TIME             PID   DESCRIPTION
None                          None                          ---------------- ---------------- ----  CPU 0
None                          None                          ---------------- ---------------- ----  CPU 1
None                          None                          ---------------- ---------------- ----  CPU 2
None                          None                          ---------------- ---------------- ----  CPU 3
None                          None                          0.238000000      6.982000000      0     CPU0 IDLE
None                          None                          0.461000000      13.089000000     1     CPU1 IDLE
None                          None                          0.000000000      0.000000000      2     CPU2 IDLE
None                          None                          0.000000000      0.000000000      3     CPU3 IDLE
None                          None                          0.000000000      0.001000000      4     hpwork
None                          None                          0.000000000      0.010000000      5     nsh_main
None                          None                          0.000000000      0.000000000      46    critmon

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2024-08-23 08:53:15 +08:00
yinshengkai
9694760eb8 input: fix touchevent race condition
In touch_event, circbuf is operated, and there is a lack of protection here.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:52:23 +08:00
yinshengkai
272248de37 libc: compile stackchk function by default
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:51:54 +08:00
yintao
279a676978 syslog_rpmsg: Ensure the syslog ept is ready when rpmsg_send
Signed-off-by: yintao <yintao@xiaomi.com>
2024-08-23 01:43:09 +08:00
zhanghongyu
355742bd9b Documentation/sim: add cdcmbim examples
We can send and receive data through device files
nuttx: /dev/cdc-wdm2
linux: /dev/cdc-wdm1
The number suffix depends on the actual situation.

And send and receive messages through network cards.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-22 09:51:20 -03:00
Yongrong Wang
f55270f15b rpmsgfs: fix out of bounds access caused by data transmission farmat
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-08-22 20:25:49 +08:00
guohao15
94e9599e5c file_lock:fix memory alloc/free not match
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:25:30 +08:00
guohao15
76a1a5b2c4 inotify:fix memory alloc/free not match
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:25:30 +08:00
guohao15
c63adb5c14 hcreate: add alloc/free func hook for user to deallocate memory
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:25:30 +08:00
guohao15
43bcac952a tmpfs: old data was loaded when SEEK_SET beyond end of the file
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:25:03 +08:00
guohao15
7f16770b91 bch:alloc bch->buffer when offset not aligned
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 20:24:13 +08:00
guohao15
458bab9ae7 fix:uart_rpmsg_dmareceive data copy to nbuffer should start from data + length
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 09:23:12 -03:00