Compare commits

...

4 commits

Author SHA1 Message Date
Lefteris Georgiadis
0a12d1f35b
Merge 4bc8d25cec into 32e581636f 2025-07-24 08:41:35 +03:00
Gaurav-Aggarwal-AWS
32e581636f
Delete thread key on process exit (#1297)
Previously, the shared thread key was deleted in xPortStartScheduler
after scheduler was ended. This created a race condition where
prvThreadKeyDestructor (responsible for freeing thread-specific heap
memory) would not be called if xPortStartScheduler deleted the key
before the last task deletion, as destructors are not invoked after key
deletion (see https://github.com/walac/glibc/blob/master/nptl/pthread_create.c#L145-L150).

Move thread key deletion to process exit to ensure all thread-specific
memory is properly freed.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2025-07-24 11:07:27 +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
2 changed files with 14 additions and 2 deletions

View file

@ -96,6 +96,18 @@ jobs:
repo_path: ./local_kernel
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
env:
VERSION_NUMBER: ${{ github.event.inputs.version_number }}

View file

@ -140,6 +140,8 @@ static void prvThreadKeyDestructor( void * pvData )
static void prvInitThreadKey( void )
{
pthread_key_create( &xThreadKey, prvThreadKeyDestructor );
/* Destroy xThreadKey when the process exits. */
atexit( prvDestroyThreadKey );
}
/*-----------------------------------------------------------*/
@ -315,8 +317,6 @@ BaseType_t xPortStartScheduler( void )
/* Restore original signal mask. */
( void ) pthread_sigmask( SIG_SETMASK, &xSchedulerOriginalSignalMask, NULL );
prvDestroyThreadKey();
return 0;
}
/*-----------------------------------------------------------*/