All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Ben Hutchings <ben@decadent.org.uk>
Cc: LKML <linux-kernel@vger.kernel.org>, linux-alpha@vger.kernel.org
Subject: Re: [PATCH 2/2] alpha: Make sys_getxpid() call do_getppid()
Date: Sun, 26 Sep 2010 23:28:28 +0100	[thread overview]
Message-ID: <20100926222828.GA19804@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1285513991.2697.262.camel@localhost>

On Sun, Sep 26, 2010 at 04:13:11PM +0100, Ben Hutchings wrote:
> sys_getxpid() was not following RCU protocol or considering namespace
> visibility for the parent pid.  Change it to call do_geptpid() which
> does the right thing.
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
> This is totally untested, and I've never written Alpha assembly before,
> so this definitely needs review and testing by an Alpha porter.
> 
> I've left the shortcut tgid lookup there as I assume it is still valid.

I think I have a better variant, getting rid of asm magic completely.
Basically, in ptrace.h have
#define current_pt_regs() \
        ((struct pt_regs *)(current_thread_info() + 2*PAGE_SIZE) - 1)

(and turn force_successful_syscall_return() into (current_pt_regs()->r0 = 0),
while we are at it) and do what I'm doing for e.g. getxgid and alpha_pipe:
SYSCALL_DEFINE0(getxgid)
{
        struct cred *cred = current->cred;
        current_pt_regs()->r20 = cred->egid;
        return cred->gid;
}

SYSCALL_DEFINE0(alpha_pipe)
{
        int fd[2];
        int res = do_pipe_flags(&fd, 0);
        if (!res) {
                /* The return values are in $0 and $20.  */
                current_pt_regs()->r20 = fd[1];
                res = fd[0];
        }
        return res;
}

I planned to hold it back until the merge window, since it's not a bugfix,
but with that one... what the hell, might as well do it.  Less asm glue
is a Good Thing(tm).

One problem with your patch, though:

; git grep do_getppid
;

IOW, which tree is that against?

  reply	other threads:[~2010-09-26 22:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-26 15:09 [PATCH 1/2] syscall,pid: Extract bodies of sys_get{pid,ppid}() into do_get{pid,ppid}() Ben Hutchings
2010-09-26 15:13 ` [PATCH 2/2] alpha: Make sys_getxpid() call do_getppid() Ben Hutchings
2010-09-26 22:28   ` Al Viro [this message]
2010-09-26 22:34     ` Ben Hutchings

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=20100926222828.GA19804@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=ben@decadent.org.uk \
    --cc=linux-alpha@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.