Skip to contentSkip to conversation

base-passwd: Add the sgx group

PATCH In review Alex Kiernan 4 participants 6 messages Jul 28, 2023 – Jul 29, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 base-passwd: Add the sgx group

To avoid errors from eudev/udev we need an sgx group, but if we add it via groupadd that causes shadow login to be brought into an image, which causes images which have CONFIG_MULTIUSER unset to fail with `setgid:
Function not implemented` as shadow's login doesn't implement the heuristics which busybox has to handle this kernel configuration.

---

 .../0001-base-passwd-Add-the-sgx-group.patch  | 30 +++++++++++++++++++
 .../base-passwd/base-passwd_3.6.1.bb          |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 meta/recipes-core/base-passwd/base-passwd/0001-base-passwd-Add-the-sgx-group.patch
meta/recipes-core/base-passwd/base-passwd/0001-base-passwd-Add-the-sgx-group.patch new file +30 -0
new file mode 100644
index 000000000000..e1340e1b70cf
@@ -0,0 +1,30 @@
+From 9e57771d138ac423d5139b984b8c869122ce4976 Mon Sep 17 00:00:00 2001
+From: Alex Kiernan <[email protected]>
+Date: Fri, 28 Jul 2023 10:28:57 +0100
+Subject: [PATCH] base-passwd: Add the sgx group
+
+To avoid errors from eudev/udev we need an sgx group, but if we add it
+via groupadd that causes shadow login to be brought into an image, which
+causes images which have CONFIG_MULTIUSER unset to fail with `setgid:
+Function not implemented` as shadow's login doesn't implement the
+heuristics which busybox has to handle this kernel configuration.
+
+Upstream-Status: Inappropriate [oe-specific]
+
+Signed-off-by: Alex Kiernan <[email protected]>
+---
+ group.master | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/group.master b/group.master
+index d34d2b832d43..e54fd1d2c6dc 100644
+--- a/group.master
++++ b/group.master
+@@ -34,6 +34,7 @@ video:*:44:
+ sasl:*:45:
+ plugdev:*:46:
+ kvm:*:47:
++sgx:*:48:
+ staff:*:50:
+ games:*:60:
+ shutdown:*:70:
meta/recipes-core/base-passwd/base-passwd_3.6.1.bb +1 -0
index 204016b3e72e..44bcfb019930 100644
@@ -13,6 +13,7 @@ SRC_URI = "https://launchpad.net/debian/+archive/primary/+files/${BPN}_${PV}.tar
            file://0005-Add-kvm-group.patch \
            file://0006-Make-it-possible-to-configure-whether-to-use-SELinux.patch \
            file://0007-Add-wheel-group.patch \
+           file://0001-base-passwd-Add-the-sgx-group.patch \
            "
 
 SRC_URI[sha256sum] = "6ff369be59d586ba63c0c5fcb00f75f9953fe49db88bc6c6428f2c92866f79af"
Signature · 1 line
2.39.0
#1 lore raw

PATCH 2/2 udev: eudev: Revert add group to sgx

The sgx group is part of base-passwd now.

---

 meta/recipes-core/systemd/systemd_253.3.bb | 2 +-
 meta/recipes-core/udev/eudev_3.2.12.bb     | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)
meta/recipes-core/systemd/systemd_253.3.bb +1 -1
index cf0e17ff002b..1fd4556afd0e 100644
@@ -424,7 +424,7 @@ USERADD_PACKAGES = "${PN} ${PN}-extra-utils \
                     ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
 "
 GROUPADD_PARAM:${PN} = "-r systemd-journal;"
-GROUPADD_PARAM:udev = "-r render;-r sgx;"
+GROUPADD_PARAM:udev = "-r render"
 GROUPADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}"
 USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}"
 USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}"
meta/recipes-core/udev/eudev_3.2.12.bb +1 -4
index 4268bcc2c5de..572ccecafd0c 100644
@@ -18,7 +18,7 @@ SRC_URI[sha256sum] = "ccdd64ec3c381d3c3ed0e99d2e70d1f62988c7763de89ca7bdffafa5ea
 
 GITHUB_BASE_URI = "https://github.com/eudev-project/eudev/releases"
 
-inherit autotools update-rc.d qemu pkgconfig features_check manpages github-releases useradd
+inherit autotools update-rc.d qemu pkgconfig features_check manpages github-releases
 
 CONFLICT_DISTRO_FEATURES = "systemd"
 
@@ -85,6 +85,3 @@ pkg_postinst:${PN}-hwdb () {
 pkg_prerm:${PN}-hwdb () {
 	rm -f $D${sysconfdir}/udev/hwdb.bin
 }
-
-USERADD_PACKAGES = "${PN}"
-GROUPADD_PARAM:${PN} = "-r sgx"
Signature · 1 line
2.39.0
#2 lore raw

Re: [OE-Core][PATCH 2/2] udev: eudev: Revert add group to sgx

Quoted 3 lines · Alex Kiernan

The sgx group is part of base-passwd now.

thats ok although it is specific to Intel SGX enclave device nodes having this group. I wonder if we should make it just for x86

Quoted 52 lines

---

 meta/recipes-core/systemd/systemd_253.3.bb | 2 +-
 meta/recipes-core/udev/eudev_3.2.12.bb     | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)
meta/recipes-core/systemd/systemd_253.3.bb +1 -1
index cf0e17ff002b..1fd4556afd0e 100644
@@ -424,7 +424,7 @@ USERADD_PACKAGES = "${PN} ${PN}-extra-utils \
                     ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
 "
 GROUPADD_PARAM:${PN} = "-r systemd-journal;"
-GROUPADD_PARAM:udev = "-r render;-r sgx;"
+GROUPADD_PARAM:udev = "-r render"
 GROUPADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}"
 USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}"
 USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}"
meta/recipes-core/udev/eudev_3.2.12.bb +1 -5
index 4268bcc2c5de..572ccecafd0c 100644
@@ -18,7 +18,7 @@ SRC_URI[sha256sum] = "ccdd64ec3c381d3c3ed0e99d2e70d1f62988c7763de89ca7bdffafa5ea
 
 GITHUB_BASE_URI = "https://github.com/eudev-project/eudev/releases"
 
-inherit autotools update-rc.d qemu pkgconfig features_check manpages github-releases useradd
+inherit autotools update-rc.d qemu pkgconfig features_check manpages github-releases
 
 CONFLICT_DISTRO_FEATURES = "systemd"
 
@@ -85,6 +85,3 @@ pkg_postinst:${PN}-hwdb () {
 pkg_prerm:${PN}-hwdb () {
        rm -f $D${sysconfdir}/udev/hwdb.bin
 }
-
-USERADD_PACKAGES = "${PN}"
-GROUPADD_PARAM:${PN} = "-r sgx"
--

2.39.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#185016): https://lists.openembedded.org/g/openembedded-core/message/185016
Mute This Topic: https://lists.openembedded.org/mt/100407491/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
In reply to Alex Kiernan
Quoted 6 lines · Alex Kiernan

To avoid errors from eudev/udev we need an sgx group, but if we add it via groupadd that causes shadow login to be brought into an image, which causes images which have CONFIG_MULTIUSER unset to fail with `setgid:
Function not implemented` as shadow's login doesn't implement the heuristics which busybox has to handle this kernel configuration.

Firstly, thank you very much for fixing this. I was having lots of trouble with it.

I just wanted to point out that the underlying sgx issue is unique to Intel/x86. So, it might make sense to only apply this patch in this case.

Thanks,
Jon

Quoted 68 lines

---

 .../0001-base-passwd-Add-the-sgx-group.patch  | 30 +++++++++++++++++++
 .../base-passwd/base-passwd_3.6.1.bb          |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 meta/recipes-core/base-passwd/base-passwd/0001-base-passwd-Add-the-sgx-group.patch
meta/recipes-core/base-passwd/base-passwd/0001-base-passwd-Add-the-sgx-group.patch new file +30 -0
new file mode 100644
index 000000000000..e1340e1b70cf
@@ -0,0 +1,30 @@
+From 9e57771d138ac423d5139b984b8c869122ce4976 Mon Sep 17 00:00:00 2001
+From: Alex Kiernan <[email protected]>
+Date: Fri, 28 Jul 2023 10:28:57 +0100
+Subject: [PATCH] base-passwd: Add the sgx group
+
+To avoid errors from eudev/udev we need an sgx group, but if we add it
+via groupadd that causes shadow login to be brought into an image, which
+causes images which have CONFIG_MULTIUSER unset to fail with `setgid:
+Function not implemented` as shadow's login doesn't implement the
+heuristics which busybox has to handle this kernel configuration.
+
+Upstream-Status: Inappropriate [oe-specific]
+
+Signed-off-by: Alex Kiernan <[email protected]>
+---
+ group.master | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/group.master b/group.master
+index d34d2b832d43..e54fd1d2c6dc 100644
+--- a/group.master
++++ b/group.master
+@@ -34,6 +34,7 @@ video:*:44:
+ sasl:*:45:
+ plugdev:*:46:
+ kvm:*:47:
++sgx:*:48:
+ staff:*:50:
+ games:*:60:
+ shutdown:*:70:
meta/recipes-core/base-passwd/base-passwd_3.6.1.bb +1 -1
index 204016b3e72e..44bcfb019930 100644
@@ -13,6 +13,7 @@ SRC_URI = "https://launchpad.net/debian/+archive/primary/+files/${BPN}_${PV}.tar
            file://0005-Add-kvm-group.patch \
            file://0006-Make-it-possible-to-configure-whether-to-use-SELinux.patch \
            file://0007-Add-wheel-group.patch \
+           file://0001-base-passwd-Add-the-sgx-group.patch \
            "
 
 SRC_URI[sha256sum] = "6ff369be59d586ba63c0c5fcb00f75f9953fe49db88bc6c6428f2c92866f79af"
--

2.39.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#185015): https://lists.openembedded.org/g/openembedded-core/message/185015
Mute This Topic: https://lists.openembedded.org/mt/100407464/3616920
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw
Quoted 9 lines · Jon Mason
Quoted 6 lines · Alex Kiernan

To avoid errors from eudev/udev we need an sgx group, but if we add it via groupadd that causes shadow login to be brought into an image, which causes images which have CONFIG_MULTIUSER unset to fail with `setgid:
Function not implemented` as shadow's login doesn't implement the heuristics which busybox has to handle this kernel configuration.

Quoted 7 lines

Firstly, thank you very much for fixing this. I was having lots of trouble with it.

I just wanted to point out that the underlying sgx issue is unique to Intel/x86. So, it might make sense to only apply this patch in this case.

You get the noise from eudev on everything (I'm deploying onto aarch64), I guess because it fails at parse time and everyone gets the same rules. Obviously we could try for an sgx only rule on x86, but tbh that feels like way too much effort!

I think we want something like this on poky-tiny so this doesn't regress:

(quoted diff) +0 -0

b/meta-poky/conf/distro/poky-tiny.conf
index f65d2dabf3af..728d161d59af 100644

meta-poky/conf/distro/poky-tiny.conf +0 -0
@@ -122,3 +122,7 @@ SKIP_RECIPE[core-image-weston] = "not buildable

with poky-tiny"

# Disable python usage in opkg-utils since it won't build with tiny config PACKAGECONFIG:remove:pn-opkg-utils = "python"
+
+# If shadow-base is brought into the image, logins will fail because it +# doesn't have the heuristics to work when CONFIG_MULTIUSER is unset. +PACKAGE_EXCLUDE:poky-tiny = "shadow-base"

Quoted 71 lines

Thanks,
Jon

Quoted 68 lines

---

 .../0001-base-passwd-Add-the-sgx-group.patch  | 30 +++++++++++++++++++
 .../base-passwd/base-passwd_3.6.1.bb          |  1 +
 2 files changed, 31 insertions(+)
 create mode 100644 meta/recipes-core/base-passwd/base-passwd/0001-base-passwd-Add-the-sgx-group.patch
meta/recipes-core/base-passwd/base-passwd/0001-base-passwd-Add-the-sgx-group.patch new file +30 -0
new file mode 100644
index 000000000000..e1340e1b70cf
@@ -0,0 +1,30 @@
+From 9e57771d138ac423d5139b984b8c869122ce4976 Mon Sep 17 00:00:00 2001
+From: Alex Kiernan <[email protected]>
+Date: Fri, 28 Jul 2023 10:28:57 +0100
+Subject: [PATCH] base-passwd: Add the sgx group
+
+To avoid errors from eudev/udev we need an sgx group, but if we add it
+via groupadd that causes shadow login to be brought into an image, which
+causes images which have CONFIG_MULTIUSER unset to fail with `setgid:
+Function not implemented` as shadow's login doesn't implement the
+heuristics which busybox has to handle this kernel configuration.
+
+Upstream-Status: Inappropriate [oe-specific]
+
+Signed-off-by: Alex Kiernan <[email protected]>
+---
+ group.master | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/group.master b/group.master
+index d34d2b832d43..e54fd1d2c6dc 100644
+--- a/group.master
++++ b/group.master
+@@ -34,6 +34,7 @@ video:*:44:
+ sasl:*:45:
+ plugdev:*:46:
+ kvm:*:47:
++sgx:*:48:
+ staff:*:50:
+ games:*:60:
+ shutdown:*:70:
meta/recipes-core/base-passwd/base-passwd_3.6.1.bb +1 -1
index 204016b3e72e..44bcfb019930 100644
@@ -13,6 +13,7 @@ SRC_URI = "https://launchpad.net/debian/+archive/primary/+files/${BPN}_${PV}.tar
            file://0005-Add-kvm-group.patch \
            file://0006-Make-it-possible-to-configure-whether-to-use-SELinux.patch \
            file://0007-Add-wheel-group.patch \
+           file://0001-base-passwd-Add-the-sgx-group.patch \
            "
 
 SRC_URI[sha256sum] = "6ff369be59d586ba63c0c5fcb00f75f9953fe49db88bc6c6428f2c92866f79af"
--

2.39.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#185015): https://lists.openembedded.org/g/openembedded-core/message/185015
Mute This Topic: https://lists.openembedded.org/mt/100407464/3616920
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 1 line
Alex Kiernan
#5 lore raw
Quoted 18 lines · Alex Kiernan
Quoted 9 lines · Jon Mason
Quoted 6 lines · Alex Kiernan

To avoid errors from eudev/udev we need an sgx group, but if we add it via groupadd that causes shadow login to be brought into an image, which causes images which have CONFIG_MULTIUSER unset to fail with `setgid:
Function not implemented` as shadow's login doesn't implement the heuristics which busybox has to handle this kernel configuration.

Quoted 7 lines

Firstly, thank you very much for fixing this. I was having lots of trouble with it.

I just wanted to point out that the underlying sgx issue is unique to Intel/x86. So, it might make sense to only apply this patch in this case.

Quoted 4 lines

You get the noise from eudev on everything (I'm deploying onto aarch64), I guess because it fails at parse time and everyone gets the same rules. Obviously we could try for an sgx only rule on x86, but tbh that feels like way too much effort!

FWIW I agree and merged this as the best of the bad options.

Quoted 13 lines

I think we want something like this on poky-tiny so this doesn't regress:

meta-poky/conf/distro/poky-tiny.conf +0 -0
index f65d2dabf3af..728d161d59af 100644
@@ -122,3 +122,7 @@ SKIP_RECIPE[core-image-weston] = "not buildable

with poky-tiny"

# Disable python usage in opkg-utils since it won't build with tiny config PACKAGECONFIG:remove:pn-opkg-utils = "python"

meta-poky/conf/distro/poky-tiny.conf

Quoted 4 lines
meta-poky/conf/distro/poky-tiny.conf +4 -0
+
+# If shadow-base is brought into the image, logins will fail because it
+# doesn't have the heuristics to work when CONFIG_MULTIUSER is unset.
+PACKAGE_EXCLUDE:poky-tiny = "shadow-base"

A patch would be welcome for that please!

Cheers,

Richard