Commit Graph

56204 Commits

Author SHA1 Message Date
dongjiuzhu1 47478e543d fs/shm: support shm_open with flags O_TRUNC
testcase:
https://fossies.org/linux/posixtestsuite/conformance/interfaces/shm_open/25-1.c

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-10-31 18:47:51 -03:00
cuiziwei d1e5b38b9b nuttx/semaphore: Move define CONFIG_SEM_PREALLOCHOLDERS to include/semaphore.h.
Move CONFIG_SEM_PREALLOCHOLDERS to include/semaphore.h to avoid undefined issues from occurring in other places as well.

Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-31 18:37:53 +08:00
wangmingrong1 fbaace01d0 libc/arch_libc: replace all arch define to ARCH_LIBCFUN(x) style
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-31 18:11:16 +08:00
wangmingrong1 b22e8c7c1c libc: Modify the check length
We should not check the length of both strings at the same time.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-31 18:11:16 +08:00
wangmingrong1 e466c637fc arch_lib.c: close kasan readcheck no return
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-31 18:11:16 +08:00
anjiahao 22e5c88479 libs/machine:strnlen need check return
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-31 18:11:16 +08:00
anjiahao 603c87977f libc/machine:Add prefixes to libc functions implemented by arch
kasan does not instrument the assembly function,
so it is checked in advance before calling.
If Kasan is not turned on, the speed and space will
be almost unchanged under compiler optimization.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-31 18:11:16 +08:00
xuxin19 6ee73bc199 cmake(bugfix):fix libc sysclog CMake build typo
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-31 17:55:13 +08:00
xuxin19 1fb8a64299 cmake:add cmake host tool mkdeps incdir
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-31 17:55:13 +08:00
xuxin19 b8523280c2 cmake(bugfix):fix cxx build error on fastDDS X86_64
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-31 17:55:13 +08:00
xuxin19 8da0206a40 cmake:fix sim gc-section option build failed
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-31 17:55:13 +08:00
Jukka Laitinen da19d79656 arch/arm64/src/imx9/imx9_lpuart.c: Fix parity get in TCGETS
This is a partial revert / fix for regression from 44d1811ebb

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-31 17:54:22 +08:00
YAMAMOTO Takashi 94a13982eb DNS: Implement TCP fallback
* Implement DNS query over TCP

* Implement TCP fallback on responses with the TC bit set

References:

* https://www.ietf.org/rfc/rfc2181.txt

* http://www.dnsflagday.net/2020/

* https://www.netmeister.org/blog/dns-size.html
2024-10-31 17:18:20 +08:00
chenrun1 9a75519edc timer_create:Checks whether the signo provided by the user is valid
Summary:
  When the user sets an illegal signo, the error will only be known when timer_signotify is triggered during timeout.
By intercepting timer_create, we can directly locate the problem

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-10-31 17:16:12 +08:00
hujun5 9b1800d043 irq: force inline up_interrupt_context
reason:
Replace "inline" with "inline_function" for "up_interrupt_context" to ensure consistency with other arch

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-10-31 15:43:41 +08:00
wangmingrong1 2b2f530e7c mm: Complete remaining unused macros instead of memory to fill tags
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-31 15:35:26 +08:00
yintao 265978d16a net/rpmsg: Don't set POLLHUP if rpmsg channel has not been established
Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-31 15:35:03 +08:00
zhanghongyu d5d9c501fa tcp_input: if tcp->req > recvreq, send ack only when state is TCP_ESTABLISHED
we will drop packet when tcp_close_eventhandler
is register and invoke by tcp_input. then we will always early return and
never stop, the peer will only close the connection if we send reset packet.

precondition:
close -> register tcp_close_eventhandler;

tcp_input -> tcp_callback(TCP_NEWDATA) -> devif_conn_event -> tcp_close_eventhandler
-> flags &= ~TCP_NEWDATA -> NOT entry tcp_data_event -> conn->recvreq NOT increase

old flow:
tcp_input -> tcp->seqno greater than conn->rcvseq -> tcp_send(TCP_ACK)

with this patch:
tcp_input -> tcp->seqno greater than conn->rcvseq -> !TCP_ESTABLISHED
-> case TCP_FIN_WAIT_1 -> dev->d_len greater than 0 -> tcp_reset

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-31 15:31:01 +08:00
haopengxiang 417f5f425b tools/mkdeps: increase MAX_BUFFER from 16384 to 65536
Signed-off-by: haopengxiang <haopengxiang@xiaomi.com>
2024-10-31 08:55:07 +08:00
Filipe Cavalcanti a15b82defa risc-v/esp32c3: add brownout to flash section 2024-10-31 08:53:12 +08:00
Filipe Cavalcanti 59a03d7ec3 risc-v/esp32c3: linker script fix for mcuboot + wifi usage
Revert "risc-v/esp32c3: linker script fix for mcuboot + wifi usage"

This reverts commit 3de5d2021b3a4c5fb506863f7b4763b57f038432.

Testing no brownout detector

Reenabled brownout
2024-10-31 08:53:12 +08:00
Ville Juven f36dff8105 riscv/syscall: Fix sched_note instrumentation for BUILD_KERNEL
The sched_note calls were missing from riscv_perform_syscall().
2024-10-30 23:18:07 +08:00
Karel Kočí b851916d76 libs/libc/obstack: fix allocated chunk overrun due to invalid limit
This primarily fixes allocated memory overrun due to invalidly
calculated limit of the chunk. The function here allocates chunk of size
that includes required header. The error was that size of the chunk was
invalidly again added when limit was being calculated. This was causing
memory overrun and issues especially with object growing (reallocation).

The secondary fix here is to the algorithm that rounds the required size
to the multiple of chunk size. In short chunk size must be reduced by
one to get the correct mask. The condition that was generating the mask
was also invalid because it must perform shift with at most one less
than number of bits (not bytes).
2024-10-30 11:53:18 -03:00
xuxin19 36b891c1e1 cmake(bugfix):fix fs cmake typo
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-30 22:14:40 +08:00
xuxin19 92dddcda8a tools/refresh.sh:skip config check on debug configs
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-30 22:14:40 +08:00
xuxin19 4595f9388f tools/Unix.mk:make incdir precedence over other targets
Make.defs need incdir at the very beginning.
fix error such as `make menuconfig` `make oldconfig` etc.

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-30 22:14:40 +08:00
xuxin19 e60c60b691 cmake(sync):fix cmake SIM build error build nuttx upstream
/usr/lib/x86_64-linux-gnu/libSM.so  /usr/lib/x86_64-linux-gnu/libICE.so  /usr/lib/x86_64-linux-gnu/libX11.so  /usr/lib/x86_64-linux-gnu/libXext.so  -lpthread  -lrt  -lm  -lasound  -lmad  -lv4l2 && :
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libSM.so: error adding symbols: file in wrong format

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-30 22:14:40 +08:00
xuxin19 c60b980968 cmake(bugfix):fix robot openlibm cmake build missing source error
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-10-30 22:14:40 +08:00
Ville Juven 9d4218666c mpfs/smp: Add riscv_macros to mpfs_shead
To get definition for riscv_set_inital_sp macro
2024-10-30 22:09:01 +08:00
chenrun1 759b77b975 nuttx/atomic.h:Add use condition for using stdatomic.h
Summary:
  add check !defined(__STDC_NO_ATOMICS__)
  If the macro constant __STDC_NO_ATOMICS__(C11) is defined by the compiler, the header <stdatomic.h>, the keyword _Atomic, and all of the names listed here are not provided.

  refer to:https://en.cppreference.com/w/c/atomic

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-10-30 21:29:04 +08:00
zhanghongyu c11752e59f arp.h: make struct arpreq four-byte aligned
avoid memory waste in 64-bit architectures.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-30 21:10:46 +08:00
wangmingrong1 8461f0ea54 clang: Support compiling rt.profile library
1. Since the implementation of gcov has changed since clang17, versions before clang17 need to use the libunwind.a file

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-30 17:10:23 +08:00
YAMAMOTO Takashi 761ee81956 move readv/writev to the kernel
currently, nuttx implements readv/writev on the top of read/write.
while it might work for the simplest cases, it's broken by design.
for example, it's impossible to make it work correctly for files
which need to preserve data boundaries without allocating a single
contiguous buffer. (udp socket, some character devices, etc)

