01 Feb, 2014

1 commit


20 Jul, 2013

1 commit


29 Nov, 2012

3 commits


13 Oct, 2012

1 commit


12 Oct, 2012

3 commits

  • ... and now the asm glue side of that.

    Signed-off-by: Al Viro

    Al Viro
     
  • Turn the slow side of work_pending into C function, including all
    the looping. What we get out of that:
    * we do _not_ call get_signal_to_deliver() with IRQs disabled
    anymore
    * no need to save/restore volatiles on each pass if there
    turns to be more than one (unlikely, but still)
    * all double-restart prevention is in C now.
    * glue gets simpler.

    Signed-off-by: Al Viro

    Al Viro
     
  • In case we have both NEED_RESCHED and SIGPENDING/NOTIFY_RESUME,
    handle the latter first. We'll get to original priorities in
    the next commit, but now that allows to simplify the treatment
    of NEED_RESCHED-only case nicely. Namely, now there no need to
    preserve the data for restarts across the call of schedule() in
    $work_resched; we can get there only if we had either returned
    from syscall without SIGPENDING (in which case we should've
    had no restart-worthy return value and want no restarts) or
    already got through do_notify_resume() call (in which case we
    want no restarts anymore). So we can just slap 0 into $19
    instead of preserving it (and $20).

    Signed-off-by: Al Viro

    Al Viro
     

01 Oct, 2012

4 commits


19 Aug, 2012

2 commits

  • Signed-off-by: Al Viro
    Signed-off-by: Michael Cree
    Acked-by: Matt Turner
    Signed-off-by: Linus Torvalds

    Al Viro
     
  • New helper: current_thread_info(). Allows to do a bunch of odd syscalls
    in C. While we are at it, there had never been a reason to do
    osf_getpriority() in assembler. We also get "namespace"-aware (read:
    consistent with getuid(2), etc.) behaviour from getx?id() syscalls now.

    Signed-off-by: Al Viro
    Signed-off-by: Michael Cree
    Acked-by: Matt Turner
    Signed-off-by: Linus Torvalds

    Al Viro
     

28 Sep, 2010

1 commit


26 Sep, 2010

1 commit

  • We want interrupts disabled on all paths leading to RESTORE_ALL;
    otherwise, we are risking an IRQ coming between the updates of
    alpha_mv->hae_cache and *alpha_mv->hae_register and set_hae()
    within the IRQ getting badly confused.

    RESTORE_ALL used to play with disabling IRQ itself, but that got
    removed back in 2002, without making sure we had them disabled
    on all paths. It's cheaper to make sure we have them disabled than
    to revert to original variant...

    Remove the detritus left from that commit back in 2002; we used to
    need a reload of $0 and $1 since swpipl would change those, but
    doing that had become pointless when we stopped doing swpipl in
    there...

    Signed-off-by: Al Viro
    Signed-off-by: Linus Torvalds

    Al Viro
     

19 Sep, 2010

