All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/64e: Don't place the stack beyond TASK_SIZE
@ 2017-05-05  6:31 Scott Wood
  2017-05-08 14:09 ` Michael Ellerman
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2017-05-05  6:31 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood, Aneesh Kumar K . V

Commit f4ea6dcb08ea ("powerpc/mm: Enable mappings above 128TB") increased
the task size on book3s, and introduced a mechanism to dynamically
control whether a task uses these larger addresses.  While the change to
the task size itself was ifdef-protected to only apply on book3s, the
change to STACK_TOP_USER64 was not.  On book3e, this had the effect of
trying to use addresses up to 128TiB for the stack despite a 64TiB task
size limit -- which broke 64-bit userspace producing the following errors:

Starting init: /sbin/init exists but couldn't execute it (error -14)
Starting init: /bin/sh exists but couldn't execute it (error -14)
Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.

Fixes: f4ea6dcb08ea ("powerpc/mm: Enable mappings above 128TB")
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Scott Wood <oss@buserror.net>
---
 arch/powerpc/include/asm/processor.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index a4b1d8d6b793..a2123f291ab0 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -151,8 +151,13 @@ void release_thread(struct task_struct *);
 
 #ifdef __powerpc64__
 
+#ifdef CONFIG_PPC_BOOK3S_64
 /* Limit stack to 128TB */
 #define STACK_TOP_USER64 TASK_SIZE_128TB
+#else
+#define STACK_TOP_USER64 TASK_SIZE_USER64
+#endif
+
 #define STACK_TOP_USER32 TASK_SIZE_USER32
 
 #define STACK_TOP (is_32bit_task() ? \
-- 
2.11.0

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

* Re: [PATCH] powerpc/64e: Don't place the stack beyond TASK_SIZE
  2017-05-05  6:31 [PATCH] powerpc/64e: Don't place the stack beyond TASK_SIZE Scott Wood
@ 2017-05-08 14:09 ` Michael Ellerman
  2017-05-08 15:52   ` Scott Wood
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2017-05-08 14:09 UTC (permalink / raw)
  To: Scott Wood, linuxppc-dev; +Cc: Scott Wood, Aneesh Kumar K . V

Scott Wood <oss@buserror.net> writes:

> Commit f4ea6dcb08ea ("powerpc/mm: Enable mappings above 128TB") increased
> the task size on book3s, and introduced a mechanism to dynamically
> control whether a task uses these larger addresses.  While the change to
> the task size itself was ifdef-protected to only apply on book3s, the
> change to STACK_TOP_USER64 was not.  On book3e, this had the effect of
> trying to use addresses up to 128TiB for the stack despite a 64TiB task
> size limit -- which broke 64-bit userspace producing the following errors:
>
> Starting init: /sbin/init exists but couldn't execute it (error -14)
> Starting init: /bin/sh exists but couldn't execute it (error -14)
> Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.

For some reason I am not seeing this on my p5020ds?

I just checked, it's definitely booting:

  [    0.000000] Linux version 4.11.0-gcc5-g13e0988 (kerkins@alpine1-p1) (gcc version 5.2.1 20151001 (GCC) ) #1 SMP Mon May 8 05:33:22 AEST 2017
  [    0.000000] Using CoreNet Generic machine description
  ...
  [    3.216940] systemd[1]: Detected architecture ppc64.
  ...
  Debian GNU/Linux stretch/sid p5020ds ttyS0
  
  p5020ds login:


Anyway patch looks good, I'll pull it in with the rest of your tree.

cheers

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

* Re: [PATCH] powerpc/64e: Don't place the stack beyond TASK_SIZE
  2017-05-08 14:09 ` Michael Ellerman
@ 2017-05-08 15:52   ` Scott Wood
  2017-05-09 21:13     ` Michael Ellerman
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2017-05-08 15:52 UTC (permalink / raw)
  To: Michael Ellerman, linuxppc-dev; +Cc: Aneesh Kumar K . V

