sanity.bbclass: verify that user isn't building in PSEUDO_IGNORE_PATHS
PATCH 1/1 sanity.bbclass: verify that user isn't building in PSEUDO_IGNORE_PATHS
If a user builds in a path in PSEUDO_IGNORE_PATHS, random failures are generated. Hence this patch adds a sanity check in sanity.bbclass to ensure that a user isn't building in PSEUDO_IGNORE_PATHS.
[YOCTO #14179]
--- meta/classes/sanity.bbclass | 7 +++++++ 1 file changed, 7 insertions(+)
meta/classes/sanity.bbclass +7 -0
@@ -703,6 +703,13 @@ def check_sanity_version_change(status, d): if (tmpdirmode & stat.S_ISUID): status.addresult("TMPDIR is setuid, please don't build in a setuid directory") + # Check that a user isn't building in a path in PSEUDO_IGNORE_PATHS + pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",") + workdir = d.getVar('WORKDIR', expand=True) + for i in pseudoignorepaths: + if i and workdir.startswith(i): + status.addresult("You are building in a path in PSEUDO_IGNORE_PATHS: " + str(i) + " please don't build in this directory: " + str(workdir) + "\n") + # Some third-party software apparently relies on chmod etc. being suid root (!!) import stat suid_check_bins = "chown chmod mknod".split()
Signature · 1 line
2.17.1
Quoted 21 lines · Dorinda
If a user builds in a path in
PSEUDO_IGNORE_PATHS, random failures are generated. Hence this patch adds a sanity check in sanity.bbclass to ensure that a user isn't building inPSEUDO_IGNORE_PATHS.[YOCTO #14179]
Signed-off-by Dorinda Bassey <[email protected]>---
meta/classes/sanity.bbclass | 7 +++++++1 file changed, 7 insertions(+)meta/classes/sanity.bbclass +0
-0@@ -703,6 +703,13 @@ def check_sanity_version_change(status, d):if (tmpdirmode & stat.S_ISUID):
status.addresult("TMPDIR is setuid, please don't build in a setuid directory")
meta/classes/sanity.bbclass def check_sanity_version_change(status, d): · line 711
Quoted 6 lines
meta/classes/sanity.bbclass +6
-0+ # Check that a user isn't building in a path in PSEUDO_IGNORE_PATHS + pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",") + workdir = d.getVar('WORKDIR', expand=True) + for i in pseudoignorepaths: + if i and workdir.startswith(i): + status.addresult("You are building in a path in PSEUDO_IGNORE_PATHS: " + str(i) + " please don't build in this directory: " + str(workdir) + "\n")
To ensure the user fully understands this, should this be something like:
status.addresult("You are building in a path included in PSEUDO_IGNORE_PATHS " + str(i) + " which will not work, please locate the build outside this path.\n")
as we then tell the user what to do (and don't repeat effectively the same information twice).
Cheers,
Richard
Hi Richard,
Is it possible to use an opposite way for pseudo path filtering?
Instead of ignoring paths, only take into consideration paths in something like PSEUDO_CONSIDER_PATHS. The list should be short. ${D}, ${PKGD}, ${PKGDEST}, ${IMAGE_ROOTFS}?
Best Regards,
Chen Qi
Quoted 47 lines · Richard Purdie
Quoted 17 lines · Dorinda
If a user builds in a path in
PSEUDO_IGNORE_PATHS, random failures are generated. Hence this patch adds a sanity check in sanity.bbclass to ensure that a user isn't building inPSEUDO_IGNORE_PATHS.[YOCTO #14179]
Signed-off-by Dorinda Bassey <[email protected]>--- meta/classes/sanity.bbclass | 7 +++++++ 1 file changed, 7 insertions(+)meta/classes/sanity.bbclass +0
-0@@ -703,6 +703,13 @@ def check_sanity_version_change(status, d): if (tmpdirmode & stat.S_ISUID): status.addresult("TMPDIR is setuid, please don't build in a setuid directory")meta/classes/sanity.bbclass def check_sanity_version_change(status, d): · line 714
Quoted 10 lines
meta/classes/sanity.bbclass +6
-0+ # Check that a user isn't building in a path in PSEUDO_IGNORE_PATHS + pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",") + workdir = d.getVar('WORKDIR', expand=True) + for i in pseudoignorepaths: + if i and workdir.startswith(i): + status.addresult("You are building in a path in PSEUDO_IGNORE_PATHS: " + str(i) + " please don't build in this directory: " + str(workdir) + "\n")To ensure the user fully understands this, should this be something like:
status.addresult("You are building in a path included in
PSEUDO_IGNORE_PATHS" + str(i) + " which will not work, please locate the build outside this path.\n")as we then tell the user what to do (and don't repeat effectively the same information twice).
Cheers,
Richard
Hi,
Quoted 5 lines · ChenQi
Is it possible to use an opposite way for pseudo path filtering? Instead of ignoring paths, only take into consideration paths in something like
PSEUDO_CONSIDER_PATHS.
The list should be short. ${D}, ${PKGD}, ${PKGDEST}, ${IMAGE_ROOTFS}?
Its a good question, I was convinced by the pseudo authors that it was a bad idea. The reason being that it isn't just the above paths but we also need to catch calls where files are transiently in other directories or in other parts of the filesystem such as /tmp/. Code creates files in interesting and convoluted ways to preserve permissions, for security reasons and so on and there was a worry that masking just a specific list would cause a different set of problems. It probably shouldn't be crossing filesystem boundaries doing it but I know there were complications due to it.
That said, now that pseudo can support path filtering, it may be worth an experiment to see how whether it could work better than what we're doing now. The algorithm (whether its include or exclude) should be relatively easy to test.
I can also say the above list would need expanding as some sstate objects need to preserve ownership/permissions during creating and so on. It probably would still be simpler than our current ignore list though.
Cheers,
Richard
Quoted 18 lines · Richard Purdie
Hi,
Quoted 5 lines · ChenQi
Is it possible to use an opposite way for pseudo path filtering? Instead of ignoring paths, only take into consideration paths in
something likePSEUDO_CONSIDER_PATHS.
The list should be short. ${D}, ${PKGD}, ${PKGDEST},
${IMAGE_ROOTFS}?Its a good question, I was convinced by the pseudo authors that it was a bad idea. The reason being that it isn't just the above paths but we also need to catch calls where files are transiently in other directories or in other parts of the filesystem such as
/tmp/. Code creates files in interesting and convoluted ways to preserve permissions, for security reasons and so on and there was a worry that masking just a specific list would cause a different set of problems. It probably shouldn't be crossing filesystem boundaries doing it but I know there were complications due to it.
Quoted 4 lines
That said, now that pseudo can support path filtering, it may be worth an experiment to see how whether it could work better than what we're doing now. The algorithm (whether its include or exclude) should be relatively easy to test.
Yes. I'm now testing the patch.
Quoted 4 lines
I can also say the above list would need expanding as some sstate objects need to preserve ownership/permissions during creating and so on.
Thanks. You are right. The current list is "${D},${PKGD},${PKGDEST},${IMAGE_ROOTFS},${SDK_OUTPUT},${STAGING_DIR}"
I'm now doing more build testing to see if it needs to be expanded.
Best Regards,
Chen Qi
Quoted 11 lines
It probably would still be simpler than our current ignore list though.
Cheers,
Richard
Hi Richard,
I've sent out the patches. They are tested with:
1. bitbake IMAGE && bitbake IMAGE -c populate_sdk
2. bitbake world
3. bitbake IMAGE -c populate_sdk_ext; Install the eSDK
The world build covers all oe-core recipes and part of the recipes in some other meta layers such as meta-openembedded, meta-virtualization, meta-secure-core, etc. The recipe number is about 2000.
Best Regards,
Chen Qi
Quoted 36 lines · Richard Purdie
Hi,
Quoted 5 lines · ChenQi
Is it possible to use an opposite way for pseudo path filtering? Instead of ignoring paths, only take into consideration paths in
something likePSEUDO_CONSIDER_PATHS.
The list should be short. ${D}, ${PKGD}, ${PKGDEST},
${IMAGE_ROOTFS}?Its a good question, I was convinced by the pseudo authors that it was a bad idea. The reason being that it isn't just the above paths but we also need to catch calls where files are transiently in other directories or in other parts of the filesystem such as
/tmp/. Code creates files in interesting and convoluted ways to preserve permissions, for security reasons and so on and there was a worry that masking just a specific list would cause a different set of problems. It probably shouldn't be crossing filesystem boundaries doing it but I know there were complications due to it.That said, now that pseudo can support path filtering, it may be worth an experiment to see how whether it could work better than what we're doing now. The algorithm (whether its include or exclude) should be relatively easy to test.
I can also say the above list would need expanding as some sstate objects need to preserve ownership/permissions during creating and so on. It probably would still be simpler than our current ignore list though.
Cheers,
Richard