21 Sep, 2011

1 commit

  • do_signal() does __put_user() which can fault, resulting in a might_sleep()
    warning in down_read(&mm->mmap_sem) and a "scheduling while atomic" warning
    when mmap_sem is contented. On Swarm this also results in:

    WARNING: at kernel/smp.c:459 smp_call_function_many+0x148/0x398()
    Modules linked in:
    Call Trace:

    [] dump_stack+0x1c/0x50
    [] warn_slowpath_common+0x8c/0xc8
    [] warn_slowpath_null+0x2c/0x40
    [] smp_call_function_many+0x148/0x398
    [] smp_call_function+0x58/0xa8
    [] r4k_flush_data_cache_page+0x54/0xd8
    [] handle_pte_fault+0xa9c/0xad0
    [] handle_mm_fault+0x158/0x200
    [] do_page_fault+0x218/0x3b0
    [] ret_from_exception+0x0/0x10
    [] copy_siginfo_to_user32+0x50/0x298
    [] setup_rt_frame_32+0x90/0x250
    [] do_notify_resume+0x154/0x358
    [] work_notifysig+0xc/0x14

    Fixed by enabling interrupts in do_notify_resume before delivering signals.

    [ralf@linux-mips.org: Reported and original fix by tglx but I wanted to
    minimize the amount of code being run with interrupts disabled so I moved
    the local_irq_disable() call right into do_notify_resume. Which is saner
    than doing it in entry.S.]

    Reported-by: Thomas Gleixner
    Signed-off-by: Ralf Baechle

    Ralf Baechle
     

15 Mar, 2011

1 commit

  • GCC-4.6 can find more unused code than previous versions could.

    In the case of protected_restore_fp_context{,32}, the variable tmp is
    really used. Its use is tricky in that we really care about the side
    effects of the __put_user() calls. So we must mark tmp with
    __maybe_unused to quiet the warning.

    Signed-off-by: David Daney
    To: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/2035/
    Signed-off-by: Ralf Baechle

    David Daney
     

18 Oct, 2010

3 commits

  • o32 compat does the right thing, native and n32 compat do not...

    Signed-off-by: Al Viro
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-arch@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: http://patchwork.linux-mips.org/patch/1700/
    Signed-off-by: Ralf Baechle

    Al Viro
     
  • Put the original syscall number into ->regs[0] when we leave syscall
    with error. Use it in restart logics. Everything else will have
    it 0 since we pass through SAVE_SOME on all the ways in. Note that
    in places like bad_stack and inllegal_syscall we leave it 0 - it's not
    restartable.

    Signed-off-by: Al Viro
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-arch@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/1698/
    Signed-off-by: Ralf Baechle

    Al Viro
     
  • Signed-off-by: Al Viro
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-arch@vger.kernel.org
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/1696/
    Signed-off-by: Ralf Baechle

    Al Viro
     

13 Apr, 2010

1 commit

  • This is a follow on to the vdso patch.

    Since all processes now have signal trampolines permanently mapped, we
    can use those instead of putting the trampoline on the stack and
    invalidating the corresponding icache across all CPUs. We also get rid
    of a bunch of ICACHE_REFILLS_WORKAROUND_WAR code.

    [Ralf: GDB 7.1 which has the necessary modifications to allow backtracing
    over signal frames will supposedly be released tomorrow. The old signal
    frame format obsoleted by this patch exists in two variations, for sane
    processors and for those requiring ICACHE_REFILLS_WORKAROUND_WAR. So
    there was never a GDB which did support backtracing over signal frames
    on all MIPS systems. This convinved me this series should be applied and
    pushed upstream as soon as possible.]

    Signed-off-by: David Daney
    To: linux-mips@linux-mips.org
    Patchwork: http://patchwork.linux-mips.org/patch/974/
    Signed-off-by: Ralf Baechle

    David Daney
     

17 Dec, 2009

1 commit


09 Sep, 2009

1 commit


02 Sep, 2009

2 commits

  • Add a keyctl to install a process's session keyring onto its parent. This
    replaces the parent's session keyring. Because the COW credential code does
    not permit one process to change another process's credentials directly, the
    change is deferred until userspace next starts executing again. Normally this
    will be after a wait*() syscall.

    To support this, three new security hooks have been provided:
    cred_alloc_blank() to allocate unset security creds, cred_transfer() to fill in
    the blank security creds and key_session_to_parent() - which asks the LSM if
    the process may replace its parent's session keyring.

    The replacement may only happen if the process has the same ownership details
    as its parent, and the process has LINK permission on the session keyring, and
    the session keyring is owned by the process, and the LSM permits it.

    Note that this requires alteration to each architecture's notify_resume path.
    This has been done for all arches barring blackfin, m68k* and xtensa, all of
    which need assembly alteration to support TIF_NOTIFY_RESUME. This allows the
    replacement to be performed at the point the parent process resumes userspace
    execution.

    This allows the userspace AFS pioctl emulation to fully emulate newpag() and
    the VIOCSETTOK and VIOCSETTOK2 pioctls, all of which require the ability to
    alter the parent process's PAG membership. However, since kAFS doesn't use
    PAGs per se, but rather dumps the keys into the session keyring, the session
    keyring of the parent must be replaced if, for example, VIOCSETTOK is passed
    the newpag flag.

    This can be tested with the following program:

    #include
    #include
    #include

    #define KEYCTL_SESSION_TO_PARENT 18

    #define OSERROR(X, S) do { if ((long)(X) == -1) { perror(S); exit(1); } } while(0)

    int main(int argc, char **argv)
    {
    key_serial_t keyring, key;
    long ret;

    keyring = keyctl_join_session_keyring(argv[1]);
    OSERROR(keyring, "keyctl_join_session_keyring");

    key = add_key("user", "a", "b", 1, keyring);
    OSERROR(key, "add_key");

    ret = keyctl(KEYCTL_SESSION_TO_PARENT);
    OSERROR(ret, "KEYCTL_SESSION_TO_PARENT");

    return 0;
    }

    Compiled and linked with -lkeyutils, you should see something like:

    [dhowells@andromeda ~]$ keyctl show
    Session Keyring
    -3 --alswrv 4043 4043 keyring: _ses
    355907932 --alswrv 4043 -1 \_ keyring: _uid.4043
    [dhowells@andromeda ~]$ /tmp/newpag
    [dhowells@andromeda ~]$ keyctl show
    Session Keyring
    -3 --alswrv 4043 4043 keyring: _ses
    1055658746 --alswrv 4043 4043 \_ user: a
    [dhowells@andromeda ~]$ /tmp/newpag hello
    [dhowells@andromeda ~]$ keyctl show
    Session Keyring
    -3 --alswrv 4043 4043 keyring: hello
    340417692 --alswrv 4043 4043 \_ user: a

    Where the test program creates a new session keyring, sticks a user key named
    'a' into it and then installs it on its parent.

    Signed-off-by: David Howells
    Signed-off-by: James Morris

    David Howells
     
  • Implement TIF_NOTIFY_RESUME for most of those architectures in which isn't yet
    available, and, whilst we're at it, have it call the appropriate tracehook.

    After this patch, blackfin, m68k* and xtensa still lack support and need
    alteration of assembly code to make it work.

    Resume notification can then be used (by a later patch) to install a new
    session keyring on the parent of a process.

    Signed-off-by: David Howells
    Acked-by: Russell King

    cc: linux-arch@vger.kernel.org
    Signed-off-by: James Morris

    David Howells
     

28 Feb, 2009

1 commit


12 Oct, 2007

1 commit


09 May, 2007

1 commit


20 Apr, 2007

2 commits

  • The save_fp_context()/restore_fp_context() might sleep on accessing
    user stack and therefore might lose FPU ownership in middle of them.

    If these function failed due to "in_atomic" test in do_page_fault,
    touch the sigcontext area in non-atomic context and retry these
    save/restore operation.

    This is a replacement of a (broken) fix which was titled "Allow CpU
    exception in kernel partially".

    Signed-off-by: Atsushi Nemoto
    Signed-off-by: Ralf Baechle

    Atsushi Nemoto
     
  • The commit 4d40bff7110e9e1a97ff8c01bdd6350e9867cc10 ("Allow CpU
    exception in kernel partially") was broken. The commit was to fix
    theoretical problem but broke usual case. Revert it for now.

    Signed-off-by: Atsushi Nemoto
    Signed-off-by: Ralf Baechle

    Atsushi Nemoto
     

17 Mar, 2007

2 commits


22 Feb, 2007

1 commit

  • This patch adds trivial support for SMARTMIPS extension. This extension
    is currently implemented by 4KS[CD] CPUs.

    Basically it saves/restores ACX register, which is part of the SMARTMIPS
    ASE, when needed. This patch does *not* add any support for Smartmips MMU
    features.

    Futhermore this patch does not add explicit support for 4KS[CD] CPUs since
    they are respectively mips32 and mips32r2 compliant. So with the current
    processor configuration, a platform that has such CPUs needs to select
    both configs:

    CPU_HAS_SMARTMIPS
    SYS_HAS_CPU_MIPS32_R[12]

    This is due to the processor configuration which is mixing up all the
    architecture variants and the processor types.

    The drawback of this, is that we currently pass '-march=mips32' option to
    gcc when building a kernel instead of '-march=4ksc' for 4KSC case. This
    can lead to a kernel image a little bit bigger than required.

    Signed-off-by: Franck Bui-Huu
    Signed-off-by: Ralf Baechle

    Franck Bui-Huu
     

19 Feb, 2007

1 commit


14 Feb, 2007

2 commits


11 Feb, 2007

6 commits


07 Feb, 2007

1 commit


27 Sep, 2006

3 commits


01 Jul, 2006

1 commit


21 Mar, 2006

1 commit

  • Move function prototypes to asm/signal.h to detect trivial errors and
    add some __user tags to get rid of sparse warnings. Generated code
    should not be changed.

    Signed-off-by: Atsushi Nemoto
    Signed-off-by: Ralf Baechle

    Atsushi Nemoto
     

09 Feb, 2006

2 commits


07 Feb, 2006

2 commits


01 Dec, 2005

1 commit


08 Nov, 2005

1 commit


30 Oct, 2005

1 commit