All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
@ 2017-06-23  9:07 ` Dave Martin
  0 siblings, 0 replies; 10+ messages in thread
From: Dave Martin @ 2017-06-23  9:07 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Yury Norov, linux-arch

ILP32 support uses the same struct sigcontext as the native ABI
(i.e., LP64), but a different layout for the rest of the signal
frame (since siginfo_t and ucontext_t are both ABI-dependent).

Since the purpose of parse_user_sigframe() is really to parse
sigcontext and not the whole signal frame, the function does not
need to depend on the layout of rt_sigframe -- the only purpose of
the rt_sigframe pointer is for use as a base to measure the signal
frame size.

So, this patch renames the function to parse_user_sigcontext() and
makes the sigframe base pointer generic.  ABI-specific parsers that
share the same sigcontext definition can then call it.

To minimise churn in this patch, the native LP64 parser is retained
under the old name, but becomes a call to parse_user_sigconext().
It may make sense instead to fold this into its restore_sigframe(),
depending on how ILP32 support is integrated.

Suggested-by: Yury Norov <ynorov@caviumnetworks.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
---

This patch depends on [1], which does not appear to be applied yet.

[1] [PATCH] arm64: signal: Allow expansion of the signal frame                  http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/514699.html

 arch/arm64/kernel/signal.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index e47cd3a..a189321 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -223,16 +223,16 @@ struct user_ctxs {
 	struct fpsimd_context __user *fpsimd;
 };
 
-static int parse_user_sigframe(struct user_ctxs *user,
-			       struct rt_sigframe __user *sf)
+static int parse_user_sigcontext(struct user_ctxs *user,
+				 struct sigcontext __user const *sc,
+				 void __user const *sigframe_base)
 {
-	struct sigcontext __user *const sc = &sf->uc.uc_mcontext;
 	struct _aarch64_ctx __user *head;
 	char __user *base = (char __user *)&sc->__reserved;
 	size_t offset = 0;
 	size_t limit = sizeof(sc->__reserved);
 	bool have_extra_context = false;
-	char const __user *const sfp = (char const __user *)sf;
+	char const __user *const sfp = (char const __user *)sigframe_base;
 
 	user->fpsimd = NULL;
 
@@ -366,6 +366,12 @@ static int parse_user_sigframe(struct user_ctxs *user,
 	return -EINVAL;
 }
 
+static int parse_user_sigframe(struct user_ctxs *user,
+			       struct rt_sigframe __user const *sf)
+{
+	return parse_user_sigcontext(user, &sf->uc.uc_mcontext, sf);
+}
+
 static int restore_sigframe(struct pt_regs *regs,
 			    struct rt_sigframe __user *sf)
 {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [RFC PATCH] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
@ 2017-06-23  9:07 ` Dave Martin
  0 siblings, 0 replies; 10+ messages in thread
From: Dave Martin @ 2017-06-23  9:07 UTC (permalink / raw)
  To: linux-arm-kernel

ILP32 support uses the same struct sigcontext as the native ABI
(i.e., LP64), but a different layout for the rest of the signal
frame (since siginfo_t and ucontext_t are both ABI-dependent).

Since the purpose of parse_user_sigframe() is really to parse
sigcontext and not the whole signal frame, the function does not
need to depend on the layout of rt_sigframe -- the only purpose of
the rt_sigframe pointer is for use as a base to measure the signal
frame size.

So, this patch renames the function to parse_user_sigcontext() and
makes the sigframe base pointer generic.  ABI-specific parsers that
share the same sigcontext definition can then call it.

To minimise churn in this patch, the native LP64 parser is retained
under the old name, but becomes a call to parse_user_sigconext().
It may make sense instead to fold this into its restore_sigframe(),
depending on how ILP32 support is integrated.

Suggested-by: Yury Norov <ynorov@caviumnetworks.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
---

This patch depends on [1], which does not appear to be applied yet.

[1] [PATCH] arm64: signal: Allow expansion of the signal frame                  http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/514699.html

 arch/arm64/kernel/signal.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index e47cd3a..a189321 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -223,16 +223,16 @@ struct user_ctxs {
 	struct fpsimd_context __user *fpsimd;
 };
 