this change is a start of the migration to a better design.
that is, implement read/write on the top of readv/writev.

to avoid a single huge change, following things will NOT be done in
this commit:

* fix actual bugs caused by the original readv-based-on-read design.
  (cf. https://github.com/apache/nuttx/pull/12674)

* adapt filesystems/drivers to actually benefit from the new interface.
  (except a few trivial examples)

* eventually retire the old interface.

* retire read/write syscalls. implement them in libc instead.

* pread/pwrite/preadv/pwritev (except the introduction of struct uio,
  which is a preparation to back these variations with the new
  interface.)
2024-10-30 17:07:54 +08:00
wangmingrong1 e3d7d23618 gcov: Fix typographical errors
1. CONFIG_ARCH_COVERAGE has been replaced by CONFIG_SCHED_GCOV
2. Delete the SIM-specific GCOV_ALL configuration and change it to a universal configuration for all architectures

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-30 14:45:23 +08:00
yezhonghui 27685aa179 Fix config repeat define in include deconfig mode
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-10-30 12:29:56 +08:00
anjiahao 2dcd300a3c coredump.py:bug fix python file not have rename
tmpfile.rename(args.output)
    ^^^^^^^^^^^^^^
AttributeError: '_io.BufferedRandom' object has no attribute 'rename'. Did you mean: 'name'?

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-30 12:29:22 +08:00
Yanfeng Liu f6facf7602 mm/mm_memalign: add debugging log
This adds debugging log support for mm_memalign to help track memory
issues via logs.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-10-30 08:40:32 +08:00
zhangyuan29 befe29801f sem: change sem wait to atomic operation
Add sem_wait fast operations, use atomic to ensure
atomicity of semcount operations, and do not depend
on critical section.

Test with robot:
before modify:
nxmutex_lock cost: 78 ns
nxmutex_unlock cost: 82 ns

after modify:
nxmutex_lock cost: 28 ns
nxmutex_unlock cost: 14 ns

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-10-30 01:38:45 +08:00
nuttxs 0c5381a0a1 xtensa/esp32s3: add esp32s3 reset reasons interface 2024-10-29 23:03:37 +08:00
Gao Feng 782ab3b248 xtensa/esp32s3: enable encrypted flag based on partition and device
If device encryption is not enabled by eFuse, and partiton mark as
encrypted flag, then encrypted MTD is used.

That is no problem in write and read operation, but failed while
using spi_flash_mmap(...) since de-encrypt is not processed.

So, back to use non-encrypted MTD following API Guide:
If flash encryption is not enabled, the flag "encrypted" has no effect
2024-10-29 23:02:35 +08:00
ligd 4541132035 Revert "shced:sem: replace mutex with spinlock"
Cause we can't do sem_post/wait within spinlock

This reverts commit 23d65cb97f.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-29 23:01:39 +08:00
cuiziwei d42f16939e nuttx: Fix build warning with can't found xt-g++
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-10-29 22:27:58 +08:00
Jukka Laitinen 62194400f9 imx9/serial: Take proper use of RX/TX FIFOs, clean up interrupt service routine
- i.MX93 LPUARTs have 16-byte RX and TX FIFOs. Take those into use and correct some related register definitions
- There is no reason to loop inside interrupt handler, remove the looping

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-29 22:24:48 +08:00
Jukka Laitinen 44d1811ebb imx9/serial: Clean up the flow control code
- Remove GPIO (SW) based flow control. It didn't work, and pure HW flow control seems to work fine
- Remove some unneeded ifdefs and change bit-field flags to booleans to clean up the code

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-29 22:24:48 +08:00
wangmingrong1 083f9d162e clang/ld.lld: clang17 and above support the option --print-memory-usage
1. cmake uses clang++ as a connector, and does not currently support:
	clang++: error: unknown argument: '-wl,--print-memory-usage'
	clang++: error: no input files

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-10-29 20:43:35 +08:00
zhanghongyu c22b39d8d7 arp.h: make struct arpreq four-byte aligned
current sizeof(struct sockaddr_in) is 66

arp/arp_table.c:241:28: runtime error: member access within misaligned address 0xe5f134e6 for type 'struct sockaddr_in', which requires 4 byte alignment
0xe5f134e6: note: pointer points here
 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00
             ^
    #0 0x543287c1 in arp_get_arpreq arp/arp_table.c:241
    #1 0x5432a11f in arp_snapshot arp/arp_table.c:574
    #2 0x5435f0be in netlink_fill_arptable netlink/netlink_route.c:547
    #3 0x5435ffca in netlink_get_neighbor netlink/netlink_route.c:715
    #4 0x54360116 in netlink_get_neighborlist netlink/netlink_route.c:743
    #5 0x54363b20 in netlink_route_sendto netlink/netlink_route.c:1382
    #6 0x542ef1b1 in netlink_sendmsg netlink/netlink_sockif.c:625
    #7 0x542be94d in psock_sendmsg socket/sendmsg.c:96
    #8 0x542bc94b in psock_sendto socket/sendto.c:134
    #9 0x542bcb28 in sendto socket/sendto.c:247
    #10 0x542bc5ea in send socket/send.c:163
    #11 0x542aa715 in netlib_get_arptable /home/mi/gaofengzhi/code/dev1025/apps/netutils/netlib/netlib_getarptab.c:152
    #12 0x54279109 in cmd_arp /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_netcmds.c:1197
    #13 0x54257faf in nsh_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_command.c:1263
    #14 0x54231982 in nsh_execute /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:718
    #15 0x5423da42 in nsh_parse_command /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2619
    #16 0x5423e12a in nsh_parse /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_parse.c:2706
    #17 0x5424088f in nsh_session /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_session.c:245
    #18 0x5422efc9 in nsh_consolemain /home/mi/gaofengzhi/code/dev1025/apps/nshlib/nsh_consolemain.c:75
    #19 0x5419e89f in nsh_main /home/mi/gaofengzhi/code/dev1025/apps/system/nsh/nsh_main.c:74
    #20 0x54067ee1 in nxtask_startup sched/task_startup.c:70
    #21 0x53f366c6 in nxtask_start task/task_start.c:116
    #22 0x5409e1a4 in pre_start sim/sim_initialstate.c:52

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-29 20:43:15 +08:00
zhanghongyu 306cb3301b include/netinet/if_ether.h: add ethhdr definition.
adapts to third-party code compilation. in the process of porting EtherCAT,
we encounter some situations where the structure is not defined, or the
returned data types do not match the expectations. Refer to the EtherCAT
implementation of other systems and add relevant definitions.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-10-29 18:13:35 +08:00
zhangshoukui 198dd93713 shmfs: return EINVAL if group null
Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-10-29 18:11:33 +08:00
zhangshoukui 646bf48ed2 shmfs: Assign a variable when object is not null
Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-10-29 18:11:33 +08:00
chao an 20e03f50cf toolchain/tasking: fix build break on tasking toolchain
1. Tasking only support preprocess link script on linker phase
2. Remove executable suffix (.elf)

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-29 18:11:04 +08:00