<?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>13568</bug_id>
          
          <creation_ts>2019-10-02 22:05:58 +0000</creation_ts>
          <short_desc>Multiple issues with AppArmor recipe</short_desc>
          <delta_ts>2019-10-18 18:55:07 +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>Other YP Layers</product>
          <component>meta-security</component>
          <version>2.6.4</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>with backport</status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>3.1 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Anders Montonen">Anders.Montonen</reporter>
          <assigned_to name="Armin Kuster">akuster</assigned_to>
          
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>85156</commentid>
    <comment_count>0</comment_count>
    <who name="Anders Montonen">Anders.Montonen</who>
    <bug_when>2019-10-02 22:05:58 +0000</bug_when>
    <thetext>These issues were found with Thud, but I believe they affect all releases.

1. systemd.bbclass will delete the init script installed under /etc/init.d if &quot;sysvinit&quot; is not in DISTRO_FEATURES. This can be worked around with the following kludge:

python() {
    if &apos;postfuncs&apos; in d.getVarFlags(&apos;do_install&apos;):
        postfuncs = d.getVarFlags(&apos;do_install&apos;)[&apos;postfuncs&apos;].replace(&apos;rm_sysvinit_initddir&apos;, &apos;&apos;)
        d.setVarFlags(&apos;do_install&apos;, { &apos;postfuncs&apos;: postfuncs })
}

2. The /lib/apparmor/functions script does not work with BusyBox xargs. Fixed by adding findutils to RDEPENDS.

3. The /lib/apparmor/functions script also requires &quot;getconf&quot;, which is explicitly deleted by libc-common.bbclass.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85157</commentid>
    <comment_count>1</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2019-10-02 22:48:28 +0000</bug_when>
    <thetext>Thanks for the defect. 

How can i reproduce this so that maybe I can fix and test for future regressions?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85203</commentid>
    <comment_count>2</comment_count>
    <who name="Anders Montonen">Anders.Montonen</who>
    <bug_when>2019-10-03 19:45:33 +0000</bug_when>
    <thetext>I&apos;m using a custom distro based on the demo images from the meta-atmel layer, but I believe the following will suffice:

In the distro conf:
DISTRO_FEATURES_append = &quot; systemd apparmor&quot;
DISTRO_FEATURES_BACKFILL_CONSIDERED += &quot;sysvinit&quot;
VIRTUAL-RUNTIME_init_manager = &quot;systemd&quot;
VIRTUAL-RUNTIME_initscripts = &quot;systemd-compat-units&quot;

Create an apparmor_%.bbappend:
PTEST_ENABLED = &quot;0&quot; # The tests do not build
SYSTEMD_AUTO_ENABLE = &quot;enable&quot;

Add apparmor IMAGE_INSTALL.

When the image boots, the apparmor service should start, but currently fails.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85204</commentid>
    <comment_count>3</comment_count>
    <who name="Anders Montonen">Anders.Montonen</who>
    <bug_when>2019-10-03 21:51:58 +0000</bug_when>
    <thetext>There was another BusyBox incompatibility in the functions script. This is the &quot;works for me&quot; bbappend I ended up with:

apparmor_%.bbappend:
PTEST_ENABLED = &quot;0&quot;                                                                             
                                                                                                
python() {                                                                                      
    if &apos;postfuncs&apos; in d.getVarFlags(&apos;do_install&apos;):                                              
        postfuncs = d.getVarFlags(&apos;do_install&apos;)[&apos;postfuncs&apos;].replace(&apos;rm_sysvinit_initddir&apos;, &apos;&apos;)
        d.setVarFlags(&apos;do_install&apos;, { &apos;postfuncs&apos;: postfuncs })                                 
}                                                                                               
                                                                                                
do_install_append() {                                                                           
    sed -i -e &apos;s/getconf _NPROCESSORS_ONLN/nproc/&apos; ${D}/lib/apparmor/functions                  
    sed -i -e &apos;s/ls -AU/ls -A/&apos; ${D}/lib/apparmor/functions                                     
}                                                                                               
                                                                                                
SYSTEMD_AUTO_ENABLE = &quot;enable&quot;                                                                  
RDEPENDS_${PN}_append = &quot; findutils&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85277</commentid>
    <comment_count>4</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2019-10-09 17:32:39 +0000</bug_when>
    <thetext>I have time to look into this today.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85351</commentid>
    <comment_count>5</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2019-10-16 17:02:39 +0000</bug_when>
    <thetext>patch on list

https://patchwork.openembedded.org/patch/165852/

this passes the apparmor test with and w/o systemd enabled.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85395</commentid>
    <comment_count>6</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2019-10-18 18:55:07 +0000</bug_when>
    <thetext>this should be fixed in master and zeus now.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>