* [PATCH] apparmor: fix bind mounts aborting with -ENOMEM
@ 2019-12-11 11:44 Patrick Steinhardt
2019-12-14 5:39 ` John Johansen
0 siblings, 1 reply; 2+ messages in thread
From: Patrick Steinhardt @ 2019-12-11 11:44 UTC (permalink / raw)
To: linux-security-module
Cc: Patrick Steinhardt, John Johansen, James Morris, Serge E . Hallyn,
Sebastian Andrzej Siewior
With commit df323337e507 (apparmor: Use a memory pool instead per-CPU
caches, 2019-05-03), AppArmor code was converted to use memory pools. In
that conversion, a bug snuck into the code that polices bind mounts that
causes all bind mounts to fail with -ENOMEM, as we erroneously error out
if `aa_get_buffer` returns a pointer instead of erroring out when it
does _not_ return a valid pointer.
Fix the issue by correctly checking for valid pointers returned by
`aa_get_buffer` to fix bind mounts with AppArmor.
Fixes: df323337e507 (apparmor: Use a memory pool instead per-CPU caches)
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
I've fixed the issue on top of v5.5-rc1, where I in fact found
the issue.
security/apparmor/mount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/apparmor/mount.c b/security/apparmor/mount.c
index 4ed6688f9d40..e0828ee7a345 100644
--- a/security/apparmor/mount.c
+++ b/security/apparmor/mount.c
@@ -442,7 +442,7 @@ int aa_bind_mount(struct aa_label *label, const struct path *path,
buffer = aa_get_buffer(false);
old_buffer = aa_get_buffer(false);
error = -ENOMEM;
- if (!buffer || old_buffer)
+ if (!buffer || !old_buffer)
goto out;
error = fn_for_each_confined(label, profile,
--
2.24.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] apparmor: fix bind mounts aborting with -ENOMEM
2019-12-11 11:44 [PATCH] apparmor: fix bind mounts aborting with -ENOMEM Patrick Steinhardt
@ 2019-12-14 5:39 ` John Johansen
0 siblings, 0 replies; 2+ messages in thread
From: John Johansen @ 2019-12-14 5:39 UTC (permalink / raw)
To: Patrick Steinhardt, linux-security-module
Cc: James Morris, Serge E . Hallyn, Sebastian Andrzej Siewior
On 12/11/19 3:44 AM, Patrick Steinhardt wrote:
> With commit df323337e507 (apparmor: Use a memory pool instead per-CPU
> caches, 2019-05-03), AppArmor code was converted to use memory pools. In
> that conversion, a bug snuck into the code that polices bind mounts that
> causes all bind mounts to fail with -ENOMEM, as we erroneously error out
> if `aa_get_buffer` returns a pointer instead of erroring out when it
> does _not_ return a valid pointer.
>
> Fix the issue by correctly checking for valid pointers returned by
> `aa_get_buffer` to fix bind mounts with AppArmor.
>
> Fixes: df323337e507 (apparmor: Use a memory pool instead per-CPU caches)
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
Sigh yep, I'm not sure how that slipped through. Obviously there is an
issue with out mount regression tests that needs to be found and fixed.
I'll pull this in and send it up. Thanks Patrick
> ---
>
> I've fixed the issue on top of v5.5-rc1, where I in fact found
> the issue.
>
> security/apparmor/mount.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/apparmor/mount.c b/security/apparmor/mount.c
> index 4ed6688f9d40..e0828ee7a345 100644
> --- a/security/apparmor/mount.c
> +++ b/security/apparmor/mount.c
> @@ -442,7 +442,7 @@ int aa_bind_mount(struct aa_label *label, const struct path *path,
> buffer = aa_get_buffer(false);
> old_buffer = aa_get_buffer(false);
> error = -ENOMEM;
> - if (!buffer || old_buffer)
> + if (!buffer || !old_buffer)
> goto out;
>
> error = fn_for_each_confined(label, profile,
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-14 5:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-11 11:44 [PATCH] apparmor: fix bind mounts aborting with -ENOMEM Patrick Steinhardt
2019-12-14 5:39 ` John Johansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).