Bug 229304 - [patch] vdso is in user's way when exec-shield is off
Summary: [patch] vdso is in user's way when exec-shield is off
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 9
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Roland McGrath
QA Contact: Brian Brock
URL:
Whiteboard: bzcl34nup
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-02-20 03:48 UTC by John Reiser
Modified: 2008-06-06 07:44 UTC (History)
5 users (show)

Fixed In Version: 2.6.25.4-30.fc9
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-06-06 07:44:34 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
put vdso at STACK_TOP when 0==exec_shield (888 bytes, patch)
2007-02-20 03:48 UTC, John Reiser
no flags Details | Diff
linux-2.6-x86-vdso-place.patch (1.25 KB, patch)
2007-02-21 22:13 UTC, John Reiser
no flags Details | Diff

Description John Reiser 2007-02-20 03:48:32 UTC
Description of problem: On i386 the vdso is still being placed randomly even
when exec-shield is off.  This interferes with the user address space, because
the vdso cannot be moved.  Random placement reduces the contiguous space that
otherwise would be available to the user.  This is somewhat OK when exec-shield
is on, but is not reasonable when exec-shield is off.  Instead, when exec-shield
is off, then the vdso should be placed at STACK_TOP, in order to interfere as
little as possible with the user's use of address space.  i686 boxes still must
provide service for a while longer [before being replaced by x86_64 with 64-bit
address space where the problem does not arise], including running applications
that want maximal contiguous address space.


Version-Release number of selected component (if applicable):
kernel-2.6.20-1.2932.fc7

How reproducible:
always

Steps to Reproduce:
1. echo 0 >/proc/sys/kernel/exec-shield  # turn off exec-shield
2. grep vdso /proc/self/maps
3.
  
Actual results:
00924000-00925000 r-xp 00924000 00:00 0          [vdso]
# or other address below 0x08048000

Expected results:
bffff000-c0000000 r-xp bffff000 00:00 0          [vdso]
# one page below TASK_SIZE

Additional info:
Related: bug 207020 (vDSO placement ignores exec-shield; inhibits NX simulation)

See suggested patch linux-2.6-x86-vdso-stacktop-0.patch (attached.)

Comment 1 John Reiser 2007-02-20 03:48:32 UTC
Created attachment 148397 [details]
put vdso at STACK_TOP when 0==exec_shield

Comment 2 Chuck Ebbert 2007-02-20 14:43:24 UTC
vDSO randomization is a feature added to the upstream kernel.
I don't think anybody thought about an off switch for it.
You could try:
    echo 0>/proc/sys/kernel/randomize_va_space

The only other thing I can suggest is trying the kernel boot parameter
"vdso=0", which will disable it completely. This may or may not be useful,
and your system might not even boot with that set.


Comment 3 John Reiser 2007-02-20 16:20:05 UTC
Setting to zero all three of vdso, vdso_populate, and randomize_va_space still
gives a random page for vdso in 2.6.19-1.2911.fc6.  The f7 development
installers via rescue CD and diskboot.img fail today; I'll test there soon.

Comment 4 Chuck Ebbert 2007-02-20 16:47:48 UTC
Try /proc/sys/vm/vdso_enabled?



Comment 5 John Reiser 2007-02-20 20:24:32 UTC
Also setting vdso_enabled to zero (along with the three other variables
mentioned before) still gives a random page for vdso in 2.6.19-1.2911.fc6.

Comment 6 John Reiser 2007-02-21 22:13:33 UTC
Created attachment 148544 [details]
linux-2.6-x86-vdso-place.patch

This patch to kernel-2.6.20-1.2936.fc7 places vdso for i386 according to the
value in /proc/sys/vm/vdso_enabled:
0: no vdso at all
1: random free page
2: STACK_TOP
3: just below the .text of main
4: just below the .text of PT_INTERP

Comment 7 Chuck Ebbert 2007-02-22 00:23:56 UTC
Did you send your patch to the linux-kernel mailing list?
If not, please do.


Comment 8 John Reiser 2007-02-22 21:09:12 UTC
Cross-reference:
http://lkml.org/lkml/2007/2/22/301
fully honor vdso_enabled [i386, sh; x86_64?]	John Reiser

Comment 9 Chuck Ebbert 2007-03-01 19:26:34 UTC
Hmm, /proc/sys/vm/legacy_va_layout changes things. Not sure if it's
what you want, though.



Comment 10 Bill Nottingham 2007-03-02 17:41:52 UTC
Moving to 'devel' as discussed on
https://www.redhat.com/archives/fedora-devel-list/2007-March/msg00095.html.

Comment 11 Chuck Ebbert 2007-04-27 20:18:40 UTC
You need to disable the vdso at boot time. Once booted it can't be changed
AFAICT. So try booting with "vdso=0".


Comment 12 Bug Zapper 2008-04-03 19:12:01 UTC
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

Comment 13 John Reiser 2008-04-07 02:42:53 UTC
The problem persists in 2.6.25-0.195.rc8.git1.fc9.i686, and has gotten worse. 
There is no way to turn off the vdso, not even booting with " vdso=0" appended
to the kernel boot commandline.  /proc/sys/vm/vdso_enabled says 0, but "grep
vdso /proc/self/maps" still shows a vdso:
-----
$ grep vdso /proc/self/maps
00131000-00132000 r-xp 00131000 00:00 0          [vdso]
-----



Comment 14 Chuck Ebbert 2008-04-08 19:14:24 UTC
Does 'nosep' work?

Comment 15 Chuck Ebbert 2008-04-27 04:46:18 UTC
'nosep' should completely disable any VDSO by pretending the CPU doesn't support
the sysenter instruction.

Comment 16 Roland McGrath 2008-04-27 20:12:22 UTC
That's not so, Chuck.  That only affects the choice of which vDSO image to use.

Comment 17 Chuck Ebbert 2008-04-29 19:36:32 UTC
Patches were merged upstream for this:

5de253cc5b1f565f7aeb5bacd67bac37e943ceef
x86 vDSO: don't map 32-bit vdso when disabled

and

1a3e4ca41c5a38975023a6e8831c309d3322889c
x86 vDSO: don't use disabled vDSO for signal trampoline


Comment 18 Bug Zapper 2008-05-14 02:38:09 UTC
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 19 Chuck Ebbert 2008-05-20 07:16:08 UTC
Patches in 2.6.25.4-27

Comment 20 Fedora Update System 2008-05-22 15:33:08 UTC
kernel-2.6.25.4-30.fc9 has been submitted as an update for Fedora 9

Comment 21 Fedora Update System 2008-05-29 02:51:17 UTC
kernel-2.6.25.4-30.fc9 has been pushed to the Fedora 9 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update kernel'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F9/FEDORA-2008-4630

Comment 22 Fedora Update System 2008-06-06 07:44:15 UTC
kernel-2.6.25.4-30.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.