Bug 67451 - Test failure (0.18.5): common/tests/test-compat
Summary: Test failure (0.18.5): common/tests/test-compat
Status: NEEDINFO
Alias: None
Product: p11-glue
Classification: Unclassified
Component: p11-kit (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Mac OS X (All)
: medium normal
Assignee: Stef Walter
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-29 02:33 UTC by manphiz
Modified: 2013-09-15 06:15 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Test result of common/tests/test-compat of 0.18.5 (412 bytes, text/plain)
2013-07-29 02:33 UTC, manphiz
Details
config.h from failed build (6.61 KB, text/plain)
2013-07-29 08:01 UTC, manphiz
Details

Description manphiz 2013-07-29 02:33:34 UTC
Created attachment 83157 [details]
Test result of common/tests/test-compat of 0.18.5

On Mac OS X 10.8.4, common/tests/test-compat fails in version 0.18.5. The error log is attached. Basically it is because that ret is zero after last statement.
Comment 1 Stef Walter 2013-07-29 07:39:51 UTC
Could you attach the config.h header from the build?
Comment 2 manphiz 2013-07-29 08:01:05 UTC
Created attachment 83185 [details]
config.h from failed build

Added config.h as requested.
Comment 3 Stef Walter 2013-07-29 08:34:52 UTC
Could you run the following (or equivalent commands). Make sure to start running them as a non-root user:

$ cp common/tests/frob-getauxval /tmp
$ chmod ug+s /tmp/frob-getauxval 
$ /tmp/frob-getauxval 23
getauxval(23) == 0
$ ls -l /tmp/frob-getauxval 
-rwsrwsr-x. 1 user group 26530 29. Jul 10:32 /tmp/frob-getauxval
$ sudo /tmp/frob-getauxval 23
[sudo] password for user: 
getauxval(23) == 1
Comment 4 manphiz 2013-07-29 08:56:37 UTC
Commands as requested:

bash-3.2$ cp common/tests/frob-getauxval /tmp
bash-3.2$ chmod ug+s /tmp/frob-getauxval
bash-3.2$ /tmp/frob-getauxval 23
getauxval(23) == 0
bash-3.2$ ls -l /tmp/frob-getauxval
-rwsr-xr-x  1 dxy  wheel  10320 Jul 29 01:51 /tmp/frob-getauxval
bash-3.2$ sudo /tmp/frob-getauxval 23
Password:
getauxval(23) == 1


However, I do notice that there are lots of other files with similar names, like:

-rwxr-s---  1 dxy         com.apple.access_screensharing-disabled  10320 Jul 28 18:40 frob-getauxval.Isfo5r
-rwxr-s---  1 dxy         com.apple.access_screensharing-disabled  10320 Jul 28 18:39 frob-getauxval.M58fyT
-rwxr-s---  1 dxy         com.apple.access_screensharing-disabled  10320 Jul 28 19:30 frob-getauxval.ZfEeqI
-rwxr-s---  1 dxy         com.apple.access_screensharing-disabled  10320 Jul 29 01:49 frob-getauxval.Zm7jiy
-rwxr-s---  1 dxy         com.apple.access_screensharing-disabled  10320 Jul 29 00:59 frob-getauxval.ijYMgQ
-rwxr-s---  1 dxy         com.apple.access_screensharing-disabled  10320 Jul 28 18:40 frob-getauxval.tt4RdK
-rwxr-s---  1 dxy         com.apple.access_screensharing-disabled  10320 Jul 28 18:47 frob-getauxval.xf58jO
-rwxr-s---  1 dxy         com.apple.access_screensharing-disabled  10320 Jul 28 18:29 frob-getauxval.xwi65F
-rwxr-s---  1 dxy         com.apple.access_screensharing-disabled  10320 Jul 28 18:35 frob-getauxval.ywypgx

And those files don't get the u+s set. Not sure how it connects to this problem.

Also note that I was using homebrew package manager, and it builds the packages in /tmp, which is a symlink to /private/tmp, as:

bash-3.2$ pwd
/private/tmp/p11-kit-Zz2A/p11-kit-0.18.5
Comment 5 Stef Walter 2013-07-30 10:08:59 UTC
(In reply to comment #4)
> Commands as requested:
> 
> bash-3.2$ cp common/tests/frob-getauxval /tmp
> bash-3.2$ chmod ug+s /tmp/frob-getauxval
> bash-3.2$ /tmp/frob-getauxval 23
> getauxval(23) == 0
> bash-3.2$ ls -l /tmp/frob-getauxval
> -rwsr-xr-x  1 dxy  wheel  10320 Jul 29 01:51 /tmp/frob-getauxval
> bash-3.2$ sudo /tmp/frob-getauxval 23
> Password:
> getauxval(23) == 1
> 
> 
> However, I do notice that there are lots of other files with similar names,
> like:
> 
<snip>
> 
> And those files don't get the u+s set. Not sure how it connects to this
> problem.

Interesting. Could you try the above tests without the u+s flag set, just g+s? What we need to determine is if 'frob-getauxval 23' returns non-zero when running setgid().
Comment 6 manphiz 2013-07-30 16:45:41 UTC
So I set the file to have only g+s, and it actually does return 1, as below:

$ ls -l frob-getauxval
-rwxr-s---  1 dxy  wheel  10320 Jul 29 01:51 frob-getauxval
$ ./frob-getauxval 23
getauxval(23) == 1

However, I checked the files generated during the building process, but it returns 0 instead:

$ ls -l frob-getauxval.ywypgx
-rwxr-s---  1 dxy  com.apple.access_screensharing-disabled  10320 Jul 28 18:35 frob-getauxval.ywypgx
$ ./frob-getauxval.ywypgx 23
getauxval(23) == 0

The problem here is the group is not wheel. After setting the group correctly it seems to do the job:

$ sudo chgrp wheel frob-getauxval.ywypgx 
$ ls -l frob-getauxval.ywypgx
-rwxr-s---  1 dxy  wheel  10320 Jul 28 18:35 frob-getauxval.ywypgx
$ ./frob-getauxval.ywypgx 23
getauxval(23) == 1
Comment 7 Stef Walter 2013-07-31 09:15:50 UTC
(In reply to comment #6)
> However, I checked the files generated during the building process, but it
> returns 0 instead:
> 
> $ ls -l frob-getauxval.ywypgx
> -rwxr-s---  1 dxy  com.apple.access_screensharing-disabled  10320 Jul 28
> 18:35 frob-getauxval.ywypgx
> $ ./frob-getauxval.ywypgx 23
> getauxval(23) == 0

Is this because the user running the file has the group in their credentials? Does it only work when the setgid group is not present in the credentials?
Comment 8 manphiz 2013-07-31 19:16:02 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > However, I checked the files generated during the building process, but it
> > returns 0 instead:
> > 
> > $ ls -l frob-getauxval.ywypgx
> > -rwxr-s---  1 dxy  com.apple.access_screensharing-disabled  10320 Jul 28
> > 18:35 frob-getauxval.ywypgx
> > $ ./frob-getauxval.ywypgx 23
> > getauxval(23) == 0
> 
> Is this because the user running the file has the group in their
> credentials? Does it only work when the setgid group is not present in the
> credentials?

Exactly. My account is a member of com.apple.access_screensharing-disabled. If I chgrp to something that my account doesn't belong to, like mail, wheel, etc., the program shows 1.
Comment 9 Stef Walter 2013-08-01 06:46:49 UTC
Can you think of a simple way to do that from the tests running as non-root?
Comment 10 Nix 2013-08-31 20:32:11 UTC
FWIW, this test also spuriously fails if /tmp is mounted nosuid (which seems like a rather good idea in any case).
Comment 11 manphiz 2013-09-15 06:15:14 UTC
Just a thought: maybe create a group temporarily and make sure that current user is not a member, and clean up the group afterwards. But as Nix pointed out, this still fails when the disk partition is mounted nosuid.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.