Commit Graph

13215 Commits

Author SHA1 Message Date
Kinsey Moore
3d8b56f10c cpukit/libdebugger: Prevent hang on memory access
When memory is accessed by the remote debugging client, the access is
sandboxed with setjmp/longjmp and appropriate exception handlers to
prevent the attempted access from causing a failure of the debugger or
otherwise altering execution. The existing implementation works as
expected when the context executing the memory access and the exception
context resulting from a failed access do not share a stack.

In the case of AArch64, a failed access when the debugger is already in
exception context causes a re-entry into exception context where the
machine state is pushed onto the same stack that was in use where the
exception occurred. When setjmp is called inside a stack frame and the
exception occurs outside that stack frame, the stack frame is unwound
before the exception occurs and the exception entry overwrites the area
previously occupied by the stack frame housing the setjmp and corrupting
the link register that is stored there. After restoration of state using
longjmp(), this corrupted link register information is loaded from the
stack frame and undesired behavior occurs.

In the instance of this bug that was encountered, the corrupted link
register contained an unaligned pointer which caused an unending cascade
of prefetch abort exceptions presenting as a hard hang.

Closes #5273
2025-06-18 13:53:35 -05:00
Chris Johns
6335d7e48a machine/timecounters: Add missing _Timecounter_ decls
Add:

 - _Timecounter_Getboottime
 - _Timecounter_Getboottimebin

Closes #5212
2025-05-09 08:37:01 +10:00
Chris Johns
f769b20c98 cpukit/libdl: Fix loading symbols from an object file at runtime
- Assume a relocation record with a symbol name with a length of
  0 is resolved. ARM seems to create a symbol with no name for
  R_ARM_V4BX relocation records.

- Move the addition of the rtems_rtl_base_sym_global_add symbol
  to the global symbol table to the weak
  rtems_rtl_base_global_syms_init call. If symbols are
  embedded the support for runtime loading symbols is over
  loaded. This change is required so the base object has a
  valid global symbol table attached to track dependencies.

Fixes #5234
2025-04-01 12:31:32 +11:00
Jan Sommer
9641e1e97d cpukit/termios: Fix ordering of baud rate table
rtems_termios_set_best_baud expects a sorted baud rate table.

Fixes #5202
2025-02-03 12:04:33 -07:00
Zhaoyue Wang
603c168a0b cpukit/libmisc: fix flag in capture.c
The RTEMS_CAPTURE_OVERFLOW is an overflow flag for each CPU, and its
value is the same as RTEMS_CAPTURE_INIT. Executing rtems_capture_flush
will set the RTEMS_CAPTURE_INIT flag to 0 in the global flags.

Fixes #5184.
2025-01-23 23:45:01 +00:00
Ranulfo Raphael
84c2cf3da9 cpukit/libdl/arm: Fix trampoline alignment
This commit aligns trampolines for THUMB and ARM instructions
(CALL/JUMP24 and THM_JUMP24/THM_PC22).

According to the ARM technical reference in section "Register-relative
and PC-relative expressions":
    In Thumb code:
    - For B, BL, CBNZ, and CBZ instructions, the value of the PC is the
      address of the current instruction plus 4 bytes.
    - For all other instructions that use labels, the value of the PC is
      the address of the current instruction plus 4 bytes, with bit[1]
      of the result cleared to 0 to make it word-aligned.

Closes #5189
2025-01-23 19:38:05 -03:00
Sebastian Huber
34ba74f4f4 score: Fix RTEMS_DEBUG build
Close #5159.
2025-01-08 06:41:12 +01:00
Sebastian Huber
e79dc64c8e rtems: Remove pre-qualified constraints
The pre-qualified constraints are not applicable to mainline RTEMS.
2024-11-27 04:47:26 +01:00
Sebastian Huber
7f00921b07 score: Support scheduler change inhibitors
For example, the POSIX sporadic server adds a second priority to a
thread.  We cannot account for this priority in a scheduler change.

Update #5164.
2024-11-27 02:17:14 +00:00
Sebastian Huber
63c5d062c3 score: Fix _Thread_Priority_change()
The POSIX sporadic server may temporarily remove the real priority of a
thread.  Check that the priority node is active before the change is
propagated.

Update #5164.
2024-11-27 02:17:14 +00:00
Sebastian Huber
65e480312c posix: Use real priority for sporadic server state
This allows to other areas to use the real priority node state.

