All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Oeser <netdev@axxeo.de>
To: Chris Wright <chrisw@osdl.org>
Cc: Ingo Oeser <ioe-lkml@rameria.de>,
	davem@davemloft.net, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] scm: fold __scm_send() into scm_send()
Date: Mon, 20 Mar 2006 12:44:58 +0100	[thread overview]
Message-ID: <200603201244.58507.netdev@axxeo.de> (raw)
In-Reply-To: <20060313173103.7681b49d.akpm@osdl.org>

Hi Chris,

Andrew Morton wrote:
> Ingo Oeser <ioe-lkml@rameria.de> wrote:
> >
> >  -int scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm)
> >  -{
> >  -	struct task_struct *p = current;
> >  -	scm->creds = (struct ucred) {
> >  -		.uid = p->uid,
> >  -		.gid = p->gid,
> >  -		.pid = p->tgid
> >  -	};
> >  -	scm->fp = NULL;
> >  -	scm->sid = security_sk_sid(sock->sk, NULL, 0);
> >  -	scm->seq = 0;
> >  -	if (msg->msg_controllen <= 0)
> >  -		return 0;
> >  -	return __scm_send(sock, msg, scm);
> >  -}
> 
> It's worth noting that scm_send() will call security_sk_sid() even if
> (msg->msg_controllen <= 0).

Chris, do you know if this is needed in this case?

> If that test is likely to be true with any frequency then perhaps we can
> optimise things...

That test seems to be the original intention for the splitup. 

The security modules just put their hooks here. Maybe we can
fold these hooks into __scm_send() and have the old
splitup again to get the old code paths back.

It seems that the credential copy in af_unix.c 

memcpy(UNIXCREDS(skb), &siocb->scm->creds, sizeof(struct ucred));
if (siocb->scm->fp)
            unix_attach_fds(siocb->scm, skb);

doesn't depend on the "msg_controllen <= 0" test. If we can introduce this 
dependency there, we can put credential setup into __scm_send().

I would suggest we fold these two lines into a function and decide this later.

Chris, would this suffice?

Regards

Ingo Oeser

BTW: ioe-lkml@rameria.de is simply netdev@axxeo.de at work :-)

  reply	other threads:[~2006-03-20 11:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200603130139.k2D1dpSQ021279@shell0.pdx.osdl.net>
2006-03-13  2:08 ` + uninline-scm_recv-and-scm_send-fix.patch added to -mm tree David S. Miller
2006-03-13 20:05   ` [PATCH] scm: fold __scm_send() into scm_send() Ingo Oeser
2006-03-13 20:22     ` Benjamin LaHaise
2006-03-13 22:13       ` Andrew Morton
2006-03-14  1:31     ` Andrew Morton
2006-03-20 11:44       ` Ingo Oeser [this message]
2006-03-20 20:18         ` Chris Wright
2006-03-20 21:36           ` Chris Wright
2006-03-20 22:31             ` Andrew Morton
2006-03-20 23:15               ` Chris Wright
2006-03-21 13:32                 ` Stephen Smalley
2006-03-21 13:42                   ` Stephen Smalley
2006-04-06 17:52                     ` Xiaolan Zhang
2006-03-20 23:28             ` David S. Miller
2006-03-20 23:43               ` Chris Wright
2006-03-21  0:37               ` James Morris
2006-03-21  0:50                 ` David S. Miller

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=200603201244.58507.netdev@axxeo.de \
    --to=netdev@axxeo.de \
    --cc=akpm@osdl.org \
    --cc=chrisw@osdl.org \
    --cc=davem@davemloft.net \
    --cc=ioe-lkml@rameria.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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.