----- Original Message -----
> From: "Garrett Cooper" <[email protected]>
> To: "Caspar Zhang" <[email protected]>
> Cc: "LTP List" <[email protected]>
> Sent: Friday, May 20, 2011 3:04:20 PM
> Subject: Re: [LTP] [PATCH] [syscalls] chown03: fix EPERM issue
> On Wed, May 11, 2011 at 2:39 AM, Caspar Zhang <[email protected]>
> wrote:
> >
> > in setup phase of chown03 testcase, it set effective gid/uid before
> > create tmpdir, this might cause EPERM error under some circumstance:
> >
> > chown03 1 TBROK : chown(/tmp/ltp-1FYYTiULQl/chos2UBh3, -1, 0)
> > failed: errno=EPERM(1): Operation not permitted
> > chown03 2 TBROK : Remaining cases broken
> > chown03 0 TWARN : tst_brk: Invalid Type: 4. Using TBROK

What happens is:
--running as root--
setegid(99);
seteuid(99);
mkdir(mydir, 0700);
chown(mydir, -1, 0);

So nobody wants to chown created dir to root, which seems odd at first look.
But this actually works thanks to check in fs/attr.c:inode_change_ok(),
which checks not only for uid but also for supplementary groups.

Normally /bin/login will set these for you (initgroups(2)) and testcase works. 
The conditions under which I saw this test to fail was when it is 
run in automated environment (bypassing /bin/login), 
leaving sup. groups empty.

Regards,
Jan

> 
> That message is bizarre and looks like another bug in lib/... .
> 
> Thanks,
> -Garrett
> 


------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to