mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
selftests/mm: Fix resv_sz when parsing arm64 signal frame
get_header() wants the size of the reserved area in struct
sigcontext, but instead we pass it the size of the entire struct.
This could in theory result in an out-of-bounds read (if the signal
frame is malformed).
Fix this using one of the existing macros from
tools/testing/selftests/arm64/signal/testcases/testcases.h.
This issue was reported by Sashiko on a patch that copied this
portion of the code.
Link: https://sashiko.dev/#/patchset/20260421144252.1440365-1-kevin.brodsky%40arm.com
Fixes: f5b5ea51f7 ("selftests: mm: make protection_keys test work on arm64")
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
254f49634e
commit
c364aa56d6
|
|
@ -130,9 +130,10 @@ static inline u64 get_pkey_bits(u64 reg, int pkey)
|
|||
static inline void aarch64_write_signal_pkey(ucontext_t *uctxt, u64 pkey)
|
||||
{
|
||||
struct _aarch64_ctx *ctx = GET_UC_RESV_HEAD(uctxt);
|
||||
size_t resv_size = GET_UCP_RESV_SIZE(uctxt);
|
||||
struct poe_context *poe_ctx =
|
||||
(struct poe_context *) get_header(ctx, POE_MAGIC,
|
||||
sizeof(uctxt->uc_mcontext), NULL);
|
||||
resv_size, NULL);
|
||||
if (poe_ctx)
|
||||
poe_ctx->por_el0 = pkey;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user