linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: thockin@sun.com
Cc: arjanv@redhat.com, thomas.schlichter@web.de, thoffman@arnor.net,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: 2.6.2-rc2-mm2
Date: Fri, 30 Jan 2004 12:33:01 -0800	[thread overview]
Message-ID: <20040130123301.70009427.akpm@osdl.org> (raw)
In-Reply-To: <20040130201731.GY9155@sun.com>

Tim Hockin <thockin@sun.com> wrote:
>
> On Fri, Jan 30, 2004 at 11:47:01AM -0800, Andrew Morton wrote:
> > > directly calling sys_ANYTHING sounds really wrong to me...
> 
> It sounded wrong to me, but it gets done ALL OVER.
> 
> > Tim, I do think it would be neater to add another entry point in sys.c for
> > nfsd and just do a memcpy.
> 
> Do you prefer:
> 
> a) make a function
> 	sys.c: ksetgroups(int gidsetsize, gid_t *grouplist)
>    which does the same as sys_setgroups, but without the copy_from_user()
>    stuff?  The only user (for now, maybe ever) is nfsd.
> 
> b) make a function
> 	sys.c: nfsd_setgroups(int gidsetsize, gid_t *grouplist)
>    which does the same as sys_setgroups, but without the copy_from_user()
> 
> c) make the nfsd code build a struct group_info and call
>    set_current_groups()
> 

Can we do d)?

static long do_setgroups(int gidsetsize, gid_t __user *user_grouplist,
			gid_t *kern_grouplist)
{
	gid_t groups[NGROUPS];
	int retval;

	if (!capable(CAP_SETGID))
		return -EPERM;
	if ((unsigned) gidsetsize > NGROUPS)
		return -EINVAL;
	if (user_grouplist) {
		if (copy_from_user(groups, user_grouplist,
				gidsetsize * sizeof(gid_t)))
			return -EFAULT;
	} else {
		memcpy(groups, kern_grouplist, gidsetsize * sizeof(gid_t));
	}
	retval = security_task_setgroups(gidsetsize, groups);
	if (retval)
		return retval;
	memcpy(current->groups, groups, gidsetsize * sizeof(gid_t));
	current->ngroups = gidsetsize;
	return 0;
}

asmlinkage long sys_setgroups(int gidsetsize, gid_t __user *grouplist)
{
	return do_setgroups(gidsetsize, grouplist, NULL);
}

long kern_setgroups(int gidsetsize, gid_t *grouplist)
{
	return do_setgroups(gidsetsize, NULL, grouplist);
}

It's a bit grubby, but the grubbiness is localised.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>

  reply	other threads:[~2004-01-30 20:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-30  9:41 2.6.2-rc2-mm2 Andrew Morton
2004-01-30 10:52 ` 2.6.2-rc2-mm2 Helge Hafting
2004-01-30 11:14 ` 2.6.2-rc2-mm2 Zephaniah E. Hull
2004-01-30 16:25   ` 2.6.2-rc2-mm2 Gene Heskett
2004-01-30 17:25 ` 2.6.2-rc2-mm2 Gene Heskett
2004-01-30 18:58 ` 2.6.2-rc2-mm2 Torrey Hoffman
2004-01-30 19:07   ` 2.6.2-rc2-mm2 Thomas Schlichter
2004-01-30 19:23     ` 2.6.2-rc2-mm2 Arjan van de Ven
2004-01-30 19:47       ` 2.6.2-rc2-mm2 Andrew Morton
2004-01-30 19:55         ` 2.6.2-rc2-mm2 Arjan van de Ven
2004-01-30 20:17         ` 2.6.2-rc2-mm2 Tim Hockin
2004-01-30 20:33           ` Andrew Morton [this message]
2004-01-30 21:12             ` 2.6.2-rc2-mm2 Tim Hockin
2004-01-30 22:00               ` 2.6.2-rc2-mm2 Andrew Morton
2004-01-30 22:31                 ` 2.6.2-rc2-mm2 Tim Hockin
2004-01-30 23:08                   ` 2.6.2-rc2-mm2 Andrew Morton
2004-01-30 23:21                     ` 2.6.2-rc2-mm2 Tim Hockin
2004-01-30 23:31                       ` 2.6.2-rc2-mm2 Andrew Morton
2004-01-30 23:43                         ` 2.6.2-rc2-mm2 Tim Hockin
2004-01-30 21:16             ` 2.6.2-rc2-mm2 John Stoffel
2004-01-30 21:52               ` 2.6.2-rc2-mm2 Tim Hockin

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=20040130123301.70009427.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=arjanv@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=thockin@sun.com \
    --cc=thoffman@arnor.net \
    --cc=thomas.schlichter@web.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox