<div dir="ltr">Thanks john, that will be of great help.<div><br></div><div>I am trying to capture apparmor profile for hardening container, and i was not able to get the complete profile.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 20, 2020 at 5:38 PM John Johansen <<a href="mailto:john.johansen@canonical.com">john.johansen@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 10/20/20 2:16 PM, swarna latha wrote:<br>
> Hi,<br>
> <br>
> i see similar behaviour, i am not able to use mrCx, mrUx options to capture the apparmor logs of the process inside container.<br>
> <br>
> The process in the container is executed only if give ix. But i am not getting apparmor logs of this process.<br>
> <br>
that pretty much says you are hitting NO_NEW_PRIVS<br>
<br>
> is there any patch i can apply on 4.1 kernel to capture apparmor logs for this process.<br>
<br>
We can certainly create a patch to log something. Let me see what I can cherry-pick/backport to 4.1<br>
<br>
> <br>
> Thanks,<br>
> Swarna<br>
> <br>
> On Tue, Oct 20, 2020 at 4:55 PM John Johansen <<a href="mailto:john.johansen@canonical.com" target="_blank">john.johansen@canonical.com</a> <mailto:<a href="mailto:john.johansen@canonical.com" target="_blank">john.johansen@canonical.com</a>>> wrote:<br>
> <br>
>     oops forgot to check that you were in the reply, so this only went to<br>
>     simon and the list<br>
> <br>
>     On 10/20/20 12:55 PM, Simon Deziel wrote:<br>
>     > On 2020-10-20 3:46 p.m., swarna latha wrote:<br>
>     >> Thanks john for the quick reply..<br>
>     >><br>
>     >> My kernel version is 4.1.51-1.19<br>
>     >><br>
>     >> Tried below logging options, but didnt help. Not able to get logs, what is<br>
>     >> blocking apparmor to play video.<br>
>     >>  echo -n "noquiet" /sys/module/apparmor/parameters/audit<br>
>     >> echo 0> /sys/module/apparmor/parameters/debug<br>
>     ><br>
>     > So far, what I've seen with containers is that dmesg/kernel logs are<br>
>     > only visible from the host's context, not the containers themselves.<br>
>     ><br>
> <br>
>     this is usually true. In addition are you getting no apparmor logs, or<br>
>     just no apparmor log for this issue. Those are two different things to<br>
>     debug.<br>
> <br>
>     With that said I suspect the issue is NO_NEW_PRIVS, see prctl(2). When<br>
>     that is set apparmor can not transition its profile, and will fail execs<br>
>     that request a profile transition.<br>
> <br>
>     Looking at the 4.1 kernel apparmor is not auditing NO_NEW_PRIVS<br>
>     causing a failure in profile transitions (its an external restriction<br>
>     and not exactly part of apparmor). Which would also align with what<br>
>     you are seeing.<br>
> <br>
>     When it comes to NO_NEW_PRIVS on the 4.1 kernel you basically have<br>
>     three choices.<br>
> <br>
>     1. Don't transition the profile, use ix<br>
> <br>
>     2. transition the profile before the container does<br>
>         prctl(PR_SET_NO_NEW_PRIVS).<br>
> <br>
>     3. If a container task is unconfined it can transition into a<br>
>        profile even after NO_NEW_PRIVS is set but once it does that it<br>
>        won't be able to transition the profile again.<br>
> <br>
>     -- <br>
>     AppArmor mailing list<br>
>     <a href="mailto:AppArmor@lists.ubuntu.com" target="_blank">AppArmor@lists.ubuntu.com</a> <mailto:<a href="mailto:AppArmor@lists.ubuntu.com" target="_blank">AppArmor@lists.ubuntu.com</a>><br>
>     Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/apparmor" rel="noreferrer" target="_blank">https://lists.ubuntu.com/mailman/listinfo/apparmor</a><br>
> <br>
<br>
</blockquote></div>