Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 485910 - sys-auth/polkit-0.112-r1 should not pax-mark polkitd with dev-lang/spidermonkey:17[-jit]
Summary: sys-auth/polkit-0.112-r1 should not pax-mark polkitd with dev-lang/spidermonk...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Freedesktop bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-25 00:36 UTC by Maxim Kammerer
Modified: 2014-11-06 10:57 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
USE="jit" for polkit? (polkit-0.112-r2.ebuild.patch,1.16 KB, patch)
2014-03-12 13:39 UTC, Samuli Suominen (RETIRED)
Details | Diff
patch for ebuild (polkit-0.112-r2.ebuild.patch,291 bytes, patch)
2014-11-06 09:34 UTC, Nikoli
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maxim Kammerer 2013-09-25 00:36:12 UTC
When spidermonkey does not use JIT, no PaX marking is necessary.
Comment 1 Nikoli 2014-02-24 15:46:51 UTC
Most likely hardened team will be interested, avoiding unnecessary pax marking improves security.
Comment 2 Maxim Kammerer 2014-02-24 15:58:21 UTC
Perhaps the previous trivial if/else conditional for handling the issue was deemed too complex to maintain (see referenced bug #444446 for illustration).
Comment 3 Anthony Basile gentoo-dev 2014-02-24 16:18:13 UTC
If you re-emerge spidermonkey with jit, then polkitd need to be marked.  How will it get those markings?
Comment 4 Nikoli 2014-02-24 16:27:14 UTC
There are 3 solutions:
1) pax mark /usr/lib64/libmozjs-17.0.so and suggest running revdep-pax
2) Add USE jit to polkit and change dep to:
dev-lang/spidermonkey:17[-debug,jit=]
3) Print warning after dev-lang/spidermonkey rebuild.
Comment 5 Anthony Basile gentoo-dev 2014-02-24 16:36:49 UTC
(In reply to Nikoli from comment #4)
> There are 3 solutions:
> 1) pax mark /usr/lib64/libmozjs-17.0.so and suggest running revdep-pax

This requires one to pull in sys-apps/elfix which is a bit much.

> 2) Add USE jit to polkit and change dep to:
> dev-lang/spidermonkey:17[-debug,jit=]

This is the best solution.

> 3) Print warning after dev-lang/spidermonkey rebuild.

Unnecessary amount of user interaction here.  Chances are it'll be missed.

Let's go with 2.
Comment 6 Samuli Suominen (RETIRED) gentoo-dev 2014-03-12 13:39:56 UTC
Created attachment 372496 [details, diff]
USE="jit" for polkit?

How did you mean to use jit= ?

# USE="jit" emerge -av 'dev-lang/spidermonkey:17'

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!
[ebuild   R    ] dev-lang/spidermonkey-17.0.0-r3:17  USE="jit* -debug -minimal -static-libs {-test}" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

!!! Multiple package instances within a single package slot have been pulled
!!! into the dependency graph, resulting in a slot conflict:

dev-lang/spidermonkey:17

  (dev-lang/spidermonkey-17.0.0-r3::gentoo, ebuild scheduled for merge) pulled in by
    (no parents that aren't satisfied by other packages in this slot)

  (dev-lang/spidermonkey-17.0.0-r3::gentoo, installed) pulled in by
    dev-lang/spidermonkey:17[-debug,jit=] required by (sys-auth/polkit-0.112-r2::gentoo, installed)


!!! Enabling --newuse and --update might solve this conflict.
!!! If not, it might help emerge to give a more specific suggestion.
Comment 7 Nikoli 2014-03-15 08:43:41 UTC
Tried your patch, works fine:

# USE='jit' emerge -vp =sys-auth/polkit-0.112-r1

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] dev-lang/spidermonkey-17.0.0-r3:17  USE="jit* minimal {test} -debug -static-libs" 0 kB
[ebuild   R    ] sys-auth/polkit-0.112-r1  USE="introspection jit%* kde nls pam -examples -gtk (-selinux) -systemd" 0 kB

Total: 2 packages (2 reinstalls), Size of downloads: 0 kB


