Skip to contentSkip to conversation

manpages.bbclass: Fix rootfs host corruption

PATCH Superseded Alex Kiernan 3 participants 12 messages Dec 19, 2019 – Jun 22, 2020 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 manpages.bbclass: Fix rootfs host corruption

When running mandb we end up with files owned by the build user, correct this. Also pick up non-default locales and relocate their index.db files to /var/cache.

---

 meta/classes/manpages.bbclass | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
meta/classes/manpages.bbclass +8 -1
index 50c254763e89..1e66780646ea 100644
@@ -18,8 +18,15 @@ pkg_postinst_append_${MAN_PKG} () {
 		if test -n "$D"; then
 			if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true','false', d)}; then
 				sed "s:\(\s\)/:\1$D/:g" $D${sysconfdir}/man_db.conf | ${@qemu_run_binary(d, '$D', '${bindir}/mandb')} -C - -u -q $D${mandir}
+				chown -R root:root $D${mandir}
 				mkdir -p $D${localstatedir}/cache/man
-				mv $D${mandir}/index.db $D${localstatedir}/cache/man
+				cd $D${mandir}
+				find . -name index.db | while read index; do
+					mkdir -p $D${localstatedir}/cache/man/$(dirname ${index})
+					mv ${index} $D${localstatedir}/cache/man/${index}
+					chown man:man $D${localstatedir}/cache/man/${index}
+				done
+				cd -
 			else
 				$INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
 			fi
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 rootfs-postcommands: Enable rootfs_check_host_user_contaminated

Enable rootfs_check_host_user_contaminated by default

---

 meta/classes/rootfs-postcommands.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/rootfs-postcommands.bbclass +1 -1
index 2f171836fa0c..2c0f16cebd4c 100644
@@ -37,7 +37,7 @@ POSTINST_LOGFILE ?= "${localstatedir}/log/postinstall.log"
 SYSTEMD_DEFAULT_TARGET ?= '${@bb.utils.contains("IMAGE_FEATURES", "x11-base", "graphical.target", "multi-user.target", d)}'
 ROOTFS_POSTPROCESS_COMMAND += '${@bb.utils.contains("DISTRO_FEATURES", "systemd", "set_systemd_default_target; systemd_create_users;", "", d)}'
 
-ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile;'
+ROOTFS_POSTPROCESS_COMMAND += 'empty_var_volatile; rootfs_check_host_user_contaminated;'
 
 # Sort the user and group entries in /etc by ID in order to make the content
 # deterministic. Package installs are not deterministic, causing the ordering
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 2/2] rootfs-postcommands: Enable rootfs_check_host_user_contaminated

Quoted 1 line · Alex Kiernan

Enable rootfs_check_host_user_contaminated by default

Useful check!

WARNING: Paths in the rootfs are owned by the same user or group as the user running bitbake. See the logfile for the specific paths.

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core-image-sato/1.0-r0/rootfs/usr/share/fonts/.uuid

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core-image-sato/1.0-r0/rootfs/usr/share/fonts/ttf/.uuid

(patch incoming)

Ross

#3 lore raw

Re: [OE-core] [OE-Core][PATCH 2/2] rootfs-postcommands: Enable rootfs_check_host_user_contaminated

Hi Ross

Quoted 6 lines · Ross Burton
Quoted 1 line · Alex Kiernan

Enable rootfs_check_host_user_contaminated by default

Useful check!

Quoted 9 lines

WARNING: Paths in the rootfs are owned by the same user or group as the user running bitbake. See the logfile for the specific paths.

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core-image-sato/1.0-r0/rootfs/usr/share/fonts/.uuid

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core-image-sato/1.0-r0/rootfs/usr/share/fonts/ttf/.uuid

(patch incoming)

Did you manage to get a patch for this out? I've had a couple of goes at reproducing it and failed, but I suspect I'm not including the right things. It would be good to get this check enabled early in the release cycle, if we can?

Signature · 1 line
Alex Kiernan

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [OE-core] [OE-Core][PATCH 2/2] rootfs-postcommands: Enable rootfs_check_host_user_contaminated

Quoted 17 lines · Alex Kiernan via lists.openembedded.org

Hi Ross

Quoted 13 lines · Ross Burton
Quoted 1 line · Alex Kiernan

Enable rootfs_check_host_user_contaminated by default

Useful check!

WARNING: Paths in the rootfs are owned by the same user or group as the user running bitbake. See the logfile for the specific paths.

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core-image-sato/1.0-r0/rootfs/usr/share/fonts/.uuid

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core-image-sato/1.0-r0/rootfs/usr/share/fonts/ttf/.uuid

Quoted 8 lines
Quoted 2 lines

(patch incoming)

Did you manage to get a patch for this out? I've had a couple of goes at reproducing it and failed, but I suspect I'm not including the right things. It would be good to get this check enabled early in the release cycle, if we can?

Ping?

--
Alex Kiernan

#6 lore raw

Re: [OE-core] [OE-Core][PATCH 2/2] rootfs-postcommands: Enable rootfs_check_host_user_contaminated

Quoted 34 lines · Alex Kiernan

On Thu, May 21, 2020 at 3:14 PM Alex Kiernan via lists.openembedded.org <[email protected]

Quoted 1 line
Quoted 22 lines · wrote:

Hi Ross

Quoted 9 lines · Ross Burton
Quoted 1 line · Alex Kiernan

Enable rootfs_check_host_user_contaminated by default

Useful check!

WARNING: Paths in the rootfs are owned by the same user or group as the
user running bitbake. See the logfile for the specific paths.

Quoted 8 lines

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core-image- sato/1.0-r0/rootfs/usr/share/fonts/.uuid

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core-image- sato/1.0-r0/rootfs/usr/share/fonts/ttf/.uuid

(patch incoming)

Quoted 7 lines

Did you manage to get a patch for this out? I've had a couple of goes
at reproducing it and failed, but I suspect I'm not including the right things. It would be good to get this check enabled early in the
release cycle, if we can?

Quoted 1 line

Ping?

I'm trying to enable this but its triggering warnings on the autobuilder:

https://autobuilder.yoctoproject.org/typhoon/#/builders/76/builds/2037

Unfortunately the logs are totally useless. I think we'll have to improve the logging before this can be debugged and fixed which blocks this merging.

Cheers,

Richard

#7 lore raw

Re: [OE-core] [OE-Core][PATCH 2/2] rootfs-postcommands: Enable rootfs_check_host_user_contaminated

Hi Richard

Quoted 38 lines · Richard Purdie
Quoted 34 lines · Alex Kiernan

On Thu, May 21, 2020 at 3:14 PM Alex Kiernan via lists.openembedded.org <[email protected]

Quoted 1 line
Quoted 22 lines · wrote:

Hi Ross

Quoted 9 lines · Ross Burton
Quoted 1 line · Alex Kiernan

Enable rootfs_check_host_user_contaminated by default

Useful check!

WARNING: Paths in the rootfs are owned by the same user or group as the
user running bitbake. See the logfile for the specific paths.

Quoted 8 lines

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core-image- sato/1.0-r0/rootfs/usr/share/fonts/.uuid

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core-image- sato/1.0-r0/rootfs/usr/share/fonts/ttf/.uuid

(patch incoming)

Quoted 7 lines

Did you manage to get a patch for this out? I've had a couple of goes
at reproducing it and failed, but I suspect I'm not including the right things. It would be good to get this check enabled early in the
release cycle, if we can?

Quoted 1 line

Ping?

Quoted 9 lines

I'm trying to enable this but its triggering warnings on the autobuilder:

https://autobuilder.yoctoproject.org/typhoon/#/builders/76/builds/2037

Unfortunately the logs are totally useless. I think we'll have to improve the logging before this can be debugged and fixed which blocks this merging.

I've had a couple of goes at reproducing this locally, based on the configuration I think it's building and can't get it to fail...

Presumably we need to expose the failure lines from the supplementary log file so that they make it into the autobuilder output?

--
Alex Kiernan

#8 lore raw

Re: [OE-core] [OE-Core][PATCH 2/2] rootfs-postcommands: Enable rootfs_check_host_user_contaminated

Quoted 59 lines · Alex Kiernan

Hi Richard

Quoted 47 lines · Richard Purdie
Quoted 41 lines · Alex Kiernan

On Thu, May 21, 2020 at 3:14 PM Alex Kiernan via
lists.openembedded.org <
[email protected]

Quoted 26 lines · wrote:

Hi Ross

Quoted 14 lines · Ross Burton
Quoted 1 line · Alex Kiernan

Enable rootfs_check_host_user_contaminated by default

Useful check!

WARNING: Paths in the rootfs are owned by the same user or group
as the
user running bitbake. See the logfile for the specific paths.

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core- image-
sato/1.0-r0/rootfs/usr/share/fonts/.uuid

Quoted 6 lines

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core- image- sato/1.0-r0/rootfs/usr/share/fonts/ttf/.uuid

(patch incoming)

Quoted 10 lines

Did you manage to get a patch for this out? I've had a couple of
goes
at reproducing it and failed, but I suspect I'm not including the
right things. It would be good to get this check enabled early in
the
release cycle, if we can?

Quoted 1 line

Ping?

I'm trying to enable this but its triggering warnings on the autobuilder:

Quoted 7 lines

https://autobuilder.yoctoproject.org/typhoon/#/builders/76/builds/2037

Unfortunately the logs are totally useless. I think we'll have to improve the logging before this can be debugged and fixed which blocks
this merging.

Quoted 5 lines

I've had a couple of goes at reproducing this locally, based on the configuration I think it's building and can't get it to fail...

