linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* arm32 binaries work with CONFIG_COMPAT as root but not as user?
@ 2015-01-28 10:52 Riku Voipio
  2015-01-28 11:22 ` Catalin Marinas
  0 siblings, 1 reply; 6+ messages in thread
From: Riku Voipio @ 2015-01-28 10:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

Perhaps I'm missing here something, but seems I can only run 32bit arm
programs on arm64 system if I am root. So far even the simplest hello
world will be killed/segfaulted on startup. This is on mustang hw.

taking on 3.19-rc3 with arch=arm64 and make defconfig:

wget http://kos.to/hello-test/hello
# file hello
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV),
statically linked, for GNU/Linux 2.6.32,
BuildID[sha1]=c37a3b366d645eee600963a535370fa0bad9b2c0, not stripped
# ./hello
hello world
# su - linaro
$ /root/hello
Segmentation fault
$ gdb /root/hello
(gdb) run
Starting program: /root/hello
During startup program terminated with signal SIGSEGV, Segmentation fault.

If you have a debian/ubuntu system, you can also reproduce it with multiarch:

dpkg --add-architecture armhf
apt-get update
apt-get install hello:armhf
# hello
Hello, world!
# su - ubuntu
$ hello
Segmentation fault
$

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

* arm32 binaries work with CONFIG_COMPAT as root but not as user?
  2015-01-28 10:52 arm32 binaries work with CONFIG_COMPAT as root but not as user? Riku Voipio
@ 2015-01-28 11:22 ` Catalin Marinas
  2015-01-28 11:36   ` Marc Zyngier
  2015-01-28 11:42   ` Riku Voipio
  0 siblings, 2 replies; 6+ messages in thread
From: Catalin Marinas @ 2015-01-28 11:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 28, 2015 at 10:52:21AM +0000, Riku Voipio wrote:
> Perhaps I'm missing here something, but seems I can only run 32bit arm
> programs on arm64 system if I am root. So far even the simplest hello
> world will be killed/segfaulted on startup. This is on mustang hw.
> 
> taking on 3.19-rc3 with arch=arm64 and make defconfig:

It works for me with the arm64 for-next/core branch, I haven't tried
vanilla 3.19-rc3 yet. Do you have other patches applied?

> wget http://kos.to/hello-test/hello
> # file hello
> hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV),
> statically linked, for GNU/Linux 2.6.32,
> BuildID[sha1]=c37a3b366d645eee600963a535370fa0bad9b2c0, not stripped
> # ./hello
> hello world
> # su - linaro
> $ /root/hello
> Segmentation fault
> $ gdb /root/hello
> (gdb) run
> Starting program: /root/hello
> During startup program terminated with signal SIGSEGV, Segmentation fault.

Do you get some kernel message?

This works for me with Debian armel.

> If you have a debian/ubuntu system, you can also reproduce it with multiarch:
> 
> dpkg --add-architecture armhf
> apt-get update
> apt-get install hello:armhf
> # hello
> Hello, world!
> # su - ubuntu
> $ hello
> Segmentation fault
> $

This works as well.

What does this say:

# cat /proc/sys/vm/mmap_min_addr

If it is 64K, it won't run 32-bit apps as non-root.

-- 
Catalin

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

* arm32 binaries work with CONFIG_COMPAT as root but not as user?
  2015-01-28 11:22 ` Catalin Marinas
@ 2015-01-28 11:36   ` Marc Zyngier
  2015-01-28 11:42   ` Riku Voipio
  1 sibling, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2015-01-28 11:36 UTC (permalink / raw)
  To: linux-arm-kernel

On 28/01/15 11:22, Catalin Marinas wrote:
> On Wed, Jan 28, 2015 at 10:52:21AM +0000, Riku Voipio wrote:
>> Perhaps I'm missing here something, but seems I can only run 32bit arm
>> programs on arm64 system if I am root. So far even the simplest hello
>> world will be killed/segfaulted on startup. This is on mustang hw.
>>
>> taking on 3.19-rc3 with arch=arm64 and make defconfig:
> 
> It works for me with the arm64 for-next/core branch, I haven't tried
> vanilla 3.19-rc3 yet. Do you have other patches applied?

I'm running -rc5 on mustang, and this works perfectly fine:

maz at mystery-roach:~$ uname -a
Linux mystery-roach 3.19.0-rc5+ #3704 SMP Wed Jan 28 11:25:36 GMT 2015 aarch64 GNU/Linux
maz at mystery-roach:~$ file hello 
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=c37a3b366d645eee600963a535370fa0bad9b2c0, not stripped
maz at mystery-roach:~$ id
uid=1000(maz) gid=1000(maz) groups=1000(maz),27(sudo),110(kvm)
maz at mystery-roach:~$ ./hello 
hello world

Userspace is Debian arm64 unstable.

	M.
-- 
Jazz is not dead. It just smells funny...

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

* arm32 binaries work with CONFIG_COMPAT as root but not as user?
  2015-01-28 11:22 ` Catalin Marinas
  2015-01-28 11:36   ` Marc Zyngier
@ 2015-01-28 11:42   ` Riku Voipio
  2015-01-28 11:47     ` Catalin Marinas
  1 sibling, 1 reply; 6+ messages in thread
From: Riku Voipio @ 2015-01-28 11:42 UTC (permalink / raw)
  To: linux-arm-kernel

On 28 January 2015 at 13:22, Catalin Marinas <catalin.marinas@arm.com> wrote:
> On Wed, Jan 28, 2015 at 10:52:21AM +0000, Riku Voipio wrote:
> What does this say:
cat /proc/sys/vm/mmap_min_addr
65536

> # cat /proc/sys/vm/mmap_min_addr
>
> If it is 64K, it won't run 32-bit apps as non-root.

echo 32768 > /proc/sys/vm/mmap_min_addr

and indeed binaries work as expected.

The ubuntu LTS 3.13 kernel has:

/boot/config-3.13.0-39-generic:CONFIG_DEFAULT_MMAP_MIN_ADDR=65536

I need to check how the value ended up wrong on the 3.19-rc3 I tested.

> --
> Catalin

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

* arm32 binaries work with CONFIG_COMPAT as root but not as user?
  2015-01-28 11:42   ` Riku Voipio
@ 2015-01-28 11:47     ` Catalin Marinas
  2015-01-28 14:16       ` Riku Voipio
  0 siblings, 1 reply; 6+ messages in thread
From: Catalin Marinas @ 2015-01-28 11:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jan 28, 2015 at 11:42:55AM +0000, Riku Voipio wrote:
> On 28 January 2015 at 13:22, Catalin Marinas <catalin.marinas@arm.com> wrote:
> > On Wed, Jan 28, 2015 at 10:52:21AM +0000, Riku Voipio wrote:
> > What does this say:
> cat /proc/sys/vm/mmap_min_addr
> 65536
> 
> > # cat /proc/sys/vm/mmap_min_addr
> >
> > If it is 64K, it won't run 32-bit apps as non-root.
> 
> echo 32768 > /proc/sys/vm/mmap_min_addr
> 
> and indeed binaries work as expected.
> 
> The ubuntu LTS 3.13 kernel has:
> 
> /boot/config-3.13.0-39-generic:CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
> 
> I need to check how the value ended up wrong on the 3.19-rc3 I tested.

It may be set by some boot script on arm64 Ubuntu (so entirely in user
space).

-- 
Catalin

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

* arm32 binaries work with CONFIG_COMPAT as root but not as user?
  2015-01-28 11:47     ` Catalin Marinas
@ 2015-01-28 14:16       ` Riku Voipio
  0 siblings, 0 replies; 6+ messages in thread
From: Riku Voipio @ 2015-01-28 14:16 UTC (permalink / raw)
  To: linux-arm-kernel

On 28 January 2015 at 13:47, Catalin Marinas <catalin.marinas@arm.com> wrote:
> On Wed, Jan 28, 2015 at 11:42:55AM +0000, Riku Voipio wrote:
>> On 28 January 2015 at 13:22, Catalin Marinas <catalin.marinas@arm.com> wrote:
>> > On Wed, Jan 28, 2015 at 10:52:21AM +0000, Riku Voipio wrote:
>> > What does this say:
>> cat /proc/sys/vm/mmap_min_addr
>> 65536
>>
>> > # cat /proc/sys/vm/mmap_min_addr
>> >
>> > If it is 64K, it won't run 32-bit apps as non-root.
>>
>> echo 32768 > /proc/sys/vm/mmap_min_addr
>>
>> and indeed binaries work as expected.
>>
>> The ubuntu LTS 3.13 kernel has:
>>
>> /boot/config-3.13.0-39-generic:CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
>>
>> I need to check how the value ended up wrong on the 3.19-rc3 I tested.
>
> It may be set by some boot script on arm64 Ubuntu (so entirely in user
> space).

Correct, the invalid value is set in /etc/sysctl.d/10-zeropage.conf.
I've also opened a bug for the ubuntu folk to fix.

https://bugs.launchpad.net/ubuntu/+source/procps/+bug/1415481

Riku

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

end of thread, other threads:[~2015-01-28 14:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-28 10:52 arm32 binaries work with CONFIG_COMPAT as root but not as user? Riku Voipio
2015-01-28 11:22 ` Catalin Marinas
2015-01-28 11:36   ` Marc Zyngier
2015-01-28 11:42   ` Riku Voipio
2015-01-28 11:47     ` Catalin Marinas
2015-01-28 14:16       ` Riku Voipio

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).