You see this error, because you try to rebuild spidermonkey without rebuilding polkit, portage even suggests about it:
"Enabling --newuse and --update might solve this conflict."
Comment 8 Samuli Suominen (RETIRED) gentoo-dev 2014-03-15 12:16:33 UTC
in portage then
Comment 9 Nikoli 2014-04-01 11:12:25 UTC
Something went wrong, polkit-0.112-r2[-jit] fails src_test:
make[4]: Entering directory `/var/package-manager/tmp/portage/sys-auth/polkit-0.112-r2/work/polkit-0.112/test/polkitbackend'
../../test-driver: line 95: 31822 Killed                  "$@" > $log_file 2>&1
FAIL: polkitbackendjsauthoritytest

No messages in dmesg, in polkit-0.112-r1 all tests work fine.

So is JIT really disabled in dev-lang/spidermonkey-17.0.0-r3[-jit]?
Comment 10 Samuli Suominen (RETIRED) gentoo-dev 2014-04-01 12:54:52 UTC
(In reply to Nikoli from comment #9)
> Something went wrong, polkit-0.112-r2[-jit] fails src_test:
> make[4]: Entering directory
> `/var/package-manager/tmp/portage/sys-auth/polkit-0.112-r2/work/polkit-0.112/
> test/polkitbackend'
> ../../test-driver: line 95: 31822 Killed                  "$@" > $log_file
> 2>&1
> FAIL: polkitbackendjsauthoritytest
> 
> No messages in dmesg, in polkit-0.112-r1 all tests work fine.
> 
> So is JIT really disabled in dev-lang/spidermonkey-17.0.0-r3[-jit]?