Update #5164.
2024-11-27 02:17:14 +00:00
Kinsey Moore
106d00537e posix/lio_listio: corrected addition of system event
Previously the system event used by lio_listio was manually added to
event.h and not using rtems-central. This patch corrects that and renames
the event to make it clearer.

Some related dead code has also been removed.


(cherry picked from commit cabc8c3a78)

Co-authored-by: alessandronardin <ale.daluch@gmail.com>
2024-11-26 19:42:12 +00:00
Chris Johns
c529694656 cpukit/jffs2/rtime: Fix off-by-one error in decompression check
Closes #5072


(cherry picked from commit abaea2b798)

Co-authored-by: Kinsey Moore <kinsey.moore@oarcorp.com>
2024-11-22 02:22:32 +00:00
Chris Johns
4a00b66bc6 cpukit/libdl/riscv: Fix warnings
Updates #5144
2024-11-22 00:13:36 +00:00
Gedare Bloom
24c964e83c confdefs: do not CONFIGURE_FILESYSTEM_NFS in ALL
Fixes #5118.
2024-11-22 00:03:19 +00:00
Sebastian Huber
e661f400e2 score: Fix _Thread_Priority_apply()
Properly serialize explicit thread priority changes (for example
rtems_task_set_priority()) and thread priority changes carried out by
thread queues (locking protocols such as priority inheritance).

Update #5159.
2024-11-20 02:32:39 +01:00
Sebastian Huber
1c12047098 score: Improve priority node debugging
Make sure the actions of priority aggregations are not reused while in
use.

Update #5159.
2024-11-20 02:32:11 +01:00
Chris Johns
133b335bae cpukit/libmisc/rtems-fdt: Add shell read and write handler support
The handlers allow indirect access to FDT resources registered with the
shell.

Closes #5152
2024-11-16 17:40:05 +11:00
yang.zhang
6f604aec83 libmisc/shell: Only restore terminal settings on exit when captured
Signed-off-by: yang.zhang <zhangyang01@kylinos.cn>
2024-11-15 00:35:26 +00:00
Sebastian Huber
d0b9c07b20 doxgen: Document build system provided files
Use the #include path.

Update #3707.
2024-11-15 00:19:50 +00:00
Sebastian Huber
d386baedb5 rtems: Remove <rtems/rtemsdialer.h>
This header file belongs to the network stacks.
2024-11-13 23:30:21 +00:00
Sebastian Huber
be85180ee1 record: Fix rtems_record_server() clean up
Fix CID 1634787.

Fix #5150.
2024-11-13 23:07:02 +00:00
Sebastian Huber
30fc123f8d record: Use only related uptime low/high events
In case of overflows, we may have an RTEMS_RECORD_UPTIME_HIGH event as
the first event.  This uptime high event has no associated
RTEMS_RECORD_UPTIME_LOW event.
2024-11-12 22:43:35 +00:00
Sebastian Huber
464a37ac07 record: Add uptime event to fatal dump 2024-11-12 22:43:35 +00:00
Sebastian Huber
0f2721c832 record: Dump only once in fatal handling 2024-11-12 22:43:35 +00:00
Sebastian Huber
e72ee949a0 record: Avoid non-monotonic event times
The uptime and CPU counter reads must be as close as possible.  Fix
rounding.
2024-11-12 22:43:35 +00:00
Sebastian Huber
d4762dbad1 record: Improve uptime association 2024-11-12 22:43:35 +00:00
Sebastian Huber
4655a7df00 record: Reorganize system event numbers
This allows a fast check if a system event may not have a time stamp.
2024-11-12 22:43:35 +00:00
Sebastian Huber
920f8d8897 record: Rework client
The ring buffer overflow handling is already performed by
rtems_record_fetch().
2024-11-12 22:43:35 +00:00
Sebastian Huber
be764f7dec record: Remove rtems_record_drain()
The rtems_record_drain() function is unreliable.  Replace it with
rtems_record_fetch().
2024-11-12 22:43:35 +00:00
Sebastian Huber
049b9b5c82 record: Add rtems_record_fetch()
This function will replace rtems_record_drain() which turned out to be
unreliable in SMP configurations.
2024-11-12 22:43:35 +00:00
Sebastian Huber
31ac9cd554 record: Remove drain header from record control 2024-11-12 22:43:35 +00:00
Sebastian Huber
2c64cf1bd8 dev/serial/sc16is752-spi: Fix warnings
Fix several may be used uninitialized warnings.
2024-11-12 16:21:20 +00:00
Chris Johns
d6f3cd72ee libmisc/rtems-fdt: Path find need a sorted index table
Sort the index table so the bubble search works.
2024-11-08 03:28:23 +00:00
Joel Sherrill
dc7adff723 timespec.h, etc.: Eliminate use of 32-bit for time_t
This code had a uint32_t local variable for seconds from a timespec.
This was assigning a time_t to a uint32_t and ultimately returning it.
This propgated to rtems_timespec_add_to().

