public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Reiser <jreiser@BitWagon.com>
To: linux-kernel@vger.kernel.org
Subject: control placement of vDSO page
Date: Mon, 12 Dec 2005 07:29:43 -0800	[thread overview]
Message-ID: <439D9767.2000208@BitWagon.com> (raw)

The vDSO page is getting in the way of applications on i686 (i386).
There is a performance problem, a problem with a dangling pointer
in the kernel, and a loss of control in the kernel<->user interface.
A possible solution might be a new system call to move the vDSO page.

Performance: the kernel chooses the vDSO page after mapping the main
program and the PT_INTERP [see fs/binfmt_elf.c].  If pre-linking chose
that same page for some subsequent shared library, then the pre-linking
is discarded, which costs time.  In Fedora Core 4 i686 with random vDSO
placement, the probability is about 7% that a main program with just one
shared library must relocate libc.so.6.  Cascading conflicts and costs
are likely; a program with dozens of shared libs is almost certain
to require expensive runtime relocation processing of shared libraries.

Dangling pointer: setup_frame() in arch/i386/kernel/signal.c uses
        restorer = current->mm->context.vdso + (long)&__kernel_sigreturn;
whenever !(.sa_flags & SA_RESTORER).  Unfortunately, context.vdso is
never changed, so if the user re-maps the vDSO page then the kernel
has a dangling pointer which makes user return from signal unreliable.

Loss of control: in a 32-bit address there are at most one million
4KB pages.  Maintaining contiguous ranges for large arrarys is a problem.
Having no control over placement of the vDSO page makes things worse.
Programs that audit or measure the running of other programs in the
same address space, desire to place the vDSO page after mapping
the programs that are being examined.

Possible solution: a new system call  move_vdso(old_addr, new_addr, flags).
Check that current vDSO was at old_addr, else error.  Change vDSO page
under control of flags like in mmap(): new_addr is hint (place to start
search) or required address if MAP_FIXED.  Return value is new vDSO address.

For some history and examples see
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=162797

Comments?

-- 
John Reiser, jreiser@BitWagon.com

             reply	other threads:[~2005-12-12 15:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-12 15:29 John Reiser [this message]
2005-12-12 19:39 ` control placement of vDSO page Ingo Oeser
2005-12-12 20:58   ` John Reiser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=439D9767.2000208@BitWagon.com \
    --to=jreiser@bitwagon.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox