Skip to contentSkip to conversation

MXS: Fix mxs_defconfig MMAP_MIN_ADDR

PATCH New Marek Vasut 3 participants 9 messages Aug 3, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MXS: Fix mxs_defconfig MMAP_MIN_ADDR

Initially reported by Detlev Zundel <[email protected]>, this caused breakage when "su - testuser" was called. "testuser" being a regular user account, the command ended with SIGKILL.

Cc Russell King <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 arch/arm/configs/mxs_defconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/configs/mxs_defconfig +1 -1
index ccdb635..f212802 100644
@@ -34,7 +34,7 @@ CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_AEABI=y
-CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
+CONFIG_DEFAULT_MMAP_MIN_ADDR=32768
 CONFIG_AUTO_ZRELADDR=y
 CONFIG_FPE_NWFPE=y
 CONFIG_NET=y
Signature · 1 line
1.7.10.4
reviewer
#1 lore raw

PATCH 1/1 MXS: Fix mxs_defconfig MMAP_MIN_ADDR

Marek,

Quoted 17 lines · Marek Vasut

Initially reported by Detlev Zundel <[email protected]>, this caused breakage when "su - testuser" was called. "testuser" being a regular user account, the command ended with SIGKILL.

Cc Russell King <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 arch/arm/configs/mxs_defconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/configs/mxs_defconfig +0 -0
index ccdb635..f212802 100644

arch/arm/configs/mxs_defconfig CONFIG_NO_HZ=y · line 37

Quoted 5 lines
arch/arm/configs/mxs_defconfig +1 -1
@@ -34,7 +34,7 @@ CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_AEABI=y
-CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
+CONFIG_DEFAULT_MMAP_MIN_ADDR=32768

No need to set it to 32768.

If you just remove the 'CONFIG_DEFAULT_MMAP_MIN_ADDR=65536' then this symbol will be 32768.

So your patch would become:

arch/arm/configs/mxs_defconfig +0 -1
index ccdb635..4edcfb4 100644
@@ -34,7 +34,6 @@ CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_AEABI=y
-CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
 CONFIG_AUTO_ZRELADDR=y
 CONFIG_FPE_NWFPE=y
 CONFIG_NET=y

Regards,

Fabio Estevam

reviewer
#2 lore raw

PATCH 1/1 MXS: Fix mxs_defconfig MMAP_MIN_ADDR

Quoted 6 lines · Fabio Estevam

Marek,

Quoted 3 lines · Marek Vasut

Initially reported by Detlev Zundel <[email protected]>, this caused breakage when "su - testuser" was called. "testuser" being a regular user account, the command ended with SIGKILL.

Also, please point to the commit that introduced such breakage.

Thanks,

Fabio Estevam

reviewer
#3 lore raw

PATCH 1/1 MXS: Fix mxs_defconfig MMAP_MIN_ADDR

In reply to Fabio Estevam
Quoted 28 lines · Fabio Estevam

Marek,

Quoted 17 lines · Marek Vasut

Initially reported by Detlev Zundel <[email protected]>, this caused breakage when "su - testuser" was called. "testuser" being a regular user account, the command ended with SIGKILL.

Cc Russell King <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 arch/arm/configs/mxs_defconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/configs/mxs_defconfig +0 -0
index ccdb635..f212802 100644

arch/arm/configs/mxs_defconfig CONFIG_NO_HZ=y · line 37

Quoted 5 lines
arch/arm/configs/mxs_defconfig +1 -1
@@ -34,7 +34,7 @@ CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_AEABI=y
-CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
+CONFIG_DEFAULT_MMAP_MIN_ADDR=32768

No need to set it to 32768.

Quoted 2 lines

If you just remove the 'CONFIG_DEFAULT_MMAP_MIN_ADDR=65536' then this symbol will be 32768.

Sorry, ignore what I said. I just realized that the default is 4096.

#4 lore raw

PATCH 1/1 MXS: Fix mxs_defconfig MMAP_MIN_ADDR

Quoted 29 lines · Fabio Estevam
Quoted 28 lines · Fabio Estevam

Marek,

Quoted 17 lines · Marek Vasut

Initially reported by Detlev Zundel <[email protected]>, this caused breakage when "su - testuser" was called. "testuser" being a regular user account, the command ended with SIGKILL.

Cc Russell King <[email protected]>
Cc Shawn Guo <[email protected]>
Cc Wolfgang Denk <[email protected]>
---
 arch/arm/configs/mxs_defconfig |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/configs/mxs_defconfig +0 -0
index ccdb635..f212802 100644

arch/arm/configs/mxs_defconfig CONFIG_NO_HZ=y · line 37

