Compare commits

...

5 commits

Author SHA1 Message Date
Lefteris Georgiadis aa7129f5f4
Merge 4bc8d25cec into 7225fbcbb9 2025-06-30 14:51:44 +02:00
Gaurav-Aggarwal-AWS 7225fbcbb9
Fix datatype of queue item length macros (#1286)
The uxItemSize parameter in xQueueGenericCreate and
xQueueGeneenericCreateStatic APIs expects a UBaseType_t type.
Previously, the semSEMAPHORE_QUEUE_ITEM_LENGTH macro incorrectly cast
the value to uint8_t, causing type mismatch warnings. This change
resolves the issue by properly casting the value to UBaseType_t.

This issue was reported here: https://github.com/FreeRTOS/FreeRTOS-Kernel/issues/1285.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2025-06-30 18:11:30 +05:30
Florian La Roche a882b10526
fix possible NULL pointer dereference after call to configASSERT() (#1284)
Compiling with clang static code analysis, possible NULL pointer
dereference are found. Since configASSERT() can possibly return
and continue "normal" operation, the code in queue.c and
stream_buffer.c can be adjusted to avoid NULL pointer exceptions.

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
2025-06-30 12:05:46 +05:30
ActoryOu 4bc8d25cec
Merge branch 'main' into main 2025-06-06 10:49:37 +08:00
lefosg 1f23756ed3 sign sbom 2025-06-05 15:40:00 +03:00
4 changed files with 24 additions and 21 deletions

View file

@ -94,6 +94,18 @@ jobs:
repo_path: ./local_kernel repo_path: ./local_kernel
source_path: ./ source_path: ./
# 1. Install cosign tool
- name: Install Cosign
uses: sigstore/cosign-installer@v3.8.1
# 2. Sign the sbom.spdx file using cosign. Two files are produced: sbom.sig and sbom.crt, stored in the same directory as sbom.spdx
- name: Attest SBOM
working-directory: ./local_kernel
run: |
cosign sign-blob sbom.spdx --output-certificate='sbom.crt' --output-signature='sbom.sig' -y
# The following is a sanity check. After signing, we verify the image to check that everything is OK
cosign verify-blob --signature='sbom.sig' --certificate='sbom.crt' --certificate-identity-regexp=.* --certificate-oidc-issuer-regexp='https://github.com' ./sbom.spdx
- name: commit SBOM file - name: commit SBOM file
env: env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }} VERSION_NUMBER: ${{ github.event.inputs.version_number }}

View file

@ -37,8 +37,8 @@
typedef QueueHandle_t SemaphoreHandle_t; typedef QueueHandle_t SemaphoreHandle_t;
#define semBINARY_SEMAPHORE_QUEUE_LENGTH ( ( uint8_t ) 1U ) #define semBINARY_SEMAPHORE_QUEUE_LENGTH ( ( UBaseType_t ) 1U )
#define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( uint8_t ) 0U ) #define semSEMAPHORE_QUEUE_ITEM_LENGTH ( ( UBaseType_t ) 0U )
#define semGIVE_BLOCK_TIME ( ( TickType_t ) 0U ) #define semGIVE_BLOCK_TIME ( ( TickType_t ) 0U )

23
queue.c
View file