Presumably we need to expose the failure lines from the supplementary log file so that they make it into the autobuilder output?

Yes, we need the output to show which files are affected to have some chance of figuring out how to fix this. The fact its happening intermittently is somewhat worrying :/.

Cheers,

Richard

#9 lore raw

Re: [OE-core] [OE-Core][PATCH 2/2] rootfs-postcommands: Enable rootfs_check_host_user_contaminated

Quoted 64 lines · Richard Purdie
Quoted 62 lines · Alex Kiernan

Hi Richard

Quoted 47 lines · Richard Purdie
Quoted 41 lines · Alex Kiernan

On Thu, May 21, 2020 at 3:14 PM Alex Kiernan via
lists.openembedded.org <
[email protected]

Quoted 26 lines · wrote:

Hi Ross

Quoted 14 lines · Ross Burton
Quoted 1 line · Alex Kiernan

Enable rootfs_check_host_user_contaminated by default

Useful check!

WARNING: Paths in the rootfs are owned by the same user or group
as the
user running bitbake. See the logfile for the specific paths.

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core- image-
sato/1.0-r0/rootfs/usr/share/fonts/.uuid

Quoted 6 lines

/data/poky-tmp/master/work/intel_corei7_64-poky-linux/core- image- sato/1.0-r0/rootfs/usr/share/fonts/ttf/.uuid

(patch incoming)

Quoted 10 lines

Did you manage to get a patch for this out? I've had a couple of
goes
at reproducing it and failed, but I suspect I'm not including the
right things. It would be good to get this check enabled early in
the
release cycle, if we can?

Quoted 1 line

Ping?

I'm trying to enable this but its triggering warnings on the autobuilder:

Quoted 7 lines

https://autobuilder.yoctoproject.org/typhoon/#/builders/76/builds/2037

Unfortunately the logs are totally useless. I think we'll have to improve the logging before this can be debugged and fixed which blocks
this merging.

I've had a couple of goes at reproducing this locally, based on the configuration I think it's building and can't get it to fail...

Quoted 7 lines
Quoted 2 lines

Presumably we need to expose the failure lines from the supplementary log file so that they make it into the autobuilder output?

Yes, we need the output to show which files are affected to have some chance of figuring out how to fix this. The fact its happening intermittently is somewhat worrying :/.

Just sent a v2 which includes changes to push the failure paths into the main log

Quoted 4 lines

Cheers,

Richard

--
Alex Kiernan

#10 lore raw
In reply to Alex Kiernan
Quoted 7 lines · Alex Kiernan

When running mandb we end up with files owned by the build user, correct this. Also pick up non-default locales and relocate their index.db files to /var/cache.

---

Ping?

Quoted 28 lines
 meta/classes/manpages.bbclass | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
meta/classes/manpages.bbclass +8 -2
index 50c254763e89..1e66780646ea 100644
@@ -18,8 +18,15 @@ pkg_postinst_append_${MAN_PKG} () {
                if test -n "$D"; then
                        if ${@bb.utils.contains('MACHINE_FEATURES', 'qemu-usermode', 'true','false', d)}; then
                                sed "s:\(\s\)/:\1$D/:g" $D${sysconfdir}/man_db.conf | ${@qemu_run_binary(d, '$D', '${bindir}/mandb')} -C - -u -q $D${mandir}
+                               chown -R root:root $D${mandir}
                                mkdir -p $D${localstatedir}/cache/man
-                               mv $D${mandir}/index.db $D${localstatedir}/cache/man
+                               cd $D${mandir}
+                               find . -name index.db | while read index; do
+                                       mkdir -p $D${localstatedir}/cache/man/$(dirname ${index})
+                                       mv ${index} $D${localstatedir}/cache/man/${index}
+                                       chown man:man $D${localstatedir}/cache/man/${index}
+                               done
+                               cd -
                        else
                                $INTERCEPT_DIR/postinst_intercept delay_to_first_boot ${PKG} mlprefix=${MLPREFIX}
                        fi
--

2.17.1

Signature · 1 line
Alex Kiernan
#11 lore raw
Quoted 10 lines · Alex Kiernan
Quoted 7 lines · Alex Kiernan

When running mandb we end up with files owned by the build user, correct this. Also pick up non-default locales and relocate their index.db files to /var/cache.

---

Ping?

I never saw this on the list can you repost please?

Ross

#12 lore raw
Quoted 8 lines · Ross Burton
Quoted 6 lines · Alex Kiernan
Quoted 5 lines · Alex Kiernan

When running mandb we end up with files owned by the build user, correct this. Also pick up non-default locales and relocate their index.db files to /var/cache.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

---

Ping?

I never saw this on the list can you repost please?

Sure - it's the companion to the one I think you'd started to look at ("Enable rootfs_check_host_user_contaminated"); I was fixing up manpages leakage, but you found some of the font stuff leaking host users into the image.

--
Alex Kiernan