Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

platform/NVMem:Fix stack overflow in _plat__NvInitFromStorage() on 64 bit architectures #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ljanik
Copy link

@ljanik ljanik commented Jan 10, 2025

The UINT32 bytesRead stack variable declared in _plat__NvInitFromStorage() is passed as fourth parameter to
TEE_ReadObjectData()` which has following signature:

TEE_Result TEE_ReadObjectData(TEE_ObjectHandle object, void *buffer,
                              size_t size, size_t *count)

The type mismatch might cause stack overflow on 64 bit architectures where 64b-wide size_t value would be written to address of 32b-wide variable on stack.

@jenswi-linaro
Copy link
Contributor

Reviewed-by: Jens Wiklander <[email protected]>

…b architectures

The `UINT32 bytesRead` stack variable in _plat__NvInitFromStorage() is passed as
fourth argument to `TEE_ReadObjectData()` which has following signature:

TEE_Result TEE_ReadObjectData(TEE_ObjectHandle object, void *buffer,
			      size_t size, size_t *count)

This might cause stack overflow on 64b architectures where 64b-wide size_t
value would be written to address of 32b-wide variable on stack.

Signed-off-by: Lukas Janik <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
@ljanik ljanik force-pushed the bugfix/bad-type-in-plat-nv-init branch from d063097 to 23d1f88 Compare January 10, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants