linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dave.Martin@arm.com (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] fixup! arm64: signal: Allow expansion of the signal frame
Date: Tue, 20 Jun 2017 17:24:36 +0100	[thread overview]
Message-ID: <1497975876-7055-1-git-send-email-Dave.Martin@arm.com> (raw)
In-Reply-To: <20170619110346.GB3024@e104818-lin.cambridge.arm.com>

Convert extra_context.data to a u64 for better ABI independence.
data is renamed to "datap" to give a stronger clue that it is
a pointer.

The binary interface is unchanged.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
---

I've build-tested this fixup only.

The only change here is to replace the name "data" with "datap" in
appropriate places and change void __user * to u64 appropriately, with
casts in the two places where this value enters and exits the kernel.

 arch/arm64/include/uapi/asm/sigcontext.h |  6 +++---
 arch/arm64/kernel/signal.c               | 16 ++++++++--------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/arch/arm64/include/uapi/asm/sigcontext.h b/arch/arm64/include/uapi/asm/sigcontext.h
index 303a48c..f0a76b9 100644
--- a/arch/arm64/include/uapi/asm/sigcontext.h
+++ b/arch/arm64/include/uapi/asm/sigcontext.h
@@ -98,7 +98,7 @@ struct esr_context {
  * 3) If extra_context is present, it must be followed immediately in
  * sigcontext.__reserved[] by the terminating null _aarch64_ctx.
  *
- * 4) The extra space to which data points must start at the first
+ * 4) The extra space to which datap points must start at the first
  * 16-byte aligned address immediately after the terminating null
  * _aarch64_ctx that follows the extra_context structure in
  * __reserved[].  The extra space may overrun the end of __reserved[],
@@ -111,8 +111,8 @@ struct esr_context {
 
 struct extra_context {
 	struct _aarch64_ctx head;
-	void __user *data;	/* 16-byte aligned pointer to extra space */
-	__u32 size;		/* size in bytes of the extra space */
+	__u64 datap; /* 16-byte aligned pointer to extra space cast to __u64 */
+	__u32 size; /* size in bytes of the extra space */
 	__u32 __reserved[3];
 };
 
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 3602fb7..cb0d008 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -244,7 +244,7 @@ static int parse_user_sigframe(struct user_ctxs *user,
 		u32 magic, size;
 		char const __user *userp;
 		struct extra_context const __user *extra;
-		void __user *extra_data;
+		u64 extra_datap;
 		u32 extra_size;
 		struct _aarch64_ctx const __user *end;
 		u32 end_magic, end_size;
@@ -297,7 +297,7 @@ static int parse_user_sigframe(struct user_ctxs *user,
 			extra = (struct extra_context const __user *)userp;
 			userp += size;
 
-			__get_user_error(extra_data, &extra->data, err);
+			__get_user_error(extra_datap, &extra->datap, err);
 			__get_user_error(extra_size, &extra->size, err);
 			if (err)
 				return err;
@@ -321,14 +321,14 @@ static int parse_user_sigframe(struct user_ctxs *user,
 			/* Prevent looping/repeated parsing of extra_context */
 			have_extra_context = true;
 
-			base = extra_data;
+			base = (void __user *)extra_datap;
 			if (!IS_ALIGNED((unsigned long)base, 16))
 				goto invalid;
 
 			if (!IS_ALIGNED(extra_size, 16))
 				goto invalid;
 
-			if (extra_data != userp)
+			if (base != userp)
 				goto invalid;
 
 			/* Reject "unreasonably large" frames: */
@@ -337,7 +337,7 @@ static int parse_user_sigframe(struct user_ctxs *user,
 
 			/*
 			 * Ignore trailing terminator in __reserved[]
-			 * and start parsing extra_data:
+			 * and start parsing extra data:
 			 */
 			offset = 0;
 			limit = extra_size;
@@ -501,7 +501,7 @@ static int setup_sigframe(struct rt_sigframe_user_layout *user,
 
 		struct extra_context __user *extra;
 		struct _aarch64_ctx __user *end;
-		void __user *extra_data;
+		u64 extra_datap;
 		u32 extra_size;
 
 		extra = (struct extra_context __user *)userp;
@@ -510,12 +510,12 @@ static int setup_sigframe(struct rt_sigframe_user_layout *user,
 		end = (struct _aarch64_ctx __user *)userp;
 		userp += TERMINATOR_SIZE;
 
-		extra_data = userp;
+		extra_datap = (u64)userp;
 		extra_size = sfp + round_up(user->size, 16) - userp;
 
 		__put_user_error(EXTRA_MAGIC, &extra->head.magic, err);
 		__put_user_error(EXTRA_CONTEXT_SIZE, &extra->head.size, err);
-		__put_user_error(extra_data, &extra->data, err);
+		__put_user_error(extra_datap, &extra->datap, err);
 		__put_user_error(extra_size, &extra->size, err);
 
 		/* Add the terminator */
-- 
2.1.4

      parent reply	other threads:[~2017-06-20 16:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-15 14:03 [PATCH 0/5] arm64: signal: Signal frame expansion support Dave Martin
2017-06-15 14:03 ` [PATCH 1/5] arm64: signal: split frame link record from sigcontext structure Dave Martin
2017-06-15 16:37   ` Catalin Marinas
2017-06-16  9:30     ` Dave P Martin
2017-06-15 14:03 ` [PATCH 2/5] arm64: signal: Refactor sigcontext parsing in rt_sigreturn Dave Martin
2017-06-15 17:01   ` Catalin Marinas
2017-06-22 19:32   ` Yury Norov
2017-06-23  9:48     ` Dave Martin
2017-06-15 14:03 ` [PATCH 3/5] arm64: signal: factor frame layout and population into separate passes Dave Martin
2017-06-15 17:20   ` Catalin Marinas
2017-06-15 14:03 ` [PATCH 4/5] arm64: signal: factor out signal frame record allocation Dave Martin
2017-06-15 17:33   ` Catalin Marinas
2017-06-15 14:03 ` [PATCH 5/5] arm64: signal: Allow expansion of the signal frame Dave Martin
2017-06-15 17:42   ` Catalin Marinas
2017-06-16 10:47   ` Catalin Marinas
2017-06-19 10:12     ` Dave Martin
2017-06-19 11:03       ` Catalin Marinas
2017-06-20 16:20         ` Dave Martin
2017-06-20 16:24         ` Dave Martin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497975876-7055-1-git-send-email-Dave.Martin@arm.com \
    --to=dave.martin@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).