Commit 38150a62 authored by Mark Brown's avatar Mark Brown Committed by Catalin Marinas
Browse files

kselftest/arm64: Allow larger buffers in get_signal_context()



In order to allow testing of signal contexts that overflow the base signal
frame allow callers to pass the buffer size for the user context into
get_signal_context(). No functional change.

Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220829160703.874492-10-broonie@kernel.org


Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 2fa1116b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -56,7 +56,8 @@ static inline bool feats_ok(struct tdescr *td)
 * at sizeof(ucontext_t).
 */
static __always_inline bool get_current_context(struct tdescr *td,
						ucontext_t *dest_uc)
						ucontext_t *dest_uc,
						size_t dest_sz)
{
	static volatile bool seen_already;

@@ -64,7 +65,7 @@ static __always_inline bool get_current_context(struct tdescr *td,
	/* it's a genuine invocation..reinit */
	seen_already = 0;
	td->live_uc_valid = 0;
	td->live_sz = sizeof(*dest_uc);
	td->live_sz = dest_sz;
	memset(dest_uc, 0x00, td->live_sz);
	td->live_uc = dest_uc;
	/*
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ static int fake_sigreturn_bad_magic_run(struct tdescr *td,
	struct _aarch64_ctx *shead = GET_SF_RESV_HEAD(sf), *head;

	/* just to fill the ucontext_t with something real */
	if (!get_current_context(td, &sf.uc))
	if (!get_current_context(td, &sf.uc, sizeof(sf.uc)))
		return 1;

	/* need at least 2*HDR_SZ space: KSFT_BAD_MAGIC + terminator. */
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ static int fake_sigreturn_bad_size_run(struct tdescr *td,
	struct _aarch64_ctx *shead = GET_SF_RESV_HEAD(sf), *head;

	/* just to fill the ucontext_t with something real */
	if (!get_current_context(td, &sf.uc))
	if (!get_current_context(td, &sf.uc, sizeof(sf.uc)))
		return 1;

	resv_sz = GET_SF_RESV_SIZE(sf);
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ static int fake_sigreturn_bad_size_for_magic0_run(struct tdescr *td,
	struct _aarch64_ctx *shead = GET_SF_RESV_HEAD(sf), *head;

	/* just to fill the ucontext_t with something real */
	if (!get_current_context(td, &sf.uc))
	if (!get_current_context(td, &sf.uc, sizeof(sf.uc)))
		return 1;

	/* at least HDR_SZ for the badly sized terminator. */
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ static int fake_sigreturn_duplicated_fpsimd_run(struct tdescr *td,
	struct _aarch64_ctx *shead = GET_SF_RESV_HEAD(sf), *head;

	/* just to fill the ucontext_t with something real */
	if (!get_current_context(td, &sf.uc))
	if (!get_current_context(td, &sf.uc, sizeof(sf.uc)))
		return 1;

	head = get_starting_head(shead, sizeof(struct fpsimd_context) + HDR_SZ,
Loading