Coverity CID 1512527

Closes #5107.
2024-11-08 00:38:23 +00:00
Sebastian Huber
e87f5ebe37 score: Use normal integers for C++ atomic objects
Since C++20 there is no longer a trivial default constructor available
for atomic objects.  See:

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p0883r2.pdf

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117475

We already assume that an atomic integer can be stored in a normal
integer and has the same representation in C and C++.

Update #5145.
2024-11-07 03:24:09 +01:00
Aaron Nyholm
87c725b6ed flashdev: Add sector IOCTLs
Added new IOCTLs to flashdev to get sector info.
Updated flashdev shell command and flashdev test with new IOCTLs.
2024-11-06 22:35:20 +00:00
Kinsey Moore
c4625d8d86 cpukit/arm/pmsa: Add ability to find empty MPU regions 2024-11-04 17:17:10 -06:00
Kinsey Moore
a506c7f713 cpukit/arm/pmsa: Correctly determine the total number of MPU regions 2024-11-01 16:55:47 -05:00
Chris Johns
a1c3d4ba8e version: Add the release label interfaces
- Mark the VC key interfaces as deprecated in doxygen

Updates #5037
2024-10-30 22:40:15 +00:00
yang.zhang
64fe53a855 libfs/pipe: Fix panic caused by incomplete pipe dup
When dup fd, should also clone fctnl flags.
Also should check NULL param in pipe_* funcs.

Signed-off-by: yang.zhang <zhangyang01@kylinos.cn>
2024-10-30 20:03:58 +00:00
Gedare Bloom
80ef0dee02 score: ignore -Wdanglingpointer= in _User_extensions_Iterate 2024-10-28 23:13:58 -06:00
Kinsey Moore
d0e9ec85b0 cpukit/libmisc/shell: Remove shell prompt carriage return
This removes the carriage return printed before the shell prompt as it
can cause other output to be overwritten unexpectedly. This was
discovered when using the "cat" shell command on a file whose content
contained no trailing \n\r and was short enough to be entirely swallowed
by the prompt.
2024-10-25 02:44:37 +00:00
Kinsey Moore
83c1a305f7 cpukit/libfs/jffs2: Prevent memory corruption due to corrupted data
The rtime decompression routine does not fully check bounds during the
entirety of the decompression pass and can corrupt memory outside the
decompression buffer if the compressed data is corrupted. This adds the
required check to prevent this failure mode.

Updates #5072
2024-10-24 22:35:40 +00:00
Sebastian Huber
4c75bd88f3 Revert "libmisc/stackchk: Change stack checker reporter function signatures"
This reverts commit c1aa06dbd2.

Extending the rtems_stack_checker_info like this breaks the existing
visitor API used by rtems_stack_checker_iterate().  After review, using
an information structure contradicts the intention of the reporter to
allow a minimal reporting.  Filling up the information structure with
all the details would pull in several dependencies, like
_Thread_Get_name().  The API should be improved to provide the user with
the necessary information from the TCB without having to access members
directly.
2024-10-19 15:43:07 +00:00
Sebastian Huber
a54e0deab1 rtems: Simplify optionsimpl.h
Replace ternary operator with a boolean expression.  Include <stdbool.h>
for the bool definition.  Fix formatting.
2024-10-18 20:02:39 +00:00
Kinsey Moore
c978b63c3a cpukit/libdl/arm: Support BLX relocations that require a trampoline
BLX relocations in Thumb code expect the target to be ARM code. This
means that the trampoline must be generated in ARM mode.
2024-10-17 22:32:47 +00:00
Kinsey Moore
689e9986cd cpukit/libdl: Fix spelling of trampoline 2024-10-17 22:32:47 +00:00
Mohamed Hassan
c1aa06dbd2 libmisc/stackchk: Change stack checker reporter function signatures
This helps in abstraction by encapsulating unnecessary data to be revealed to the user
2024-10-16 04:30:45 +00:00
shuhua hua
bcd4b83e16 Ignore empty user names as input
* To unify the surrounding coding style
2024-10-15 13:11:42 +00:00