All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: James Morris <jmorris@namei.org>
Cc: jamal <hadi@cyberus.ca>, Evgeniy Polyakov <johnpol@2ka.mipt.ru>,
	netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Stephen Smalley <sds@tycho.nsa.gov>
Subject: Re: Refactor Netlink connector?
Date: Thu, 1 Jun 2006 12:45:06 +0200	[thread overview]
Message-ID: <20060601104506.GF7844@postel.suug.ch> (raw)
In-Reply-To: <Pine.LNX.4.64.0605311141320.4964@d.namei>

* James Morris <jmorris@namei.org> 2006-05-31 11:42
> On Wed, 31 May 2006, jamal wrote:
> 
> > To also answer your other email:
> > Look at  security/selinux/nlmsgtab.c for example for NETLINK_ROUTE
> > and compare with NETLINK_GENERIC to see the hole. I was suggesting if
> > we started by just adding checks for NETLINK_GENERIC first in those
> > tables (currently lacking), that would be a good start.
> 
> They're currently mediated as a generic netlink socket type at a higher 
> level: they're not unmediated, just not fine grained enough to know what 
> kind of message is being sent.

It shouldn't be hard to split what is implemented in nlmsg_route_perms[]
for NETLINK_ROUTE into the definitions of the generic netlink
operations, could look like this:

struct genl_ops some_op = {
	[...]
	.perm	 = NETLINK_GENERIC_SOCKET__NLMSG_READ,
};

int genl_lookup_perm(u16 nlmsg_type, u8 cmd)
{
	struct genl_family *family;
	struct genl_ops *ops;

	family = genl_family_find_byid(nlmsg_type);
	ops = genl_get_cmd(cmd, family);

	return ops->perm;
}

int genl_peek_cmd(struct nlmsghdr *nlh)
{
	struct genlmsghdr *hdr = nlmsg_data(nlh);

	if (nlh->nlmsglen < nlmsg_msg_sizeo(GENL_HDRLEN))
		return -EINVAL;

	return hdr->cmd;
}


selinux_lookup() must take struct nlmsghdr as an additional argument

	case SECCLASS_NETLINK_GENERIC_SOCKET:
		cmd = genl_peek_cmd(nlh)
		*perm = genl_lookup_perm(nlmsg_type, cmd);
		break;

  reply	other threads:[~2006-06-01 10:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-26 20:04 Refactor Netlink connector? James Morris
2006-05-26 23:06 ` Patrick McHardy
2006-05-27 13:46 ` Evgeniy Polyakov
2006-05-27 16:45   ` James Morris
2006-05-27 17:21     ` James Morris
2006-05-28 15:33       ` Evgeniy Polyakov
2006-05-29  6:36         ` David Miller
2006-05-29 12:11           ` jamal
2006-05-30 14:22             ` James Morris
2006-05-31 12:00               ` jamal
2006-05-31 13:09                 ` Thomas Graf
2006-05-30 14:18         ` James Morris
2006-05-30 18:03           ` Evgeniy Polyakov
2006-05-30 18:58             ` James Morris
2006-05-30 19:09               ` Evgeniy Polyakov
2006-05-31  3:00       ` Thomas Graf
2006-05-31 12:20         ` jamal
2006-05-31 13:06           ` Thomas Graf
2006-05-31 13:22             ` jamal
2006-05-31 15:42               ` James Morris
2006-06-01 10:45                 ` Thomas Graf [this message]
2006-06-01 14:24                   ` James Morris
2006-06-14 12:36                     ` jamal
2006-06-14 15:19                       ` James Morris

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=20060601104506.GF7844@postel.suug.ch \
    --to=tgraf@suug.ch \
    --cc=davem@davemloft.net \
    --cc=hadi@cyberus.ca \
    --cc=jmorris@namei.org \
    --cc=johnpol@2ka.mipt.ru \
    --cc=netdev@vger.kernel.org \
    --cc=sds@tycho.nsa.gov \
    /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.