Quoted 5 lines
arch/arm/configs/mxs_defconfig +1 -1
@@ -34,7 +34,7 @@ CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_AEABI=y
-CONFIG_DEFAULT_MMAP_MIN_ADDR=65536
+CONFIG_DEFAULT_MMAP_MIN_ADDR=32768

No need to set it to 32768.

Quoted 4 lines
Quoted 2 lines

If you just remove the 'CONFIG_DEFAULT_MMAP_MIN_ADDR=65536' then this symbol will be 32768.

Sorry, ignore what I said. I just realized that the default is 4096.

4096 is also fine for ARM too. There's not much point in having defconfigs change it - that would just be pure noise in the config files.

reviewer
#5 lore raw

PATCH 1/1 MXS: Fix mxs_defconfig MMAP_MIN_ADDR

Quoted 3 lines · Russell King - ARM Linux

4096 is also fine for ARM too. There's not much point in having defconfigs change it - that would just be pure noise in the config files.

Thanks for the clarification, Russell.

Marek, so maybe you can send a v2 of this patch with my previous suggestion (and also mentioning the offending commit).

I have also removed CONFIG_DEFAULT_MMAP_MIN_ADDR from imx_v6_v7_defconfig.

Regards,

Fabio Estevam

#6 lore raw

PATCH 1/1 MXS: Fix mxs_defconfig MMAP_MIN_ADDR

In reply to Russell King - ARM Linux

Dear Russell King - ARM Linux,

[...]

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

No need to set it to 32768.

If you just remove the 'CONFIG_DEFAULT_MMAP_MIN_ADDR=65536' then this symbol will be 32768.

Sorry, ignore what I said. I just realized that the default is 4096.

4096 is also fine for ARM too. There's not much point in having defconfigs change it - that would just be pure noise in the config files.

Wasn't there a security concern being the reason for setting this higher? Also, I still don't completely understand why ARM has to set it lower than others, is that an ABI thing?

Russell, do you happen to have some further reading for me I could study on this topic please?

Thanks!

Best regards,
Marek Vasut

#7 lore raw

PATCH 1/1 MXS: Fix mxs_defconfig MMAP_MIN_ADDR

Quoted 9 lines · Marek Vasut

Dear Russell King - ARM Linux,

[...]

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

No need to set it to 32768.

If you just remove the 'CONFIG_DEFAULT_MMAP_MIN_ADDR=65536' then this symbol will be 32768.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Sorry, ignore what I said. I just realized that the default is 4096.

4096 is also fine for ARM too. There's not much point in having defconfigs change it - that would just be pure noise in the config files.

Wasn't there a security concern being the reason for setting this higher?

I don't believe there is. The only requirement is that the first page on older CPUs isn't stomped on (and we preserve that for later CPUs so that NULL pointer derefs get caught.)

The higher it is the better though, because it means NULL pointer + offset deref with larger offsets also gets caught.

Quoted 3 lines

Also,
I still don't completely understand why ARM has to set it lower than others, is that an ABI thing?

Yes, we have always loaded user programs at 0x8000 by default, which are generally not relocatable. So if you set it to 64K, you prevent non-root user programs being mapped in, which is why stuff gets killed as soon as UID != 0.

#8 lore raw

PATCH 1/1 MXS: Fix mxs_defconfig MMAP_MIN_ADDR

Dear Russell King - ARM Linux,

Quoted 16 lines · Marek Vasut
Quoted 15 lines

Dear Russell King - ARM Linux,

[...]

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

No need to set it to 32768.

If you just remove the 'CONFIG_DEFAULT_MMAP_MIN_ADDR=65536' then this symbol will be 32768.

Sorry, ignore what I said. I just realized that the default is 4096.

4096 is also fine for ARM too. There's not much point in having defconfigs change it - that would just be pure noise in the config files.

Quoted 8 lines
Quoted 1 line

Wasn't there a security concern being the reason for setting this higher?

I don't believe there is. The only requirement is that the first page on older CPUs isn't stomped on (and we preserve that for later CPUs so that NULL pointer derefs get caught.)

The higher it is the better though, because it means NULL pointer + offset deref with larger offsets also gets caught.

Understood!

Quoted 8 lines
Quoted 3 lines

Also,
I still don't completely understand why ARM has to set it lower than others, is that an ABI thing?

Yes, we have always loaded user programs at 0x8000 by default, which are generally not relocatable. So if you set it to 64K, you prevent non-root user programs being mapped in, which is why stuff gets killed as soon as UID != 0.

I see! Thanks for explaining!

Best regards,
Marek Vasut