Skip to contentSkip to conversation

bitbake-worker: remove the network flag

PATCH Randolph Sapp 2 participants 2 messages Sep 10, 2023 1 message not in the archive

lore
Share & tools
lore

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

#1 lore raw
Quoted 69 lines · Randolph Sapp via lists.openembedded.org

From: Randolph Sapp <[email protected]>

The network flag does not respect proxies as the fetch stage does [1]. As such it only works for some users at the whim of the recipe writer.

This introduces an issue downstream as the build results are now dependent on the network architecture of the builder, the recipe in question, and the combination of proxy variables they choose to export in addition to the normal host variables that affect builds (host tool version, build environment, etc).

This is far more indeterminate than a build system that properly exports proxy variables. If abuse of the network tag is an issue, then the network tag should be removed in it's current state.

[1] https://lists.openembedded.org/g/bitbake-devel/topic/100924096

---

The logical followup to my last patch, even if it does seem a little extreme.

  bin/bitbake-worker                                    | 11 +++++------
  .../bitbake-user-manual-metadata.rst                  |  6 ------
  2 files changed, 5 insertions(+), 12 deletions(-)
bin/bitbake-worker +5 -6
index 451e6926..71ff0516 100755
@@ -270,12 +270,11 @@ def fork_off_task(cfg, data, databuilder, workerdata, extraconfigdata, runtask):
 
                  bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", "")))
 
-                if not bb.utils.to_boolean(the_data.getVarFlag(taskname, 'network')):
-                    if bb.utils.is_local_uid(uid):
-                        logger.debug("Attempting to disable network for %s" % taskname)
-                        bb.utils.disable_network(uid, gid)
-                    else:
-                        logger.debug("Skipping disable network for %s since %s is not a local uid." % (taskname, uid))
+                if bb.utils.is_local_uid(uid):
+                    logger.debug("Attempting to disable network for %s" % taskname)
+                    bb.utils.disable_network(uid, gid)
+                else:
+                    logger.debug("Skipping disable network for %s since %s is not a local uid." % (taskname, uid))
 
                  # exported_vars() returns a generator which *cannot* be passed to os.environ.update()
                  # successfully. We also need to unset anything from the environment which shouldn't be there
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +0 -7
index 58975f4c..b35c332c 100644
@@ -1519,12 +1519,6 @@ functionality of the task:
     released. You can use this variable flag to accomplish mutual
     exclusion.
 
--  ``[network]``: When set to "1", allows a task to access the network. By
-   default, only the ``do_fetch`` task is granted network access. Recipes
-   shouldn't access the network outside of ``do_fetch`` as it usually
-   undermines fetcher source mirroring, image and licence manifests, software
-   auditing and supply chain security.
-
  -  ``[noexec]``: When set to "1", marks the task as being empty, with
     no execution required. You can use the ``[noexec]`` flag to set up
     tasks as dependency placeholders, or to disable tasks defined
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 7 lines

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

Do not merge this obviously. It breaks the fetch stage in it's current form. I just wanted to start another discussion. (The proper solution would have to be some explicit exclusions for processes in the do_fetch task.)

#2 lore raw
Quoted 69 lines · Randolph Sapp
Quoted 68 lines · Randolph Sapp via lists.openembedded.org

From: Randolph Sapp <[email protected]>

The network flag does not respect proxies as the fetch stage does [1]. As such it only works for some users at the whim of the recipe writer.

This introduces an issue downstream as the build results are now dependent on the network architecture of the builder, the recipe in question, and the combination of proxy variables they choose to export in addition to the normal host variables that affect builds (host tool version, build environment, etc).

This is far more indeterminate than a build system that properly exports proxy variables. If abuse of the network tag is an issue, then the network tag should be removed in it's current state.

[1] https://lists.openembedded.org/g/bitbake-devel/topic/100924096

---

The logical followup to my last patch, even if it does seem a little extreme.

  bin/bitbake-worker                                    | 11 +++++------
  .../bitbake-user-manual-metadata.rst                  |  6 ------
  2 files changed, 5 insertions(+), 12 deletions(-)
bin/bitbake-worker +5 -6
index 451e6926..71ff0516 100755
@@ -270,12 +270,11 @@ def fork_off_task(cfg, data, databuilder, workerdata, extraconfigdata, runtask):
 
                  bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", "")))
 
-                if not bb.utils.to_boolean(the_data.getVarFlag(taskname, 'network')):
-                    if bb.utils.is_local_uid(uid):
-                        logger.debug("Attempting to disable network for %s" % taskname)
-                        bb.utils.disable_network(uid, gid)
-                    else:
-                        logger.debug("Skipping disable network for %s since %s is not a local uid." % (taskname, uid))
+                if bb.utils.is_local_uid(uid):
+                    logger.debug("Attempting to disable network for %s" % taskname)
+                    bb.utils.disable_network(uid, gid)
+                else:
+                    logger.debug("Skipping disable network for %s since %s is not a local uid." % (taskname, uid))
 
                  # exported_vars() returns a generator which *cannot* be passed to os.environ.update()
                  # successfully. We also need to unset anything from the environment which shouldn't be there
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +0 -6
index 58975f4c..b35c332c 100644
@@ -1519,12 +1519,6 @@ functionality of the task:
     released. You can use this variable flag to accomplish mutual
     exclusion.
 
--  ``[network]``: When set to "1", allows a task to access the network. By
-   default, only the ``do_fetch`` task is granted network access. Recipes
-   shouldn't access the network outside of ``do_fetch`` as it usually
-   undermines fetcher source mirroring, image and licence manifests, software
-   auditing and supply chain security.
-
  -  ``[noexec]``: When set to "1", marks the task as being empty, with
     no execution required. You can use the ``[noexec]`` flag to set up
     tasks as dependency placeholders, or to disable tasks defined
Quoted 13 lines
Quoted 8 lines

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

Do not merge this obviously. It breaks the fetch stage in it's current form. I just wanted to start another discussion. (The proper solution would have to be some explicit exclusions for processes in the do_fetch task.)

By sending this patch you're antagonising the maintainer, I'm not sure that will help achieve what you want.

Cheers,

Richard