Bug 88998 - test-fdpass is not actually compiled or run
Summary: test-fdpass is not actually compiled or run
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: git master
Hardware: Other All
: medium normal
Assignee: Simon McVittie
QA Contact: D-Bus Maintainers
URL:
Whiteboard: review?
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-02-05 14:16 UTC by Simon McVittie
Modified: 2015-02-11 14:33 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Add test-fdpass to the build, and make it compile again (1.36 KB, patch)
2015-02-05 14:16 UTC, Simon McVittie
Details | Splinter Review
Reduce the number of fds the fdpass test uses (902 bytes, patch)
2015-02-10 20:08 UTC, Simon McVittie
Details | Splinter Review
Reduce the number of fds the fdpass test uses (2.17 KB, patch)
2015-02-11 11:50 UTC, Simon McVittie
Details | Splinter Review

Description Simon McVittie 2015-02-05 14:16:46 UTC
Created attachment 113198 [details] [review]
Add test-fdpass to the build, and make it compile again

The subject says it all.
Comment 1 Simon McVittie 2015-02-05 14:23:04 UTC
For context, this was a regression test for CVE-2014-3635 and related bugs; I added the test, but the Makefile.am part got lost somewhere.
Comment 2 Philip Withnall 2015-02-05 15:13:42 UTC
Comment on attachment 113198 [details] [review]
Add test-fdpass to the build, and make it compile again

Review of attachment 113198 [details] [review]:
-----------------------------------------------------------------

++
Comment 3 Simon McVittie 2015-02-05 15:31:18 UTC
Fixed in git for 1.9.10
Comment 4 Simon McVittie 2015-02-10 20:08:35 UTC
Created attachment 113326 [details] [review]
Reduce the number of fds the fdpass test uses

It was relying on a higher-than-default fd limit; cut it down to
more than 256 but rather less than 1024, since the default Linux
limit is 1024 fds per user.
Comment 5 Simon McVittie 2015-02-10 20:31:11 UTC
(In reply to Simon McVittie from comment #4)
> Created attachment 113326 [details] [review]
> Reduce the number of fds the fdpass test uses
> 
> It was relying on a higher-than-default fd limit; cut it down to
> more than 256 but rather less than 1024, since the default Linux
> limit is 1024 fds per user.

For context, this was breaking a continuous integration framework (autopkgtest) while testing Bug #61301, which altered the environment in which my gnome-terminal runs, giving it fewer fds to play with.
Comment 6 Philip Withnall 2015-02-11 09:53:18 UTC
Comment on attachment 113326 [details] [review]
Reduce the number of fds the fdpass test uses

Review of attachment 113326 [details] [review]:
-----------------------------------------------------------------

::: test/fdpass.c
@@ +59,4 @@
>  
>  /* Arbitrary, except that MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES must be
>   * less than the process's file descriptor limit. */
> +#define SOME_MESSAGES 20

You could also add a spruced up version of this in main():

struct rlimit limit;
assert (getrlimit (RLIMIT_NOFILE, &limit) == 0);
assert (MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES < limit.rlim_cur);

And if you want to ensure it’s more than 256:
_DBUS_STATIC_ASSERT (MAX_MESSAGE_UNIX_FDS * SOME_MESSAGES > 256);
Comment 7 Simon McVittie 2015-02-11 11:50:27 UTC
Created attachment 113347 [details] [review]
Reduce the number of fds the fdpass test uses

It was relying on a higher-than-default fd limit; cut it down to
more than 256 but rather less than 1024, since the default Linux
limit is 1024 fds per user.

Also automatically skip this test if our rlimit is too small.
Comment 8 Philip Withnall 2015-02-11 12:59:28 UTC
Comment on attachment 113347 [details] [review]
Reduce the number of fds the fdpass test uses

Review of attachment 113347 [details] [review]:
-----------------------------------------------------------------

++
Comment 9 Simon McVittie 2015-02-11 14:33:35 UTC
Thanks, fixed (again) in git for 1.9.12.


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.