On Tue, 2017-05-09 at 00:09 +1000, Michael Ellerman wrote:
> Scott Wood <oss@buserror.net> writes:
> 
> > Commit f4ea6dcb08ea ("powerpc/mm: Enable mappings above 128TB") increased
> > the task size on book3s, and introduced a mechanism to dynamically
> > control whether a task uses these larger addresses.  While the change to
> > the task size itself was ifdef-protected to only apply on book3s, the
> > change to STACK_TOP_USER64 was not.  On book3e, this had the effect of
> > trying to use addresses up to 128TiB for the stack despite a 64TiB task
> > size limit -- which broke 64-bit userspace producing the following errors:
> > 
> > Starting init: /sbin/init exists but couldn't execute it (error -14)
> > Starting init: /bin/sh exists but couldn't execute it (error -14)
> > Kernel panic - not syncing: No working init found.  Try passing init=
> > option to kernel. See Linux Documentation/admin-guide/init.rst for
> > guidance.
> 
> For some reason I am not seeing this on my p5020ds?
> 
> I just checked, it's definitely booting:
> 
>   [    0.000000] Linux version 4.11.0-gcc5-g13e0988 (kerkins@alpine1-p1)
> (gcc version 5.2.1 20151001 (GCC) ) #1 SMP Mon May 8 05:33:22 AEST 2017
>   [    0.000000] Using CoreNet Generic machine description
>   ...
>   [    3.216940] systemd[1]: Detected architecture ppc64.
>   ...
>   Debian GNU/Linux stretch/sid p5020ds ttyS0
>   
>   p5020ds login:
> 
> 
> Anyway patch looks good, I'll pull it in with the rest of your tree.

Are you using a 64-bit userspace?

-Scott

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

* Re: [PATCH] powerpc/64e: Don't place the stack beyond TASK_SIZE
  2017-05-08 15:52   ` Scott Wood
@ 2017-05-09 21:13     ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2017-05-09 21:13 UTC (permalink / raw)
  To: Scott Wood, linuxppc-dev; +Cc: Aneesh Kumar K . V

Scott Wood <oss@buserror.net> writes:

> On Tue, 2017-05-09 at 00:09 +1000, Michael Ellerman wrote:
>> Scott Wood <oss@buserror.net> writes:
>>=20
>> > Commit f4ea6dcb08ea ("powerpc/mm: Enable mappings above 128TB") increa=
sed
>> > the task size on book3s, and introduced a mechanism to dynamically
>> > control whether a task uses these larger addresses.=C2=A0=C2=A0While t=
he change to
>> > the task size itself was ifdef-protected to only apply on book3s, the
>> > change to STACK_TOP_USER64 was not.=C2=A0=C2=A0On book3e, this had the=
 effect of
>> > trying to use addresses up to 128TiB for the stack despite a 64TiB task
>> > size limit -- which broke 64-bit userspace producing the following err=
ors:
>> >=20
>> > Starting init: /sbin/init exists but couldn't execute it (error -14)
>> > Starting init: /bin/sh exists but couldn't execute it (error -14)
>> > Kernel panic - not syncing: No working init found.=C2=A0=C2=A0Try pass=
ing init=3D
>> > option to kernel. See Linux Documentation/admin-guide/init.rst for
>> > guidance.
>>=20
>> For some reason I am not seeing this on my p5020ds?
>>=20
>> I just checked, it's definitely booting:
>>=20
>> =C2=A0 [=C2=A0=C2=A0=C2=A0=C2=A00.000000] Linux version 4.11.0-gcc5-g13e=
0988 (kerkins@alpine1-p1)
>> (gcc version 5.2.1 20151001 (GCC) ) #1 SMP Mon May 8 05:33:22 AEST 2017
>> =C2=A0 [=C2=A0=C2=A0=C2=A0=C2=A00.000000] Using CoreNet Generic machine =
description
>> =C2=A0 ...
>> =C2=A0 [=C2=A0=C2=A0=C2=A0=C2=A03.216940] systemd[1]: Detected architect=
ure ppc64.
>> =C2=A0 ...
>> =C2=A0 Debian GNU/Linux stretch/sid p5020ds ttyS0
>> =C2=A0=C2=A0
>> =C2=A0 p5020ds login:
>>=20
>>=20
>> Anyway patch looks good, I'll pull it in with the rest of your tree.
>
> Are you using a 64-bit userspace?

Ah of course. It's debian so it's mostly 32-bit. I'd forgotten 32-bit
userspace was a thing! :)

I'll fix my tests to run some 64-bit binaries.

cheers

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

end of thread, other threads:[~2017-05-09 21:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05  6:31 [PATCH] powerpc/64e: Don't place the stack beyond TASK_SIZE Scott Wood
2017-05-08 14:09 ` Michael Ellerman
2017-05-08 15:52   ` Scott Wood
2017-05-09 21:13     ` Michael Ellerman

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.