If JIT is not disabled with USE="-jit" in dev-lang/spidermonkey, shouldn't you file a bug for dev-lang/spidermonkey?
Any pax-marking in polkit happens only in src_install() so at the time src_test() is executed, nothing has yet been done by polkit's ebuild, now or before
Comment 11 Samuli Suominen (RETIRED) gentoo-dev 2014-04-01 12:58:06 UTC
(In reply to Samuli Suominen from comment #10)
> Any pax-marking in polkit happens only in src_install() so at the time
> src_test() is executed, nothing has yet been done by polkit's ebuild, now or
> before

Sorry, I take that back, I should have verified before speaking, it's indeed done in src_compile()
Comment 12 Samuli Suominen (RETIRED) gentoo-dev 2014-04-01 13:02:19 UTC
The ebuild has...

has_version 'dev-lang/spidermonkey:17[jit]' && m='m'

I don't see how that could fail:

1. spidermonkey is a build time dependency in polkit, therefore it's emerged first
2. so, now spidermonkey is installed
3. polkit goes into src_compile() and has_version is checking if jit is enabled or not in spidermonkey, and does pax-marking based on it

So, is unconditional pax-marking required afterall, and the whole bug was bogus to begin with? If so, I can drop -r2. I rely on hardened users/devs to report this to me.
Keep me updated.
Comment 13 Nikoli 2014-04-01 13:26:39 UTC
mozilla herd, please check if disabling USE jit really makes using /usr/lib64/libmozjs-17.0.so safe in hardened systems. Can you try reproducing this bug?
Comment 14 Jory A. Pratt gentoo-dev 2014-04-01 13:42:14 UTC
(In reply to Nikoli from comment #13)
> mozilla herd, please check if disabling USE jit really makes using
> /usr/lib64/libmozjs-17.0.so safe in hardened systems. Can you try
> reproducing this bug?

If -jit is used there is no need to pax mark anything in polkit. This was the same result when using spidermonkey-1.8.7. There is no testing needed.
Comment 15 Jory A. Pratt gentoo-dev 2014-04-01 13:45:13 UTC
We have a jit useflag on polkit that does nothing, please drop it from the ebuild and stop forcing rebuilds that are not required.
Comment 16 Samuli Suominen (RETIRED) gentoo-dev 2014-04-01 13:52:13 UTC
(In reply to Jory A. Pratt from comment #15)
> We have a jit useflag on polkit that does nothing, please drop it from the
> ebuild and stop forcing rebuilds that are not required.

No, we don't, the jit= will ensure polkit will be re-emerged with USE="-jit" if dev-lang/spidermonkey is enabled with USE="-jit"
There is no other way to do this w/ current Portage
Note, also >=www-client/midori-0.5.7 uses this method for USE="jit"
Comment 17 Samuli Suominen (RETIRED) gentoo-dev 2014-04-01 13:54:18 UTC
(In reply to Jory A. Pratt from comment #14)
> (In reply to Nikoli from comment #13)
> > mozilla herd, please check if disabling USE jit really makes using
> > /usr/lib64/libmozjs-17.0.so safe in hardened systems. Can you try
> > reproducing this bug?
> 
> If -jit is used there is no need to pax mark anything in polkit. This was
> the same result when using spidermonkey-1.8.7. There is no testing needed.

See Comment #9, for which this bug was reopened. Testing/verifying is very much required.
Comment 18 Jory A. Pratt gentoo-dev 2014-04-01 22:24:09 UTC
(In reply to Samuli Suominen from comment #17)
> (In reply to Jory A. Pratt from comment #14)
> > (In reply to Nikoli from comment #13)
> > > mozilla herd, please check if disabling USE jit really makes using
> > > /usr/lib64/libmozjs-17.0.so safe in hardened systems. Can you try
> > > reproducing this bug?
> > 
> > If -jit is used there is no need to pax mark anything in polkit. This was
> > the same result when using spidermonkey-1.8.7. There is no testing needed.
> 
> See Comment #9, for which this bug was reopened.Testing/verifying is very
> much required.

That is a completely unrelated issue. I am telling you there is no testing needed as I run haradened. I can tell you what happens with and without spidermonkey being built with JIT
Comment 19 Nikoli 2014-04-01 22:55:01 UTC
> If -jit is used there is no need to pax mark anything in polkit.

Jory, did you see comment #9? For me polkit-0.112-r2[-jit] fails polkitbackendjsauthoritytest, does it work fine for you? Please verify that all tests work fine for you in polkit _without_ any pax marking. Because for me they do not.
Comment 20 Jory A. Pratt gentoo-dev 2014-04-02 01:15:03 UTC
(In reply to Nikoli from comment #19)
> > If -jit is used there is no need to pax mark anything in polkit.
> 
> Jory, did you see comment #9? For me polkit-0.112-r2[-jit] fails
> polkitbackendjsauthoritytest, does it work fine for you? Please verify that
> all tests work fine for you in polkit _without_ any pax marking. Because for
> me they do not.

Complaining over test failures is useless. If you understand mozilla code you can see most of the tests are false positives. These same tests fail inside most mozilla products. They are not used for hardline results.
Comment 21 Samuli Suominen (RETIRED) gentoo-dev 2014-04-02 05:26:19 UTC
(In reply to Jory A. Pratt from comment #20)
> (In reply to Nikoli from comment #19)
> > > If -jit is used there is no need to pax mark anything in polkit.
> > 
> > Jory, did you see comment #9? For me polkit-0.112-r2[-jit] fails
> > polkitbackendjsauthoritytest, does it work fine for you? Please verify that
> > all tests work fine for you in polkit _without_ any pax marking. Because for
> > me they do not.
> 
> Complaining over test failures is useless. If you understand mozilla code
> you can see most of the tests are false positives. These same tests fail
> inside most mozilla products. They are not used for hardline results.

I take it that mozilla@ is not intrested in being involved in figuring out what makes the test fail, and if it's jit related or not. That's OK, we can take it from here...
Comment 22 Samuli Suominen (RETIRED) gentoo-dev 2014-04-02 05:32:18 UTC
(In reply to Nikoli from comment #9)
> Something went wrong, polkit-0.112-r2[-jit] fails src_test:
> make[4]: Entering directory
> `/var/package-manager/tmp/portage/sys-auth/polkit-0.112-r2/work/polkit-0.112/
> test/polkitbackend'
> ../../test-driver: line 95: 31822 Killed                  "$@" > $log_file
> 2>&1

$log_file, I don't remember out of memory, but there is indeed a log created from the tests
Perhaps you should provide more information of the failing test before jumping conclusions it's JIT related, this bug related, to begin with, before CCing maintainers like spidermonkey here
Comment 23 Nikoli 2014-04-02 06:23:20 UTC
Jory, tests in polkit package never failed for me in all hardened desktops until pax marking was disabled for them. Results of these tests are not random, but reproducible. polkitbackendjsauthoritytest is not marked XFAIL, so it is expected to work fine.

Samuli,
> $log_file, I don't remember out of memory, but there is indeed a log created from the tests

# file test/polkitbackend/polkitbackendjsauthoritytest.log
test/polkitbackend/polkitbackendjsauthoritytest.log: empty

# cat test/polkitbackend/test-suite.log
=====================================================
   polkit 0.112: test/polkitbackend/test-suite.log
=====================================================

# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: polkitbackendjsauthoritytest
==================================


Do you need any other info?
Comment 24 Jory A. Pratt gentoo-dev 2014-04-03 03:42:00 UTC
(In reply to Nikoli from comment #23)
> Jory, tests in polkit package never failed for me in all hardened desktops
> until pax marking was disabled for them. Results of these tests are not
> random, but reproducible. polkitbackendjsauthoritytest is not marked XFAIL,
> so it is expected to work fine.
> 
> Samuli,
> > $log_file, I don't remember out of memory, but there is indeed a log created from the tests
> 
> # file test/polkitbackend/polkitbackendjsauthoritytest.log
> test/polkitbackend/polkitbackendjsauthoritytest.log: empty
> 
> # cat test/polkitbackend/test-suite.log
> =====================================================
>    polkit 0.112: test/polkitbackend/test-suite.log
> =====================================================
> 
> # TOTAL: 1
> # PASS:  0
> # SKIP:  0
> # XFAIL: 0
> # FAIL:  1
> # XPASS: 0
> # ERROR: 0
> 
> .. contents:: :depth: 2
> 
> FAIL: polkitbackendjsauthoritytest
> ==================================
> 
> 
> Do you need any other info?

ERROR:test-polkitbackendjsauthority.c:49:get_authority: assertion failed: (rules_dirs[0] != NULL)

Here is your actual issue. I will be more then happy to dig into it and see what we can do.
Comment 25 Nikoli 2014-11-06 09:34:28 UTC
Created attachment 388660 [details, diff]
patch for ebuild

I found why tests fail in sys-auth/polkit-0.112-r2: when there should be no pax marking done, ebuild actually does wrong pax marking.

cd /var/tmp/portage/sys-auth/polkit-0.112-r2/work/polkit-0.112/ && paxctl-ng -v src/polkitbackend/.libs/polkitd test/polkitbackend/.libs/polkitbackendjsauthoritytest
src/polkitbackend/.libs/polkitd:
        PT_PAX    : -e---
        XATTR_PAX : not found

test/polkitbackend/.libs/polkitbackendjsauthoritytest:
        PT_PAX    : -e---
        XATTR_PAX : pe-rs


build.log:
make[1]: Leaving directory '/var/tmp/portage/sys-auth/polkit-0.112-r2/work/polkit-0.112'
 *      test/polkitbackend/.libs/polkitbackendjsauthoritytest
 * XT PaX marking -srpesp test/polkitbackend/.libs/polkitbackendjsauthoritytest with paxctl-ng
>>> Source compiled.


This part of ebuild is wrong:
src_compile() {
	default

	# Required for polkitd on hardened/PaX due to spidermonkey's JIT
	local f='src/polkitbackend/.libs/polkitd test/polkitbackend/.libs/polkitbackendjsauthoritytest'
	local m=''
	# Only used when USE="jit" is enabled for 'dev-lang/spidermonkey:17' wrt #485910
	has_version 'dev-lang/spidermonkey:17[jit]' && m='m'
	# hppa, ia64 and mips uses spidermonkey-1.8.5 which requires different pax-mark flags
	use hppa && m='mr'
	use ia64 && m='mr'
	use mips && m='mr'
	pax-mark ${m} ${f}
}


It should not run 'pax-mark ${m} ${f}' when $m is empty. Attached patch works fine for me.
Comment 26 Samuli Suominen (RETIRED) gentoo-dev 2014-11-06 10:57:09 UTC
(In reply to Nikoli from comment #25)
> Created attachment 388660 [details, diff] [details, diff]
> patch for ebuild
> 
> It should not run 'pax-mark ${m} ${f}' when $m is empty. Attached patch
> works fine for me.

applied to tree