On Feb 14, 2011, at 11:41 AM, Cyril Hrubis wrote:
> Hi!
>>>> Hmm I see the problem now. However as a root, I could read and run files
>>>> with just an exec flag, at least here. I suppose the test works here by
>>>> some saved-id magick. I'll look deeper into this.
>>>>
>>>
>>> I think I've found the cause. The wait() funcion returns -1 if exec*
>>> hasn't succeded to run the file (and sets the status to 0). I'm not sure
>>> if this is POSIX compilant behaviour, I'll check on that later.
>>>
>>> What flavour of glibc/kernel are you testing there, it seems that it
>>> behaves a little different than mine. Here I have glibc-2.11.
>>>
>>> Anyway, I'll fix the test to check for return value from wait(), add the
>>> fix for octal file mode and fix the runtest files.
>>
>> Grr, got myself caught. Strace behaves differently when running with
>> root + setegid + exec, so lets start digging again.
>>
>
> Okay, seems that linux kernel (at least here) allows you to execute
> file if your user/group/other has at least execute rights and real uid 0.
>
> That is the reason why these tests runs fine here.
Maybe Linux has now adopted the philosophy that has broken BSD for some
time with [e]access(2), where it will always succeed for root regardless of
whether or not root really has the ability to read the file per the file mode,
e.g.?
%test -w usb.img
%echo $?
1
%exit
# sudo test -w usb.img
# echo $?
0
# exit
$ test -w usb.img
$ echo $?
0
$ ls -l usb.img
-rw-r--r-- 1 garrcoop garrcoop 188743680 Oct 21 15:49 usb.img
Assume $ is me, % is someone else, and # is sudo'ed to root.
Cheers,
-Garrett
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list