mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-05 02:50:46 +00:00
polkit: switch from mozjs to duktape javascript engine
cherry-pick the change from polkit 0.120+ upstream since it applies directly to 0.119. Drop mozjs patches. Removes mozjs and its dependency nspr from images. They account for roughly 21 Mb on 64bit ARM machines. The replacement libduktape is roughly 300 kb in size. Thus this saves at least 20 Mb in rootfs size when polkit is used. Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
From 4ce27b66bb07b72cb96d3d43a75108a5a6e7e156 Mon Sep 17 00:00:00 2001
|
||||
From: Xi Ruoyao <xry111@mengyan1223.wang>
|
||||
Date: Tue, 10 Aug 2021 19:09:42 +0800
|
||||
Subject: [PATCH] jsauthority: port to mozjs-91
|
||||
|
||||
Upstream-Status: Submitted [https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/92]
|
||||
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
|
||||
---
|
||||
configure.ac | 2 +-
|
||||
meson.build | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index d807086..5a7fc11 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -80,7 +80,7 @@ PKG_CHECK_MODULES(GLIB, [gmodule-2.0 gio-unix-2.0 >= 2.30.0])
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
|
||||
-PKG_CHECK_MODULES(LIBJS, [mozjs-78])
|
||||
+PKG_CHECK_MODULES(LIBJS, [mozjs-91])
|
||||
|
||||
AC_SUBST(LIBJS_CFLAGS)
|
||||
AC_SUBST(LIBJS_CXXFLAGS)
|
||||
diff --git a/meson.build b/meson.build
|
||||
index b3702be..733bbff 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -126,7 +126,7 @@ expat_dep = dependency('expat')
|
||||
assert(cc.has_header('expat.h', dependencies: expat_dep), 'Can\'t find expat.h. Please install expat.')
|
||||
assert(cc.has_function('XML_ParserCreate', dependencies: expat_dep), 'Can\'t find expat library. Please install expat.')
|
||||
|
||||
-mozjs_dep = dependency('mozjs-78')
|
||||
+mozjs_dep = dependency('mozjs-91')
|
||||
|
||||
dbus_dep = dependency('dbus-1')
|
||||
dbus_confdir = dbus_dep.get_pkgconfig_variable('datadir', define_variable: ['datadir', pk_prefix / pk_datadir]) #changed from sysconfdir with respect to commit#8eada3836465838
|
||||
+3463
File diff suppressed because it is too large
Load Diff
-63
@@ -1,63 +0,0 @@
|
||||
From 7799441b9aa55324160deefbc65f9d918b8c94c1 Mon Sep 17 00:00:00 2001
|
||||
From: Xi Ruoyao <xry111@mengyan1223.wang>
|
||||
Date: Tue, 10 Aug 2021 18:52:56 +0800
|
||||
Subject: [PATCH] jsauthority: ensure to call JS_Init() and JS_ShutDown()
|
||||
exactly once
|
||||
|
||||
Before this commit, we were calling JS_Init() in
|
||||
polkit_backend_js_authority_class_init and never called JS_ShutDown.
|
||||
This is actually a misusage of SpiderMonkey API. Quote from a comment
|
||||
in js/Initialization.h (both mozjs-78 and mozjs-91):
|
||||
|
||||
It is currently not possible to initialize SpiderMonkey multiple
|
||||
times (that is, calling JS_Init/JSAPI methods/JS_ShutDown in that
|
||||
order, then doing so again).
|
||||
|
||||
This misusage does not cause severe issues with mozjs-78. However, when
|
||||
we eventually port jsauthority to use mozjs-91, bad thing will happen:
|
||||
see the test failure mentioned in #150.
|
||||
|
||||
This commit is tested with both mozjs-78 and mozjs-91, all tests pass
|
||||
with it.
|
||||
|
||||
Upstream-Status: Submitted [https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/91]
|
||||
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
|
||||
---
|
||||
src/polkitbackend/polkitbackendjsauthority.cpp | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
|
||||
index 41d8d5c..38dc001 100644
|
||||
--- a/src/polkitbackend/polkitbackendjsauthority.cpp
|
||||
+++ b/src/polkitbackend/polkitbackendjsauthority.cpp
|
||||
@@ -75,6 +75,13 @@
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
|
||||
+static class JsInitHelperType
|
||||
+{
|
||||
+public:
|
||||
+ JsInitHelperType() { JS_Init(); }
|
||||
+ ~JsInitHelperType() { JS_ShutDown(); }
|
||||
+} JsInitHelper;
|
||||
+
|
||||
struct _PolkitBackendJsAuthorityPrivate
|
||||
{
|
||||
gchar **rules_dirs;
|
||||
@@ -589,7 +596,6 @@ polkit_backend_js_authority_finalize (GObject *object)
|
||||
delete authority->priv->js_polkit;
|
||||
|
||||
JS_DestroyContext (authority->priv->cx);
|
||||
- /* JS_ShutDown (); */
|
||||
|
||||
G_OBJECT_CLASS (polkit_backend_js_authority_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -665,8 +671,6 @@ polkit_backend_js_authority_class_init (PolkitBackendJsAuthorityClass *klass)
|
||||
|
||||
|
||||
g_type_class_add_private (klass, sizeof (PolkitBackendJsAuthorityPrivate));
|
||||
-
|
||||
- JS_Init ();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------------------------------- */
|
||||
@@ -5,7 +5,7 @@ LICENSE = "LGPL-2.0-or-later"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=155db86cdbafa7532b41f390409283eb \
|
||||
file://src/polkit/polkit.h;beginline=1;endline=20;md5=0a8630b0133176d0504c87a0ded39db4"
|
||||
|
||||
DEPENDS = "expat glib-2.0 intltool-native mozjs-91"
|
||||
DEPENDS = "expat glib-2.0 intltool-native duktape"
|
||||
|
||||
inherit autotools gtk-doc pkgconfig useradd systemd gobject-introspection features_check
|
||||
|
||||
@@ -25,16 +25,16 @@ PAM_SRC_URI = "file://polkit-1_pam.patch"
|
||||
SRC_URI = "http://www.freedesktop.org/software/polkit/releases/polkit-${PV}.tar.gz \
|
||||
${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
|
||||
file://0003-make-netgroup-support-optional.patch \
|
||||
file://0002-jsauthority-port-to-mozjs-91.patch \
|
||||
file://0003-jsauthority-ensure-to-call-JS_Init-and-JS_ShutDown-e.patch \
|
||||
file://0001-pkexec-local-privilege-escalation-CVE-2021-4034.patch \
|
||||
file://0002-CVE-2021-4115-GHSL-2021-077-fix.patch \
|
||||
file://0003-Added-support-for-duktape-as-JS-engine.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "c8579fdb86e94295404211285fee0722ad04893f0213e571bd75c00972fd1f5c"
|
||||
|
||||
EXTRA_OECONF = "--with-os-type=moblin \
|
||||
--disable-man-pages \
|
||||
--disable-libelogind \
|
||||
--with-duktape \
|
||||
"
|
||||
|
||||
do_configure:prepend () {
|
||||
|
||||
Reference in New Issue
Block a user