* [PATCH] src/nsexec: fix stack pointer alignment exception
@ 2017-09-27 5:52 Zorro Lang
2017-09-27 10:01 ` Carlos Maiolino
2017-09-29 14:44 ` Eric Sandeen
0 siblings, 2 replies; 4+ messages in thread
From: Zorro Lang @ 2017-09-27 5:52 UTC (permalink / raw)
To: fstests; +Cc: sandeen
When test g/317 or g/318 on ARM server, we got a kernel exception:
kernel: nsexec[8203]: SP Alignment exception: pc=00000000004010a0 sp=00000000005200e8
nsexec gives an unaligned child stack address to clone() system
call sometimes. For making sure it's always aligned, use
"__attribute__((aligned))" extension of GCC (Thanks this suggestion
from Eric sandeen).
Signed-off-by: Zorro Lang <zlang@redhat.com>
---
src/nsexec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/nsexec.c b/src/nsexec.c
index f033b1a4..205dd081 100644
--- a/src/nsexec.c
+++ b/src/nsexec.c
@@ -138,7 +138,8 @@ childFunc(void *arg)
#define STACK_SIZE (1024 * 1024)
-static char child_stack[STACK_SIZE]; /* Space for child's stack */
+/* Space for child's stack */
+static char __attribute__((aligned)) child_stack[STACK_SIZE];
int
main(int argc, char *argv[])
--
2.13.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] src/nsexec: fix stack pointer alignment exception
2017-09-27 5:52 [PATCH] src/nsexec: fix stack pointer alignment exception Zorro Lang
@ 2017-09-27 10:01 ` Carlos Maiolino
2017-09-29 14:44 ` Eric Sandeen
1 sibling, 0 replies; 4+ messages in thread
From: Carlos Maiolino @ 2017-09-27 10:01 UTC (permalink / raw)
To: Zorro Lang; +Cc: fstests, sandeen
On Wed, Sep 27, 2017 at 05:52:52AM +0000, Zorro Lang wrote:
> When test g/317 or g/318 on ARM server, we got a kernel exception:
>
> kernel: nsexec[8203]: SP Alignment exception: pc=00000000004010a0 sp=00000000005200e8
>
> nsexec gives an unaligned child stack address to clone() system
> call sometimes. For making sure it's always aligned, use
> "__attribute__((aligned))" extension of GCC (Thanks this suggestion
> from Eric sandeen).
>
> Signed-off-by: Zorro Lang <zlang@redhat.com>
> ---
> src/nsexec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/nsexec.c b/src/nsexec.c
> index f033b1a4..205dd081 100644
> --- a/src/nsexec.c
> +++ b/src/nsexec.c
> @@ -138,7 +138,8 @@ childFunc(void *arg)
>
> #define STACK_SIZE (1024 * 1024)
>
> -static char child_stack[STACK_SIZE]; /* Space for child's stack */
> +/* Space for child's stack */
> +static char __attribute__((aligned)) child_stack[STACK_SIZE];
I don't really think the comment is necessary, other than that:
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
>
> int
> main(int argc, char *argv[])
> --
> 2.13.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Carlos
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] src/nsexec: fix stack pointer alignment exception
2017-09-27 5:52 [PATCH] src/nsexec: fix stack pointer alignment exception Zorro Lang
2017-09-27 10:01 ` Carlos Maiolino
@ 2017-09-29 14:44 ` Eric Sandeen
2017-09-29 15:52 ` Zorro Lang
1 sibling, 1 reply; 4+ messages in thread
From: Eric Sandeen @ 2017-09-29 14:44 UTC (permalink / raw)
To: Zorro Lang, fstests; +Cc: sandeen
On 9/27/17 12:52 AM, Zorro Lang wrote:
> When test g/317 or g/318 on ARM server, we got a kernel exception:
>
> kernel: nsexec[8203]: SP Alignment exception: pc=00000000004010a0 sp=00000000005200e8
>
> nsexec gives an unaligned child stack address to clone() system
> call sometimes. For making sure it's always aligned, use
> "__attribute__((aligned))" extension of GCC (Thanks this suggestion
> from Eric sandeen).
>
> Signed-off-by: Zorro Lang <zlang@redhat.com>
> ---
> src/nsexec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/nsexec.c b/src/nsexec.c
> index f033b1a4..205dd081 100644
> --- a/src/nsexec.c
> +++ b/src/nsexec.c
> @@ -138,7 +138,8 @@ childFunc(void *arg)
>
> #define STACK_SIZE (1024 * 1024)
>
> -static char child_stack[STACK_SIZE]; /* Space for child's stack */
> +/* Space for child's stack */
> +static char __attribute__((aligned)) child_stack[STACK_SIZE];
Does it matter if the __attribute__ goes before or after
the array name (child_stack[])? I can't quite tell from reading i.e.
https://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Variable-Attributes.html#Variable%20Attributes
if it does, though most examples I see have the __attribute__ after the variable
name, i.e.
> short array[3] __attribute__ ((aligned));
in the URL above.
-Eric
>
> int
> main(int argc, char *argv[])
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] src/nsexec: fix stack pointer alignment exception
2017-09-29 14:44 ` Eric Sandeen
@ 2017-09-29 15:52 ` Zorro Lang
0 siblings, 0 replies; 4+ messages in thread
From: Zorro Lang @ 2017-09-29 15:52 UTC (permalink / raw)
To: Eric Sandeen; +Cc: fstests
On Fri, Sep 29, 2017 at 09:44:05AM -0500, Eric Sandeen wrote:
> On 9/27/17 12:52 AM, Zorro Lang wrote:
> > When test g/317 or g/318 on ARM server, we got a kernel exception:
> >
> > kernel: nsexec[8203]: SP Alignment exception: pc=00000000004010a0 sp=00000000005200e8
> >
> > nsexec gives an unaligned child stack address to clone() system
> > call sometimes. For making sure it's always aligned, use
> > "__attribute__((aligned))" extension of GCC (Thanks this suggestion
> > from Eric sandeen).
> >
> > Signed-off-by: Zorro Lang <zlang@redhat.com>
> > ---
> > src/nsexec.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/nsexec.c b/src/nsexec.c
> > index f033b1a4..205dd081 100644
> > --- a/src/nsexec.c
> > +++ b/src/nsexec.c
> > @@ -138,7 +138,8 @@ childFunc(void *arg)
> >
> > #define STACK_SIZE (1024 * 1024)
> >
> > -static char child_stack[STACK_SIZE]; /* Space for child's stack */
> > +/* Space for child's stack */
> > +static char __attribute__((aligned)) child_stack[STACK_SIZE];
>
> Does it matter if the __attribute__ goes before or after
> the array name (child_stack[])? I can't quite tell from reading i.e.
> https://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Variable-Attributes.html#Variable%20Attributes
> if it does, though most examples I see have the __attribute__ after the variable
> name, i.e.
Sorry, I didn't notice this "before/after" problem. Yes, you're right,
everyone use "__attribute__" at the end. I'll change that.
BTW, using it in the middle works (compile and run) fine from my side.
Thanks,
Zorro
>
> > short array[3] __attribute__ ((aligned));
>
> in the URL above.
>
> -Eric
>
> >
> > int
> > main(int argc, char *argv[])
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-29 15:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-27 5:52 [PATCH] src/nsexec: fix stack pointer alignment exception Zorro Lang
2017-09-27 10:01 ` Carlos Maiolino
2017-09-29 14:44 ` Eric Sandeen
2017-09-29 15:52 ` Zorro Lang
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.