@ -1175,9 +1175,8 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
traceENTER_xQueueGenericSendFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken, xCopyPosition ); traceENTER_xQueueGenericSendFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken, xCopyPosition );
configASSERT( pxQueue ); configASSERT( ( pxQueue != NULL ) && !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); configASSERT( ( pxQueue != NULL ) && !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) );
configASSERT( !( ( xCopyPosition == queueOVERWRITE ) && ( pxQueue->uxLength != 1 ) ) );
/* RTOS ports that support interrupt nesting have the concept of a maximum /* RTOS ports that support interrupt nesting have the concept of a maximum
* system call (or maximum API call) interrupt priority. Interrupts that are * system call (or maximum API call) interrupt priority. Interrupts that are
@ -1351,16 +1350,14 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
* not (i.e. has a task with a higher priority than us been woken by this * not (i.e. has a task with a higher priority than us been woken by this
* post). */ * post). */
configASSERT( pxQueue );
/* xQueueGenericSendFromISR() should be used instead of xQueueGiveFromISR() /* xQueueGenericSendFromISR() should be used instead of xQueueGiveFromISR()
* if the item size is not 0. */ * if the item size is not 0. */
configASSERT( pxQueue->uxItemSize == 0 ); configASSERT( ( pxQueue != NULL ) && ( pxQueue->uxItemSize == 0 ) );
/* Normally a mutex would not be given from an interrupt, especially if /* Normally a mutex would not be given from an interrupt, especially if
* there is a mutex holder, as priority inheritance makes no sense for an * there is a mutex holder, as priority inheritance makes no sense for an
* interrupts, only tasks. */ * interrupt, only tasks. */
configASSERT( !( ( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) && ( pxQueue->u.xSemaphore.xMutexHolder != NULL ) ) ); configASSERT( ( pxQueue != NULL ) && !( ( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) && ( pxQueue->u.xSemaphore.xMutexHolder != NULL ) ) );
/* RTOS ports that support interrupt nesting have the concept of a maximum /* RTOS ports that support interrupt nesting have the concept of a maximum
* system call (or maximum API call) interrupt priority. Interrupts that are * system call (or maximum API call) interrupt priority. Interrupts that are
@ -1895,12 +1892,9 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue,
traceENTER_xQueuePeek( xQueue, pvBuffer, xTicksToWait ); traceENTER_xQueuePeek( xQueue, pvBuffer, xTicksToWait );
/* Check the pointer is not NULL. */
configASSERT( ( pxQueue ) );
/* The buffer into which data is received can only be NULL if the data size /* The buffer into which data is received can only be NULL if the data size
* is zero (so no data is copied into the buffer. */ * is zero (so no data is copied into the buffer. */
configASSERT( !( ( ( pvBuffer ) == NULL ) && ( ( pxQueue )->uxItemSize != ( UBaseType_t ) 0U ) ) ); configASSERT( ( pxQueue != NULL ) && !( ( ( pvBuffer ) == NULL ) && ( ( pxQueue )->uxItemSize != ( UBaseType_t ) 0U ) ) );
/* Cannot block if the scheduler is suspended. */ /* Cannot block if the scheduler is suspended. */
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) ) #if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
@ -2152,9 +2146,8 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,
traceENTER_xQueuePeekFromISR( xQueue, pvBuffer ); traceENTER_xQueuePeekFromISR( xQueue, pvBuffer );
configASSERT( pxQueue ); configASSERT( ( pxQueue != NULL ) && !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) ); configASSERT( ( pxQueue != NULL ) && ( pxQueue->uxItemSize != 0 ) ); /* Can't peek a semaphore. */
configASSERT( pxQueue->uxItemSize != 0 ); /* Can't peek a semaphore. */
/* RTOS ports that support interrupt nesting have the concept of a maximum /* RTOS ports that support interrupt nesting have the concept of a maximum
* system call (or maximum API call) interrupt priority. Interrupts that are * system call (or maximum API call) interrupt priority. Interrupts that are

View file

@ -1653,11 +1653,9 @@ void vStreamBufferSetStreamBufferNotificationIndex( StreamBufferHandle_t xStream
traceENTER_vStreamBufferSetStreamBufferNotificationIndex( xStreamBuffer, uxNotificationIndex ); traceENTER_vStreamBufferSetStreamBufferNotificationIndex( xStreamBuffer, uxNotificationIndex );
configASSERT( pxStreamBuffer );
/* There should be no task waiting otherwise we'd never resume them. */ /* There should be no task waiting otherwise we'd never resume them. */
configASSERT( pxStreamBuffer->xTaskWaitingToReceive == NULL ); configASSERT( ( pxStreamBuffer != NULL ) && ( pxStreamBuffer->xTaskWaitingToReceive == NULL ) );
configASSERT( pxStreamBuffer->xTaskWaitingToSend == NULL ); configASSERT( ( pxStreamBuffer != NULL ) && ( pxStreamBuffer->xTaskWaitingToSend == NULL ) );
/* Check that the task notification index is valid. */ /* Check that the task notification index is valid. */
configASSERT( uxNotificationIndex < configTASK_NOTIFICATION_ARRAY_ENTRIES ); configASSERT( uxNotificationIndex < configTASK_NOTIFICATION_ARRAY_ENTRIES );