3 commits

  • Unlike the other targets, alpha sets _one_ sigframe and
    buggers off until the next syscall/interrupt, even if
    more signals are pending. It leads to quite a few unpleasant
    inconsistencies, starting with SIGSEGV potentially arriving
    not where it should and including e.g. mess with sigsuspend();
    consider two pending signals blocked until sigsuspend()
    unblocks them. We pick the first one; then, if we are hit
    by interrupt while in the handler, we process the second one
    as well. If we are not, and if no syscalls had been made,
    we get out of the first handler and leave the second signal
    pending; normally sigreturn() would've picked it anyway, but
    here it starts with restoring the original mask and voila -
    the second signal is blocked again. On everything else we
    get both delivered consistently.

    It's actually easy to fix; the only thing to watch out for
    is prevention of double syscall restart. Fortunately, the
    idea I've nicked from arm fix by rmk works just fine...

    Testcase demonstrating the behaviour in question; on alpha
    we get one or both flags set (usually one), on everything
    else both are always set.
    #include
    #include
    int had1, had2;
    void f1(int sig) { had1 = 1; }
    void f2(int sig) { had2 = 1; }
    main()
    {
    sigset_t set1, set2;
    sigemptyset(&set1);
    sigemptyset(&set2);
    sigaddset(&set2, 1);
    sigaddset(&set2, 2);
    signal(1, f1);
    signal(2, f2);
    sigprocmask(SIG_SETMASK, &set2, NULL);
    raise(1);
    raise(2);
    sigsuspend(&set1);
    printf("had1:%d had2:%d\n", had1, had2);
    }

    Tested-by: Michael Cree
    Signed-off-by: Al Viro
    Signed-off-by: Matt Turner

    Al Viro
     
  • The way sigreturn() is implemented on alpha breaks PTRACE_SYSCALL,
    all way back to 1.3.95 when alpha has grown PTRACE_SYSCALL support.

    What happens is direct return to ret_from_syscall, in order to bypass
    mangling of a3 (error indicator) and prevent other mutilations of
    registers (e.g. by syscall restart). That's fine, but... the entire
    TIF_SYSCALL_TRACE codepath is kept separate on alpha and post-syscall
    stopping/notifying the tracer is after the syscall. And the normal
    path we are forcibly switching to doesn't have it.

    So we end up with *one* stop in traced sigreturn() vs. two in other
    syscalls. And yes, strace is visibly broken by that; try to strace
    the following
    #include
    #include
    void f(int sig) {}
    main()
    {
    signal(SIGHUP, f);
    raise(SIGHUP);
    write(1, "eeeek\n", 6);
    }
    and watch the show. The
    close(1) = 405
    in the end of strace output is coming from return value of write() (6 ==
    __NR_close on alpha) and syscall number of exit_group() (__NR_exit_group ==
    405 there).

    The fix is fairly simple - the only thing we end up missing is the call
    of syscall_trace() and we can tell whether we'd been called from the
    SYSCALL_TRACE path by checking ra value. Since we are setting the
    switch_stack up (that's what sys_sigreturn() does), we have the right
    environment for calling syscall_trace() - just before we call
    undo_switch_stack() and return. Since undo_switch_stack() will overwrite
    s0 anyway, we can use it to store the result of "has it been called from
    SYSCALL_TRACE path?" check. The same thing applies in rt_sigreturn().

    Tested-by: Michael Cree
    Signed-off-by: Al Viro
    Signed-off-by: Matt Turner

    Al Viro
     
  • Old code used to set regs->r0 and regs->r19 to force the right
    return value. Leaving that after switch to ERESTARTNOHAND
    was a Bad Idea(tm), since now that screws the restart - if we
    hit the case when get_signal_to_deliver() returns 0, we will
    step back to syscall insn, with v0 set to EINTR and a3 to 1.
    The latter won't matter, since EINTR is 4, aka __NR_write.

    Testcase:

    #include
    #define _GNU_SOURCE
    #include
    #include

    main()
    {
    sigset_t mask;
    sigemptyset(&mask);
    sigaddset(&mask, SIGCONT);
    sigprocmask(SIG_SETMASK, &mask, NULL);
    kill(0, SIGCONT);
    syscall(__NR_sigsuspend, 1, "b0rken\n", 7);
    }

    results on alpha in immediate message to stdout...

    Fix is obvious; moreover, since we don't need regs anymore, we can
    switch to normal prototypes for these guys and lose the wrappers.
    Even better, rt_sigsuspend() is identical to generic version in
    kernel/signal.c now.

    Tested-by: Michael Cree
    Signed-off-by: Al Viro
    Signed-off-by: Matt Turner

    Al Viro
     

28 Mar, 2009

1 commit


30 Jan, 2009

1 commit


14 Jan, 2009

1 commit


14 Nov, 2008

1 commit

  • Separate the task security context from task_struct. At this point, the
    security data is temporarily embedded in the task_struct with two pointers
    pointing to it.

    Note that the Alpha arch is altered as it refers to (E)UID and (E)GID in
    entry.S via asm-offsets.

    With comment fixes Signed-off-by: Marc Dionne

    Signed-off-by: David Howells
    Acked-by: James Morris
    Acked-by: Serge Hallyn
    Signed-off-by: James Morris

    David Howells
     

17 Oct, 2007

1 commit

  • This patch converts alpha to the generic sys_ptrace. We use
    force_successful_syscall_return to avoid having to pass the pt_regs pointer
    down to the function. I think the removal of the assemly stub is correct,
    but I could only compile-test this patch, so please give it a spin before
    commiting :)

    Signed-off-by: Christoph Hellwig
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig