• P
    [IA64] fix getpid and set_tid_address fast system calls for pid namespaces · 96ded9da
    Pavel Emelyanov 提交于
    The sys_getpid() and sys_set_tid_address() behavior changed from
    
    	return current->tgid
    
    to
    
    	struct pid *pid;
    	pid = current->pids[PIDTYPE_PID].pid;
    	return pid->numbers[pid->level].nr;
    
    But the fast system calls on ia64 still operate the old way.  Patch them
    appropriately to let ia64 work with pid namespaces.  Besides, this is one more
    step in deprecating of pid and tgid on task_struct.
    
    The fsys_getppid() is to be patched as well, but its logic is much
    more complex now, so I will make it later.
    
    One thing I'm not 100% sure is the trick with the IA64_UPID_SHIFT.  On order
    to access the pid->level's element of an array I have to perform the following
    calculations
    
    	pid + sizeof(struct upid) * pid->level
    
    The problem is that ia64 can only multiply float point registers, while all
    the offsets I have in code are in rXX ones.  Fortunately, the sizeof(struct
    upid) is 32 bytes on ia64 (and is very unlikely to ever change), so the
    calculations get simpler:
    
    	pid + pid->level << 5
    
    So, I introduce the IA64_UPID_SHIFT and use the shl instruction.  I also
    looked at how gcc compiles the similar place and found that it makes it with
    shift as well.  Is this OK to do so?
    
    Tested with ski emulator with 2.6.24 kernel, but fits 2.6.25-rc4 and
    2.6.25-rc4-mm1 as well.
    Signed-off-by: NPavel Emelyanov <xemul@openvz.org>
    Cc: David Mosberger-Tang <davidm@hpl.hp.com>
    Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
    Cc: Fenghua Yu <fenghua.yu@intel.com>
    Cc: Amy Griffis <amy.griffis@hp.com>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NTony Luck <tony.luck@intel.com>
    96ded9da
fsys.S 29.1 KB