<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15592</bug_id>
          
          <creation_ts>2024-09-10 15:56:05 +0000</creation_ts>
          <short_desc>Network isolation fails with recent appamor (as seen in Ubuntu 24.04 onwards)</short_desc>
          <delta_ts>2024-09-19 14:51:50 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>5.1</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>High</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>5.1 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>99630</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-09-10 15:56:05 +0000</bug_when>
    <thetext>Recent releases of apparmor (at least, as packaged by ubuntu) have an &quot;unprivileged_userns&quot; profile which blocks applications from creating new user namespaces.

This means bitbake will fail to enable the network isolation with an error like this:

Traceback (most recent call last):
  File &quot;bitbake/bin/bitbake-worker&quot;, line 268, in child
    bb.utils.disable_network(uid, gid)
  File &quot;/bitbake/lib/bb/utils.py&quot;, line 1653, in disable_network
    with open(&quot;/proc/self/uid_map&quot;, &quot;w&quot;) as f:
PermissionError: [Errno 1] Operation not permitted

For system binaries it possible to write profiles to allow the specific binaries to create user namespaces, but as bitbake is fetched by the user there&apos;s no way of specifying a path that upstream would accept.

https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/2056555 is the upstream apparmor bug tracking this issue, but we will not be getting a profile to allow any binary called &apos;bitbake-worker&apos; to create a user namespace as that would compromise the security improvements intended by this change.

https://discourse.ubuntu.com/t/ubuntu-24-04-lts-noble-numbat-release-notes/39890#unprivileged-user-namespace-restrictions talks about this feature and has several approaches to resolve it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99661</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-09-12 17:06:39 +0000</bug_when>
    <thetext>Initial patch on the list, which makes disabling/allowing apparmor mandatory.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99675</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2024-09-19 14:51:50 +0000</bug_when>
    <thetext>https://git.yoctoproject.org/poky/commit/?id=7004840f3dc12e76822cee7b48902c08a553a118</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>