-static int parse_user_sigframe(struct user_ctxs *user,
-			       struct rt_sigframe __user *sf)
+static int parse_user_sigcontext(struct user_ctxs *user,
+				 struct sigcontext __user const *sc,
+				 void __user const *sigframe_base)
 {
-	struct sigcontext __user *const sc = &sf->uc.uc_mcontext;
 	struct _aarch64_ctx __user *head;
 	char __user *base = (char __user *)&sc->__reserved;
 	size_t offset = 0;
 	size_t limit = sizeof(sc->__reserved);
 	bool have_extra_context = false;
-	char const __user *const sfp = (char const __user *)sf;
+	char const __user *const sfp = (char const __user *)sigframe_base;
 
 	user->fpsimd = NULL;
 
@@ -366,6 +366,12 @@ static int parse_user_sigframe(struct user_ctxs *user,
 	return -EINVAL;
 }
 
+static int parse_user_sigframe(struct user_ctxs *user,
+			       struct rt_sigframe __user const *sf)
+{
+	return parse_user_sigcontext(user, &sf->uc.uc_mcontext, sf);
+}
+
 static int restore_sigframe(struct pt_regs *regs,
 			    struct rt_sigframe __user *sf)
 {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [RFC PATCH] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
  2017-06-23  9:07 ` Dave Martin
@ 2017-06-25 15:05   ` Yury Norov
  -1 siblings, 0 replies; 10+ messages in thread
From: Yury Norov @ 2017-06-25 15:05 UTC (permalink / raw)
  To: Dave Martin; +Cc: linux-arm-kernel, linux-arch

On Fri, Jun 23, 2017 at 10:07:39AM +0100, Dave Martin wrote:
> ILP32 support uses the same struct sigcontext as the native ABI
> (i.e., LP64), but a different layout for the rest of the signal
> frame (since siginfo_t and ucontext_t are both ABI-dependent).
> 
> Since the purpose of parse_user_sigframe() is really to parse
> sigcontext and not the whole signal frame, the function does not
> need to depend on the layout of rt_sigframe -- the only purpose of
> the rt_sigframe pointer is for use as a base to measure the signal
> frame size.
> 
> So, this patch renames the function to parse_user_sigcontext() and
> makes the sigframe base pointer generic.  ABI-specific parsers that
> share the same sigcontext definition can then call it.
> 
> To minimise churn in this patch, the native LP64 parser is retained
> under the old name, but becomes a call to parse_user_sigconext().
> It may make sense instead to fold this into its restore_sigframe(),
> depending on how ILP32 support is integrated.
> 
> Suggested-by: Yury Norov <ynorov@caviumnetworks.com>
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> ---
> 
> This patch depends on [1], which does not appear to be applied yet.
> 
> [1] [PATCH] arm64: signal: Allow expansion of the signal frame                  http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/514699.html
> 
>  arch/arm64/kernel/signal.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
> index e47cd3a..a189321 100644
> --- a/arch/arm64/kernel/signal.c
> +++ b/arch/arm64/kernel/signal.c
> @@ -223,16 +223,16 @@ struct user_ctxs {
>  	struct fpsimd_context __user *fpsimd;
>  };
>  
> -static int parse_user_sigframe(struct user_ctxs *user,
> -			       struct rt_sigframe __user *sf)
> +static int parse_user_sigcontext(struct user_ctxs *user,
> +				 struct sigcontext __user const *sc,
> +				 void __user const *sigframe_base)
>  {
> -	struct sigcontext __user *const sc = &sf->uc.uc_mcontext;
>  	struct _aarch64_ctx __user *head;
>  	char __user *base = (char __user *)&sc->__reserved;
>  	size_t offset = 0;
>  	size_t limit = sizeof(sc->__reserved);
>  	bool have_extra_context = false;
> -	char const __user *const sfp = (char const __user *)sf;
> +	char const __user *const sfp = (char const __user *)sigframe_base;
>  
>  	user->fpsimd = NULL;
>  
> @@ -366,6 +366,12 @@ static int parse_user_sigframe(struct user_ctxs *user,
>  	return -EINVAL;
>  }
>  
> +static int parse_user_sigframe(struct user_ctxs *user,
> +			       struct rt_sigframe __user const *sf)
> +{
> +	return parse_user_sigcontext(user, &sf->uc.uc_mcontext, sf);
> +}
> +

Hi Dave, 

Thank you. Seems this is what I need. Only one thing. We can #define
parse_user_sigframe() as macro, and so bypass type control.
The macro then will be used both by lp64 and ilp32 without any
modification.

Yury

>  static int restore_sigframe(struct pt_regs *regs,
>  			    struct rt_sigframe __user *sf)
>  {
> -- 
> 2.1.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [RFC PATCH] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
@ 2017-06-25 15:05   ` Yury Norov
  0 siblings, 0 replies; 10+ messages in thread
From: Yury Norov @ 2017-06-25 15:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jun 23, 2017 at 10:07:39AM +0100, Dave Martin wrote:
> ILP32 support uses the same struct sigcontext as the native ABI
> (i.e., LP64), but a different layout for the rest of the signal
> frame (since siginfo_t and ucontext_t are both ABI-dependent).
> 
> Since the purpose of parse_user_sigframe() is really to parse
> sigcontext and not the whole signal frame, the function does not
> need to depend on the layout of rt_sigframe -- the only purpose of
> the rt_sigframe pointer is for use as a base to measure the signal
> frame size.
> 
> So, this patch renames the function to parse_user_sigcontext() and
> makes the sigframe base pointer generic.  ABI-specific parsers that
> share the same sigcontext definition can then call it.
> 
> To minimise churn in this patch, the native LP64 parser is retained
> under the old name, but becomes a call to parse_user_sigconext().
> It may make sense instead to fold this into its restore_sigframe(),
> depending on how ILP32 support is integrated.
> 
> Suggested-by: Yury Norov <ynorov@caviumnetworks.com>
> Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> ---
> 
> This patch depends on [1], which does not appear to be applied yet.
> 
> [1] [PATCH] arm64: signal: Allow expansion of the signal frame                  http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/514699.html
> 
>  arch/arm64/kernel/signal.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
> index e47cd3a..a189321 100644
> --- a/arch/arm64/kernel/signal.c
> +++ b/arch/arm64/kernel/signal.c
> @@ -223,16 +223,16 @@ struct user_ctxs {
>  	struct fpsimd_context __user *fpsimd;
>  };
>  
> -static int parse_user_sigframe(struct user_ctxs *user,
> -			       struct rt_sigframe __user *sf)
> +static int parse_user_sigcontext(struct user_ctxs *user,
> +				 struct sigcontext __user const *sc,
> +				 void __user const *sigframe_base)
>  {
> -	struct sigcontext __user *const sc = &sf->uc.uc_mcontext;
>  	struct _aarch64_ctx __user *head;
>  	char __user *base = (char __user *)&sc->__reserved;
>  	size_t offset = 0;
>  	size_t limit = sizeof(sc->__reserved);
>  	bool have_extra_context = false;
> -	char const __user *const sfp = (char const __user *)sf;
> +	char const __user *const sfp = (char const __user *)sigframe_base;
>  
>  	user->fpsimd = NULL;
>  
> @@ -366,6 +366,12 @@ static int parse_user_sigframe(struct user_ctxs *user,
>  	return -EINVAL;
>  }
>  
> +static int parse_user_sigframe(struct user_ctxs *user,
> +			       struct rt_sigframe __user const *sf)
> +{
> +	return parse_user_sigcontext(user, &sf->uc.uc_mcontext, sf);
> +}
> +

Hi Dave, 

Thank you. Seems this is what I need. Only one thing. We can #define
parse_user_sigframe() as macro, and so bypass type control.
The macro then will be used both by lp64 and ilp32 without any
modification.

Yury

>  static int restore_sigframe(struct pt_regs *regs,
>  			    struct rt_sigframe __user *sf)
>  {
> -- 
> 2.1.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC PATCH] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
  2017-06-25 15:05   ` Yury Norov
@ 2017-06-26  9:35     ` Dave Martin
  -1 siblings, 0 replies; 10+ messages in thread
From: Dave Martin @ 2017-06-26  9:35 UTC (permalink / raw)
  To: Yury Norov; +Cc: linux-arch, linux-arm-kernel

On Sun, Jun 25, 2017 at 06:05:44PM +0300, Yury Norov wrote:
> On Fri, Jun 23, 2017 at 10:07:39AM +0100, Dave Martin wrote:
> > ILP32 support uses the same struct sigcontext as the native ABI
> > (i.e., LP64), but a different layout for the rest of the signal
> > frame (since siginfo_t and ucontext_t are both ABI-dependent).
> > 
> > Since the purpose of parse_user_sigframe() is really to parse
> > sigcontext and not the whole signal frame, the function does not
> > need to depend on the layout of rt_sigframe -- the only purpose of
> > the rt_sigframe pointer is for use as a base to measure the signal
> > frame size.
> > 
> > So, this patch renames the function to parse_user_sigcontext() and
> > makes the sigframe base pointer generic.  ABI-specific parsers that
> > share the same sigcontext definition can then call it.
> > 
> > To minimise churn in this patch, the native LP64 parser is retained
> > under the old name, but becomes a call to parse_user_sigconext().
> > It may make sense instead to fold this into its restore_sigframe(),
> > depending on how ILP32 support is integrated.
> > 
> > Suggested-by: Yury Norov <ynorov@caviumnetworks.com>
> > Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> > ---
> > 
> > This patch depends on [1], which does not appear to be applied yet.
> > 
> > [1] [PATCH] arm64: signal: Allow expansion of the signal frame                  http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/514699.html

[...]

FYI, [1] above is now merged in arm64 for-next/core, so we shouldn't
have dependency issues with this patch.

> > +static int parse_user_sigframe(struct user_ctxs *user,
> > +			       struct rt_sigframe __user const *sf)
> > +{
> > +	return parse_user_sigcontext(user, &sf->uc.uc_mcontext, sf);
> > +}
> > +
> 
> Hi Dave, 
> 
> Thank you. Seems this is what I need. Only one thing. We can #define
> parse_user_sigframe() as macro, and so bypass type control.
> The macro then will be used both by lp64 and ilp32 without any
> modification.

For the reasons you already gave, parse_user_sigframe is probably not
the right name for such a macro.  But it otherwise makes sense as an
interface.  Does [2] look OK for you?

Unless you suggest otherwise, I don't plan to maintain or push this
patch -- I think it makes more sense for you to carry it in the ILP32
series, since that's the only thing that needs it.

Cheers
---Dave

[2] [RFC PATCH v2] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/515746.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [RFC PATCH] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
@ 2017-06-26  9:35     ` Dave Martin
  0 siblings, 0 replies; 10+ messages in thread
From: Dave Martin @ 2017-06-26  9:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Jun 25, 2017 at 06:05:44PM +0300, Yury Norov wrote:
> On Fri, Jun 23, 2017 at 10:07:39AM +0100, Dave Martin wrote:
> > ILP32 support uses the same struct sigcontext as the native ABI
> > (i.e., LP64), but a different layout for the rest of the signal
> > frame (since siginfo_t and ucontext_t are both ABI-dependent).
> > 
> > Since the purpose of parse_user_sigframe() is really to parse
> > sigcontext and not the whole signal frame, the function does not
> > need to depend on the layout of rt_sigframe -- the only purpose of
> > the rt_sigframe pointer is for use as a base to measure the signal
> > frame size.
> > 
> > So, this patch renames the function to parse_user_sigcontext() and
> > makes the sigframe base pointer generic.  ABI-specific parsers that
> > share the same sigcontext definition can then call it.
> > 
> > To minimise churn in this patch, the native LP64 parser is retained
> > under the old name, but becomes a call to parse_user_sigconext().
> > It may make sense instead to fold this into its restore_sigframe(),
> > depending on how ILP32 support is integrated.
> > 
> > Suggested-by: Yury Norov <ynorov@caviumnetworks.com>
> > Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> > ---
> > 
> > This patch depends on [1], which does not appear to be applied yet.
> > 
> > [1] [PATCH] arm64: signal: Allow expansion of the signal frame                  http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/514699.html

[...]

FYI, [1] above is now merged in arm64 for-next/core, so we shouldn't
have dependency issues with this patch.

> > +static int parse_user_sigframe(struct user_ctxs *user,
> > +			       struct rt_sigframe __user const *sf)
> > +{
> > +	return parse_user_sigcontext(user, &sf->uc.uc_mcontext, sf);
> > +}
> > +
> 
> Hi Dave, 
> 
> Thank you. Seems this is what I need. Only one thing. We can #define
> parse_user_sigframe() as macro, and so bypass type control.
> The macro then will be used both by lp64 and ilp32 without any
> modification.

For the reasons you already gave, parse_user_sigframe is probably not
the right name for such a macro.  But it otherwise makes sense as an
interface.  Does [2] look OK for you?

Unless you suggest otherwise, I don't plan to maintain or push this
patch -- I think it makes more sense for you to carry it in the ILP32
series, since that's the only thing that needs it.

Cheers
---Dave

[2] [RFC PATCH v2] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/515746.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC PATCH] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
  2017-06-26  9:35     ` Dave Martin
@ 2017-06-26 15:38       ` Yury Norov
  -1 siblings, 0 replies; 10+ messages in thread
From: Yury Norov @ 2017-06-26 15:38 UTC (permalink / raw)
  To: Dave Martin; +Cc: linux-arch, linux-arm-kernel

On Mon, Jun 26, 2017 at 10:35:21AM +0100, Dave Martin wrote:
> On Sun, Jun 25, 2017 at 06:05:44PM +0300, Yury Norov wrote:
> > On Fri, Jun 23, 2017 at 10:07:39AM +0100, Dave Martin wrote:
> > > ILP32 support uses the same struct sigcontext as the native ABI
> > > (i.e., LP64), but a different layout for the rest of the signal
> > > frame (since siginfo_t and ucontext_t are both ABI-dependent).
> > > 
> > > Since the purpose of parse_user_sigframe() is really to parse
> > > sigcontext and not the whole signal frame, the function does not
> > > need to depend on the layout of rt_sigframe -- the only purpose of
> > > the rt_sigframe pointer is for use as a base to measure the signal
> > > frame size.
> > > 
> > > So, this patch renames the function to parse_user_sigcontext() and
> > > makes the sigframe base pointer generic.  ABI-specific parsers that
> > > share the same sigcontext definition can then call it.
> > > 
> > > To minimise churn in this patch, the native LP64 parser is retained
> > > under the old name, but becomes a call to parse_user_sigconext().
> > > It may make sense instead to fold this into its restore_sigframe(),
> > > depending on how ILP32 support is integrated.
> > > 
> > > Suggested-by: Yury Norov <ynorov@caviumnetworks.com>
> > > Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> > > ---
> > > 
> > > This patch depends on [1], which does not appear to be applied yet.
> > > 
> > > [1] [PATCH] arm64: signal: Allow expansion of the signal frame                  http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/514699.html
> 
> [...]
> 
> FYI, [1] above is now merged in arm64 for-next/core, so we shouldn't
> have dependency issues with this patch.
> 
> > > +static int parse_user_sigframe(struct user_ctxs *user,
> > > +			       struct rt_sigframe __user const *sf)
> > > +{
> > > +	return parse_user_sigcontext(user, &sf->uc.uc_mcontext, sf);
> > > +}
> > > +
> > 
> > Hi Dave, 
> > 
> > Thank you. Seems this is what I need. Only one thing. We can #define
> > parse_user_sigframe() as macro, and so bypass type control.
> > The macro then will be used both by lp64 and ilp32 without any
> > modification.
> 
> For the reasons you already gave, parse_user_sigframe is probably not
> the right name for such a macro.  But it otherwise makes sense as an
> interface.  Does [2] look OK for you?
 
Yes, looks good, thank you.

> Unless you suggest otherwise, I don't plan to maintain or push this
> patch -- I think it makes more sense for you to carry it in the ILP32
> series, since that's the only thing that needs it.

I'll just add it to ilp32 series.

Yury

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [RFC PATCH] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
@ 2017-06-26 15:38       ` Yury Norov
  0 siblings, 0 replies; 10+ messages in thread
From: Yury Norov @ 2017-06-26 15:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 26, 2017 at 10:35:21AM +0100, Dave Martin wrote:
> On Sun, Jun 25, 2017 at 06:05:44PM +0300, Yury Norov wrote:
> > On Fri, Jun 23, 2017 at 10:07:39AM +0100, Dave Martin wrote:
> > > ILP32 support uses the same struct sigcontext as the native ABI
> > > (i.e., LP64), but a different layout for the rest of the signal
> > > frame (since siginfo_t and ucontext_t are both ABI-dependent).
> > > 
> > > Since the purpose of parse_user_sigframe() is really to parse
> > > sigcontext and not the whole signal frame, the function does not
> > > need to depend on the layout of rt_sigframe -- the only purpose of
> > > the rt_sigframe pointer is for use as a base to measure the signal
> > > frame size.
> > > 
> > > So, this patch renames the function to parse_user_sigcontext() and
> > > makes the sigframe base pointer generic.  ABI-specific parsers that
> > > share the same sigcontext definition can then call it.
> > > 
> > > To minimise churn in this patch, the native LP64 parser is retained
> > > under the old name, but becomes a call to parse_user_sigconext().
> > > It may make sense instead to fold this into its restore_sigframe(),
> > > depending on how ILP32 support is integrated.
> > > 
> > > Suggested-by: Yury Norov <ynorov@caviumnetworks.com>
> > > Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> > > ---
> > > 
> > > This patch depends on [1], which does not appear to be applied yet.
> > > 
> > > [1] [PATCH] arm64: signal: Allow expansion of the signal frame                  http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/514699.html
> 
> [...]
> 
> FYI, [1] above is now merged in arm64 for-next/core, so we shouldn't
> have dependency issues with this patch.
> 
> > > +static int parse_user_sigframe(struct user_ctxs *user,
> > > +			       struct rt_sigframe __user const *sf)
> > > +{
> > > +	return parse_user_sigcontext(user, &sf->uc.uc_mcontext, sf);
> > > +}
> > > +
> > 
> > Hi Dave, 
> > 
> > Thank you. Seems this is what I need. Only one thing. We can #define
> > parse_user_sigframe() as macro, and so bypass type control.
> > The macro then will be used both by lp64 and ilp32 without any
> > modification.
> 
> For the reasons you already gave, parse_user_sigframe is probably not
> the right name for such a macro.  But it otherwise makes sense as an
> interface.  Does [2] look OK for you?
 
Yes, looks good, thank you.

> Unless you suggest otherwise, I don't plan to maintain or push this
> patch -- I think it makes more sense for you to carry it in the ILP32
> series, since that's the only thing that needs it.

I'll just add it to ilp32 series.

Yury

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RFC PATCH] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
  2017-06-26 15:38       ` Yury Norov
@ 2017-06-26 16:38         ` Dave Martin
  -1 siblings, 0 replies; 10+ messages in thread
From: Dave Martin @ 2017-06-26 16:38 UTC (permalink / raw)
  To: Yury Norov; +Cc: linux-arch, linux-arm-kernel

On Mon, Jun 26, 2017 at 06:38:27PM +0300, Yury Norov wrote:
> On Mon, Jun 26, 2017 at 10:35:21AM +0100, Dave Martin wrote:
> > On Sun, Jun 25, 2017 at 06:05:44PM +0300, Yury Norov wrote:
> > > On Fri, Jun 23, 2017 at 10:07:39AM +0100, Dave Martin wrote:
> > > > ILP32 support uses the same struct sigcontext as the native ABI
> > > > (i.e., LP64), but a different layout for the rest of the signal
> > > > frame (since siginfo_t and ucontext_t are both ABI-dependent).
> > > > 
> > > > Since the purpose of parse_user_sigframe() is really to parse
> > > > sigcontext and not the whole signal frame, the function does not
> > > > need to depend on the layout of rt_sigframe -- the only purpose of
> > > > the rt_sigframe pointer is for use as a base to measure the signal
> > > > frame size.
> > > > 
> > > > So, this patch renames the function to parse_user_sigcontext() and
> > > > makes the sigframe base pointer generic.  ABI-specific parsers that
> > > > share the same sigcontext definition can then call it.
> > > > 
> > > > To minimise churn in this patch, the native LP64 parser is retained
> > > > under the old name, but becomes a call to parse_user_sigconext().
> > > > It may make sense instead to fold this into its restore_sigframe(),
> > > > depending on how ILP32 support is integrated.
> > > > 
> > > > Suggested-by: Yury Norov <ynorov@caviumnetworks.com>
> > > > Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> > > > ---
> > > > 
> > > > This patch depends on [1], which does not appear to be applied yet.
> > > > 
> > > > [1] [PATCH] arm64: signal: Allow expansion of the signal frame                  http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/514699.html
> > 
> > [...]
> > 
> > FYI, [1] above is now merged in arm64 for-next/core, so we shouldn't
> > have dependency issues with this patch.
> > 
> > > > +static int parse_user_sigframe(struct user_ctxs *user,
> > > > +			       struct rt_sigframe __user const *sf)
> > > > +{
> > > > +	return parse_user_sigcontext(user, &sf->uc.uc_mcontext, sf);
> > > > +}
> > > > +
> > > 
> > > Hi Dave, 
> > > 
> > > Thank you. Seems this is what I need. Only one thing. We can #define
> > > parse_user_sigframe() as macro, and so bypass type control.
> > > The macro then will be used both by lp64 and ilp32 without any
> > > modification.
> > 
> > For the reasons you already gave, parse_user_sigframe is probably not
> > the right name for such a macro.  But it otherwise makes sense as an
> > interface.  Does [2] look OK for you?
>  
> Yes, looks good, thank you.
> 
> > Unless you suggest otherwise, I don't plan to maintain or push this
> > patch -- I think it makes more sense for you to carry it in the ILP32
> > series, since that's the only thing that needs it.
> 
> I'll just add it to ilp32 series.

OK, thanks

Let me know if you have any other questions.

Cheers
---Dave

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [RFC PATCH] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout
@ 2017-06-26 16:38         ` Dave Martin
  0 siblings, 0 replies; 10+ messages in thread
From: Dave Martin @ 2017-06-26 16:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jun 26, 2017 at 06:38:27PM +0300, Yury Norov wrote:
> On Mon, Jun 26, 2017 at 10:35:21AM +0100, Dave Martin wrote:
> > On Sun, Jun 25, 2017 at 06:05:44PM +0300, Yury Norov wrote:
> > > On Fri, Jun 23, 2017 at 10:07:39AM +0100, Dave Martin wrote:
> > > > ILP32 support uses the same struct sigcontext as the native ABI
> > > > (i.e., LP64), but a different layout for the rest of the signal
> > > > frame (since siginfo_t and ucontext_t are both ABI-dependent).
> > > > 
> > > > Since the purpose of parse_user_sigframe() is really to parse
> > > > sigcontext and not the whole signal frame, the function does not
> > > > need to depend on the layout of rt_sigframe -- the only purpose of
> > > > the rt_sigframe pointer is for use as a base to measure the signal
> > > > frame size.
> > > > 
> > > > So, this patch renames the function to parse_user_sigcontext() and
> > > > makes the sigframe base pointer generic.  ABI-specific parsers that
> > > > share the same sigcontext definition can then call it.
> > > > 
> > > > To minimise churn in this patch, the native LP64 parser is retained
> > > > under the old name, but becomes a call to parse_user_sigconext().
> > > > It may make sense instead to fold this into its restore_sigframe(),
> > > > depending on how ILP32 support is integrated.
> > > > 
> > > > Suggested-by: Yury Norov <ynorov@caviumnetworks.com>
> > > > Signed-off-by: Dave Martin <Dave.Martin@arm.com>
> > > > ---
> > > > 
> > > > This patch depends on [1], which does not appear to be applied yet.
> > > > 
> > > > [1] [PATCH] arm64: signal: Allow expansion of the signal frame                  http://lists.infradead.org/pipermail/linux-arm-kernel/2017-June/514699.html
> > 
> > [...]
> > 
> > FYI, [1] above is now merged in arm64 for-next/core, so we shouldn't
> > have dependency issues with this patch.
> > 
> > > > +static int parse_user_sigframe(struct user_ctxs *user,
> > > > +			       struct rt_sigframe __user const *sf)
> > > > +{
> > > > +	return parse_user_sigcontext(user, &sf->uc.uc_mcontext, sf);
> > > > +}
> > > > +
> > > 
> > > Hi Dave, 
> > > 
> > > Thank you. Seems this is what I need. Only one thing. We can #define
> > > parse_user_sigframe() as macro, and so bypass type control.
> > > The macro then will be used both by lp64 and ilp32 without any
> > > modification.
> > 
> > For the reasons you already gave, parse_user_sigframe is probably not
> > the right name for such a macro.  But it otherwise makes sense as an
> > interface.  Does [2] look OK for you?
>  
> Yes, looks good, thank you.
> 
> > Unless you suggest otherwise, I don't plan to maintain or push this
> > patch -- I think it makes more sense for you to carry it in the ILP32
> > series, since that's the only thing that needs it.
> 
> I'll just add it to ilp32 series.

OK, thanks

Let me know if you have any other questions.

Cheers
---Dave

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-06-26 16:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-23  9:07 [RFC PATCH] arm64: signal: Make parse_user_sigframe() independent of rt_sigframe layout Dave Martin
2017-06-23  9:07 ` Dave Martin
2017-06-25 15:05 ` Yury Norov
2017-06-25 15:05   ` Yury Norov
2017-06-26  9:35   ` Dave Martin
2017-06-26  9:35     ` Dave Martin
2017-06-26 15:38     ` Yury Norov
2017-06-26 15:38       ` Yury Norov
2017-06-26 16:38       ` Dave Martin
2017-06-26 16:38         ` Dave Martin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.