summaryrefslogtreecommitdiff
path: root/components/lwp
AgeCommit message (Collapse)Author
2025-05-19[smart] Add vDSO support for RISC-V architecture and refactor related componentsbernard
- Implemented vDSO functionality for the RISC-V architecture, including the necessary source files and linker scripts. - Introduced a new `vdso_sys.c` file for RISC-V, containing functions to handle time retrieval using the vDSO mechanism. - Created architecture-specific linker scripts (`vdso.lds.S`) for both AArch64 and RISC-V. - Updated the build system to support vDSO compilation for RISC-V, including necessary adjustments in `SConstruct` files. - Refactored existing vDSO code to improve compatibility and maintainability across architectures. - Adjusted the maximum number of PTY devices in the terminal configuration from 64 to 32 for better resource management. - Fixed minor issues in existing code, including correcting the path for the vDSO shared library and ensuring proper function definitions.
2025-05-09[component/lwp]add annotation for lwp elf. (#10230)Guorui Li
* [component/lwp]add annotation for lwp elf. * Update components/lwp/lwp_elf.c Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
2025-04-13add RT_THREAD_CTRL_SET_PRIORITYwycwyhwyq
2025-04-13add RT_THREAD_CTRL_SET_PRIORITYwycwyhwyq
2025-02-25feat: mm: added affinity pages allocatorShell
This patch introduces a tagged pages allocator to address the existing problems of page aliasing on specific platforms and the requirement of page coloring. It implements an affinity-id aware page manager by separating the runtime page list into two types: a normal single linked-list and a multi-dimensional affinity-list. Changes: - Introduced tagged pages allocator and managing algorithm for affinity pages list - Modified components to support affinity-id list management - Updated page allocation and freeing functions to handle tagged pages - Added configuration options for page affinity block size and debugging - Modified mmap and elf loading to respect affinity settings - Enhanced page list management to support multi-dimensional affinity-list Signed-off-by: Shell <[email protected]>
2025-02-24[lwp/riscv]修正用户态参数空间占用堆地址空间的问题 (#10014)heyuanjie87
* [lwp/riscv]修正用户态参数空间占用堆空间的问题
2025-02-18[lwp]add comments for lwp system calls. (#9934)Guorui Li
2025-02-18[lwp]检查killpg的signo参数的有效性 (#9981)heyuanjie87
* [lwp]对检查killpg的signo参数的有效性
2025-02-08[lwp]修正kill(pid < -1)时的返回值错误heyuanjie87
2025-01-21[lwp]修正无法通过文件名查找pid的问题 (#9935)heyuanjie87
2025-01-16lwp: Kconfig: LWP_DEBUG default as n (#9921)Chen Wang
LWP_DEBUG is debugging related, should be disabled by default. Signed-off-by: Chen Wang <[email protected]>
2025-01-08fix: add \n for addr2line hintMeco Man
2025-01-06feat: add support for dfs remount functionalityShell
This patch introduces a remount feature for the DFS, allowing for the modification of mount parameters without unmounting the filesystem, the remount functionality helps modify certain mount flags (like `MS_RDONLY`) without requiring an unmount, providing more control over mounted filesystems in the system. The updates is essential for user space init proc to cleanup the runtime resource, ensuring clean handling of cached data and enhancing system robustness during power down processing. Changes: - Defined new constants for remount flags in `dfs_fs.h`. - Added the `dfs_remount()` function in `dfs_fs.c` to handle remount operations. - Introduced a check for unsupported flags and handle error conditions such as invalid paths or non-directory targets. - Updated the `dfs_mnt` structure in `dfs_mnt.h` to include a read-only flag (`MNT_RDONLY`). - The `dfs_remount()` function allows changing the read-only status of a mounted filesystem. - Added `MNT_LAZY_UMNT` and `MNT_RDONLY` flags to `dfs_mnt` structure. - Introduced `dfs_mnt_setflags` function for dynamic flag management. - Updated `dfs_remount` to utilize `dfs_mnt_setflags` for flag setting. - Enhanced unmount operations with `dfs_mnt_umount_iter` and lazy unmounting. - Added `dfs_pcache_clean` to handle cache cleanup for read-only mounts. - Improved error reporting in `dfs_umount` for better user feedback. - Refactored `sys_mount` to streamline parameter handling and support remounts. - Introduced `_cp_from_usr_string` helper for user-space string operations. - Updated internal APIs to ensure consistency in reference count management. Signed-off-by: Shell <[email protected]>
2025-01-06feat: add system reboot and process teardown supportShell
The patch introduces support for system reboot functionality and process teardown, allowing for a clean shutdown and unmounting of the root filesystem. This is necessary for ensuring a proper system shutdown process, especially when dealing with resource cleanup and ensuring that all processes have exited before system shutdown. Changes: - Added `lwp_teardown()` function to handle process cleanup and system teardown. - Introduced `lwp_pid_wait_for_empty()` to wait for process ID table emptiness before proceeding with shutdown. - Updated `dfs_mnt_unref()` to trigger callbacks when unmounting a filesystem. - Added new reboot types (`RB_AUTOBOOT`, `RB_POWER_OFF`) and implemented their corresponding actions, including cleanup of processes and unmounting root filesystem. - Extended `sys_reboot()` to handle reboot and power off types with appropriate callbacks for process and filesystem teardown. - Introduced callback mechanism for root filesystem unmount notifications. Signed-off-by: Shell <[email protected]>
2025-01-06feat: add universal process runtime serviceShell
This change introduces the `lwp_runtime.c` component, which provides the necessary runtime environment for the init process, including boot scripts, shutdown, and poweroff functionalities. The initialization logic has been moved from `lwp.c` to this new file, enhancing modularity and flexibility in handling LWP runtime tasks. Changes: - Moved the `lwp_startup` function from `lwp.c` to `lwp_runtime.c` to handle system initialization and runtime environment setup. - Added `lwp_teardown` placeholder for system shutdown and cleanup tasks in the future (though not yet implemented). - Introduced the `LWP_USING_RUNTIME` configuration option in `Kconfig` to conditionally enable the runtime environment. - Updated the `SConscript` to conditionally include `lwp_runtime.c` based on the `LWP_USING_RUNTIME` configuration. - Removed the old `lwp_startup` code from `lwp.c`, simplifying the file. Signed-off-by: Shell <[email protected]>
2025-01-06feat: add signal kill all functionalityShell
This change introduces the `lwp_signal_kill_all` function, which allows a signal to be sent to all processes in the system. The function iterates over all PIDs and sends the specified signal to each process, except those that are protected from signals. This enhancement provides a convenient way to broadcast signals across all processes in the system. Changes: - Added `lwp_signal_kill_all` function in `lwp_signal.c` to broadcast a signal to all processes by iterating over all PIDs using the existing `lwp_pid_for_each` function. - Introduced a new `kill_all_param` structure to encapsulate the signal information needed for killing processes. - Added internal `_kill_each` helper function for sending the signal to each PID. - Updated `lwp_signal.h` with the new function prototype for `lwp_signal_kill_all`. - Modified `sys_kill` in `lwp_syscall.c` to call `lwp_signal_kill_all` when a process is not specified. Signed-off-by: Shell <[email protected]>
2025-01-06feat: support PID iterationShell
This change introduces the `lwp_pid_for_each` function, which provides a convenient and thread-safe method for iterating over PIDs with a user- defined callback. This addition is necessary to support cases where operations must be performed on each PID in the balanced tree, enhancing flexibility and modularity for PID management. Changes: - Added `lwp_pid_for_each` function in `lwp_pid.c` to allow iteration over PIDs using a callback function and optional data parameter. - Defined a new internal `pid_foreach_param` structure to encapsulate the callback and data for the iteration. - Added `_before_cb` helper function for executing the callback on each PID node during AVL traversal. - Ensured thread safety by acquiring and releasing the PID lock around the AVL traversal within `lwp_pid_for_each`. - Updated `lwp_pid.h` with the `lwp_pid_for_each` function prototype and included `rtthread.h` for necessary types. Signed-off-by: Shell <[email protected]>
2024-12-20kernel: cleanup debug APIsChen Wang
- `dbg_log` is a “NOT RECOMMENDED API”, convert the calling of this API to LOG_x and remove this API. - `dbg_here`/`dbg_enter`/`dbg_exit`: no one use these APIs, remove them directly. Signed-off-by: Chen Wang <[email protected]>
2024-12-17[serial] add bypass testcase in utestzhujiale
2024-12-12[lwp] fix TTYSUP_CFLAG did not include CBAUD flagzhujiale
2024-11-17Modify the position of libc_rent definitionrcitachi
2024-11-12fixup: smart: uninitialized buffer on mount(2) (#9636)Shell
The `struct stat` object used inside mount(2) is uninitialized, which can lead to undefined behavior during running Changes: - Set zero to buffer before calling to stat() Signed-off-by: Shell <[email protected]>
2024-11-01[libc] modify function names to resolve naming conflictsrcitachi
2024-10-21fixup: smart: sys_mount: UAF vulnerabilityShell
This patch addresses a use-after-free (UAF) vulnerability in the sys_mount. The issue occurred due to improper handling of memory deallocation, which could lead to crashes or undefined behavior on user request of mounting. Changes made: - Moved the `rt_free(copy_source)` function call to occur after the necessary operations are completed, preventing premature deallocation of memory. Signed-off-by: Shell <[email protected]>
2024-09-19feat: smart: user space context optimizationShell
This patch optimizes the user-space context handling in the ARM64 architecture, specifically improving how the context is saved and restored during system calls and interrupts. The changes make the code more efficient and easier to maintain, while ensuring proper preservation of user context during system transitions. Changes: - Introduced a parameter for context saving to improve flexibility. - Replaced hardcoded stack pointer operations with frame-relative references for better readability and code reuse. - Simplified context restoration, removing redundant operations like loading/storing floating-point registers. Signed-off-by: Shell <[email protected]>
2024-09-19fixup: pty: possible memory leaking on close()Shell
The ref_count of the vnode is NOT bound to the resource reference counts of the ptm device created by opening `dev/ptmx`, so the conditional release of resource may end up by memory leaking if the multiple user have open the `dev/ptmx`. Changes: - Removed conditional branch on recycling resource Signed-off-by: Shell <[email protected]>
2024-09-14fixup: smart: remove unnecessary Kconfig optionShell
The `LWP_CONSOLE_INPUT_BUFFER_SIZE` is a legacy config option for TTY driver used in smart. Since the driver is updated, there's no dependency of this option any more. Changes: - Removed unused Kconfig option `LWP_CONSOLE_INPUT_BUFFER_SIZE` Signed-off-by: Shell <[email protected]>
2024-09-13[component][net]add more socket flagzms123456
2024-09-13[lwp] 取消脚本中限制rv的具体cpu类别heyuanjie87
此目录中为rv64通用代码
2024-09-11[components][lwp]remove extra check in sys_bindzms123456
2024-09-01fixup: ptyfs: CI reported snprintf type issuesShell
2024-08-25【修复】修复link系统调用返回值问题zhuzhuzhu
2024-08-25【修复】修复rmdir系统调用返回值不符合用户预期问题zhuzhuzhu
2024-08-25【修复】修复symlink系统调用返回值不是预期问题zhuzhuzhu
2024-08-24fixup: uninitialized argument vector elementShell
This patch addresses the potential issue of uninitialized elements in the argument vector returned by `lwp_get_command_line_args()`. The previous implementation could leave `argv` in an inconsistent state if certain errors occurred, leading to possible undefined behavior. Changes: - Replaced `rt_malloc()` with `rt_calloc()` to ensure `argv` is properly initialized. - Added a consistent error handling path using `goto error_exit` to handle memory allocation failures and string copy errors. - Ensured `lwp_free_command_line_args()` is called before returning on error, preventing potential memory leaks. Signed-off-by: Shell <[email protected]>
2024-08-24fix_return_errzhujiale
2024-08-22[lwp] Implementation of setpgrp and fix mmap2 problems (#9308)rcitachi
* mmap2 failure handling 当传入一个非常大的地址时,offset会计算得到一个值,又因为传入的地址错误,rc会得到错误码,结合offset会得到一个很奇怪的值。 * Implementation of setpgrp 执行setpgrp会走到这一步,在执行getpgrp无法得到创建的group的值 * Modify the return method of mmap
2024-08-22[lwp][tid]add error log when tid depleted, and return correct errno when ↵zms123456
clone failed (#9327) add error log when tid depleted, and return correct errno when clone failed
2024-08-22[components][lwp]fix mount param issue (#9333)zms123456
fix mount param issue
2024-07-29fixup: compiler warning on cvitek risc-v cause by unsupport vDSO on rv64Shell
Signed-off-by: Shell <[email protected]>
2024-07-24Merge pull request #9212 from polarvid/shell/opt-gctxBernard Xiong
[libcpu] trimming ARM64 general context
2024-07-18[libcpu/arm64] feat: Trimming General ContextShell
This patch focuses on the ARM64 general context handling code. The modifications are aimed at enhancing performance by simplifying context save/restore operations. Changes include: - Adjusted stack alignment in `arch_set_thread_context` function. - Updated `lwp_gcc.S` to reset frame pointer and link register. - Refined `rt_hw_backtrace_frame_unwind` to handle user space address checks. - Added `GET_THREAD_SELF` macro in `asm-generic.h`. - Simplified context saving/restoring in `context_gcc.h` and related files. - Optimized `rt_hw_context_switch_interrupt` and related assembly routines. Signed-off-by: Shell <[email protected]>
2024-07-18fix exec and mount error codezhao maosheng
2024-07-16[smart] feat: add unmap for null mapper (#9186)Shell
Do unmap before shrink so we don't see mapped entry on page table insertion, which is not acceptable for riscv implementation of architecture porting. Changes: - add un-mapping of pte on `_null_shrink()` Signed-off-by: Shell <[email protected]>
2024-07-15[lwp][vdso] Add VDSO functionality under the aarch64 architecture (#9176)rcitachi
Add VDSO functionality under the aarch64 architecture
2024-06-28[format] cleanup libcpu/aarch64 (#8950)Shell
* [dfs] fixup compiler warning Signed-off-by: Shell <[email protected]> * [format] libcpu/arm64: separate context switching codes Signed-off-by: Shell <[email protected]> * [format] libcpu/arm64: separate vector Signed-off-by: Shell <[email protected]> * [format] libcpu/arm64: separate context_gcc.S Signed-off-by: Shell <[email protected]> * [format] libcpu/arm64: moving headers to include directory Signed-off-by: Shell <[email protected]> * style: replace tab with space --------- Signed-off-by: Shell <[email protected]>
2024-06-24[rv]修正signal退出后用户态sp少8的问题 (#9080)heyuanjie87
2024-06-22[smart] add mprotect config (#9082)Shell
Signed-off-by: Shell <[email protected]>
2024-06-21[rv]信号处理进入用户态前恢复gp (#9072)heyuanjie87
* [rv/virt/stackframe.h]添加GP寄存器保存偏移量宏 * 【rv/c906/stackframe.h]定义GP寄存器存储偏移量 * [rv]信号处理切换到用户态前恢复gp
2024-06-20除了bsp之外的Kconfig使用rsource替代sourcelatercomer