Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-19 Thread Andy Lutomirski
On Sep 19, 2014 8:46 PM, "Filipe Brandenburger" wrote: > > On Fri, Sep 19, 2014 at 8:27 PM, Andy Lutomirski wrote: > >> I thought of doing that from the prctl but AFAICT remap_pfn_range > >> requires that it's unmapped before the call (remap_pte_range has > >> BUG_ON(!pte_none(*pte));) and doing

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-19 Thread Filipe Brandenburger
On Fri, Sep 19, 2014 at 8:27 PM, Andy Lutomirski wrote: >> I thought of doing that from the prctl but AFAICT remap_pfn_range >> requires that it's unmapped before the call (remap_pte_range has >> BUG_ON(!pte_none(*pte));) and doing a zap_page_range followed by >> remap_pfn_range might incur a race

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-19 Thread Andy Lutomirski
On Fri, Sep 19, 2014 at 8:10 PM, Filipe Brandenburger wrote: > Hi Andy, > > On Fri, Sep 19, 2014 at 3:31 PM, Andy Lutomirski wrote: >>> Sorry if I wasn't clear... That's the exact point of my patch, to make >>> vm_special_mapping local to the task. >>> >>> I started with an approach of keeping a

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-19 Thread Filipe Brandenburger
Hi Andy, On Fri, Sep 19, 2014 at 3:31 PM, Andy Lutomirski wrote: >> Sorry if I wasn't clear... That's the exact point of my patch, to make >> vm_special_mapping local to the task. >> >> I started with an approach of keeping a struct vm_special_mapping + a >> struct page * array per mm_struct. >>

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-19 Thread Andy Lutomirski
On Fri, Sep 19, 2014 at 3:19 PM, Filipe Brandenburger wrote: > Hi, > > On Fri, Sep 19, 2014 at 3:09 PM, Andy Lutomirski wrote: >> On Fri, Sep 19, 2014 at 3:02 PM, Filipe Brandenburger >> wrote: >>> In case that's useful, I was looking at swapping the vvar page by >>> changing the vm_special_map

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-19 Thread Filipe Brandenburger
Hi, On Fri, Sep 19, 2014 at 3:09 PM, Andy Lutomirski wrote: > On Fri, Sep 19, 2014 at 3:02 PM, Filipe Brandenburger > wrote: >> In case that's useful, I was looking at swapping the vvar page by >> changing the vm_special_mapping to change the pages array between the >> actual vvar page and the

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-19 Thread Andy Lutomirski
On Fri, Sep 19, 2014 at 3:02 PM, Filipe Brandenburger wrote: > Hi Andy, > > On Fri, Sep 19, 2014 at 12:27 PM, Andy Lutomirski wrote: >> I have this (special mapping tracking) 3/4 implemented. I'm planning >> on making it fully functional for 64-bit programs and almost correct >> for 32-bit. (Yo

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-19 Thread Filipe Brandenburger
Hi Andy, On Fri, Sep 19, 2014 at 12:27 PM, Andy Lutomirski wrote: > I have this (special mapping tracking) 3/4 implemented. I'm planning > on making it fully functional for 64-bit programs and almost correct > for 32-bit. (You'll still crash if you have multiple threads, you use > sysenter, and

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-19 Thread Richard Larocque
On Fri, Sep 19, 2014 at 12:27 PM, Andy Lutomirski wrote: > On Wed, Sep 17, 2014 at 7:28 AM, Andy Lutomirski wrote: >> On Sep 17, 2014 1:46 AM, "H. Peter Anvin" wrote: >>> >>> On 09/16/2014 11:21 PM, Filipe Brandenburger wrote: >>> > Hi Andy, >>> > >>> > On Tue, Sep 16, 2014 at 10:00 PM, Andy Lut

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-19 Thread Andy Lutomirski
On Wed, Sep 17, 2014 at 7:28 AM, Andy Lutomirski wrote: > On Sep 17, 2014 1:46 AM, "H. Peter Anvin" wrote: >> >> On 09/16/2014 11:21 PM, Filipe Brandenburger wrote: >> > Hi Andy, >> > >> > On Tue, Sep 16, 2014 at 10:00 PM, Andy Lutomirski >> > wrote: >> >> I think that the patch should instead

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-17 Thread Andy Lutomirski
On Sep 17, 2014 1:46 AM, "H. Peter Anvin" wrote: > > On 09/16/2014 11:21 PM, Filipe Brandenburger wrote: > > Hi Andy, > > > > On Tue, Sep 16, 2014 at 10:00 PM, Andy Lutomirski > > wrote: > >> I think that the patch should instead tweak the vvar mapping to tell > >> the vdso not to use rdtsc. It

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-17 Thread Filipe Brandenburger
Hi, On Wed, Sep 17, 2014 at 1:46 AM, H. Peter Anvin wrote: > Why would we need/want per process vvar contents? It seems better to > have the code swapped out. We are looking at the migration use case (CRIU). In specific, we want to make CLOCK_MONOTONIC keep the "monotonic" promise after migrat

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-17 Thread Kevin Easton
On Tue, Sep 16, 2014 at 05:05:51PM -0700, Richard Larocque wrote: > + case PR_SET_VDSO: > + if (arg2 == PR_VDSO_ENABLE) > + me->signal->disable_vdso = 0; > + else if (arg2 == PR_VDSO_DISABLE) > + me->signal->disable_vdso = 1; > +

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-17 Thread H. Peter Anvin
On 09/16/2014 11:21 PM, Filipe Brandenburger wrote: > Hi Andy, > > On Tue, Sep 16, 2014 at 10:00 PM, Andy Lutomirski wrote: >> I think that the patch should instead tweak the vvar mapping to tell >> the vdso not to use rdtsc. It should be based on this: > > I've been working on this approach wh

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-16 Thread Filipe Brandenburger
Hi Andy, On Tue, Sep 16, 2014 at 10:00 PM, Andy Lutomirski wrote: > I think that the patch should instead tweak the vvar mapping to tell > the vdso not to use rdtsc. It should be based on this: I've been working on this approach which extends the vvar from 2 to 3 pages. The third page would ini

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-16 Thread Andy Lutomirski
On Tue, Sep 16, 2014 at 10:00 PM, Andy Lutomirski wrote: > On Tue, Sep 16, 2014 at 6:18 PM, Richard Larocque > wrote: >> On Tue, Sep 16, 2014 at 5:27 PM, Andy Lutomirski wrote: > I think that the patch should instead tweak the vvar mapping to tell > the vdso not to use rdtsc. It should be base

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-16 Thread Andy Lutomirski
On Tue, Sep 16, 2014 at 6:18 PM, Richard Larocque wrote: > On Tue, Sep 16, 2014 at 5:27 PM, Andy Lutomirski wrote: >> On Tue, Sep 16, 2014 at 5:05 PM, Richard Larocque >> wrote: >>> Adds new prctl calls to enable or disable VDSO loading for a process >>> and its children. >>> >>> The PR_SET_DIS

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-16 Thread Richard Larocque
On Tue, Sep 16, 2014 at 5:27 PM, Andy Lutomirski wrote: > On Tue, Sep 16, 2014 at 5:05 PM, Richard Larocque > wrote: >> Adds new prctl calls to enable or disable VDSO loading for a process >> and its children. >> >> The PR_SET_DISABLE_VDSO call takes one argument, which is interpreted as >> a bo

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-16 Thread Andy Lutomirski
On Tue, Sep 16, 2014 at 5:05 PM, Richard Larocque wrote: > Adds new prctl calls to enable or disable VDSO loading for a process > and its children. > > The PR_SET_DISABLE_VDSO call takes one argument, which is interpreted as > a boolean value. If true, it disables the loading of the VDSO on exec(

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-16 Thread Richard Larocque
On Tue, Sep 16, 2014 at 5:13 PM, Andi Kleen wrote: > Richard Larocque writes: > > Perhaps I'm missing something, but how do you modify the AUX vector > for the children? > >> +config VDSO_DISABLE_PRCTL >> + depends on X86 >> + bool "prctl to disable VDSO loading" >> + ---help--- >> +

Re: [PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-16 Thread Andi Kleen
Richard Larocque writes: Perhaps I'm missing something, but how do you modify the AUX vector for the children? > +config VDSO_DISABLE_PRCTL > + depends on X86 > + bool "prctl to disable VDSO loading" > + ---help--- > + Enabling this option adds support for prctl calls that >

[PATCH] x86/vdso: Add prctl to set per-process VDSO load

2014-09-16 Thread Richard Larocque
Adds new prctl calls to enable or disable VDSO loading for a process and its children. The PR_SET_DISABLE_VDSO call takes one argument, which is interpreted as a boolean value. If true, it disables the loading of the VDSO on exec() for this process and any children created after this call. A fal