<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/security/apparmor/lib.c, branch v6.12.80</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>apparmor: fix possible memory leak in unpack_trans_table</title>
<updated>2024-01-04T09:34:00+00:00</updated>
<author>
<name>Fedor Pchelkin</name>
<email>pchelkin@ispras.ru</email>
</author>
<published>2023-12-04T18:19:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=1342ad786073e96fa813ad943c19f586157ae297'/>
<id>1342ad786073e96fa813ad943c19f586157ae297</id>
<content type='text'>
If we fail to unpack the transition table then the table elements which
have been already allocated are not freed on error path.

unreferenced object 0xffff88802539e000 (size 128):
  comm "apparmor_parser", pid 903, jiffies 4294914938 (age 35.085s)
  hex dump (first 32 bytes):
    20 73 6f 6d 65 20 6e 61 73 74 79 20 73 74 72 69   some nasty stri
    6e 67 20 73 6f 6d 65 20 6e 61 73 74 79 20 73 74  ng some nasty st
  backtrace:
    [&lt;ffffffff81ddb312&gt;] __kmem_cache_alloc_node+0x1e2/0x2d0
    [&lt;ffffffff81c47194&gt;] __kmalloc_node_track_caller+0x54/0x170
    [&lt;ffffffff81c225b9&gt;] kmemdup+0x29/0x60
    [&lt;ffffffff83e1ee65&gt;] aa_unpack_strdup+0xe5/0x1b0
    [&lt;ffffffff83e20808&gt;] unpack_pdb+0xeb8/0x2700
    [&lt;ffffffff83e23567&gt;] unpack_profile+0x1507/0x4a30
    [&lt;ffffffff83e27bfa&gt;] aa_unpack+0x36a/0x1560
    [&lt;ffffffff83e194c3&gt;] aa_replace_profiles+0x213/0x33c0
    [&lt;ffffffff83de9461&gt;] policy_update+0x261/0x370
    [&lt;ffffffff83de978e&gt;] profile_replace+0x20e/0x2a0
    [&lt;ffffffff81eac8bf&gt;] vfs_write+0x2af/0xe00
    [&lt;ffffffff81eaddd6&gt;] ksys_write+0x126/0x250
    [&lt;ffffffff88f34fb6&gt;] do_syscall_64+0x46/0xf0
    [&lt;ffffffff890000ea&gt;] entry_SYSCALL_64_after_hwframe+0x6e/0x76

Call aa_free_str_table() on error path as was done before the blamed
commit. It implements all necessary checks, frees str_table if it is
available and nullifies the pointers.

Found by Linux Verification Center (linuxtesting.org).

Fixes: a0792e2ceddc ("apparmor: make transition table unpack generic so it can be reused")
Signed-off-by: Fedor Pchelkin &lt;pchelkin@ispras.ru&gt;
Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we fail to unpack the transition table then the table elements which
have been already allocated are not freed on error path.

unreferenced object 0xffff88802539e000 (size 128):
  comm "apparmor_parser", pid 903, jiffies 4294914938 (age 35.085s)
  hex dump (first 32 bytes):
    20 73 6f 6d 65 20 6e 61 73 74 79 20 73 74 72 69   some nasty stri
    6e 67 20 73 6f 6d 65 20 6e 61 73 74 79 20 73 74  ng some nasty st
  backtrace:
    [&lt;ffffffff81ddb312&gt;] __kmem_cache_alloc_node+0x1e2/0x2d0
    [&lt;ffffffff81c47194&gt;] __kmalloc_node_track_caller+0x54/0x170
    [&lt;ffffffff81c225b9&gt;] kmemdup+0x29/0x60
    [&lt;ffffffff83e1ee65&gt;] aa_unpack_strdup+0xe5/0x1b0
    [&lt;ffffffff83e20808&gt;] unpack_pdb+0xeb8/0x2700
    [&lt;ffffffff83e23567&gt;] unpack_profile+0x1507/0x4a30
    [&lt;ffffffff83e27bfa&gt;] aa_unpack+0x36a/0x1560
    [&lt;ffffffff83e194c3&gt;] aa_replace_profiles+0x213/0x33c0
    [&lt;ffffffff83de9461&gt;] policy_update+0x261/0x370
    [&lt;ffffffff83de978e&gt;] profile_replace+0x20e/0x2a0
    [&lt;ffffffff81eac8bf&gt;] vfs_write+0x2af/0xe00
    [&lt;ffffffff81eaddd6&gt;] ksys_write+0x126/0x250
    [&lt;ffffffff88f34fb6&gt;] do_syscall_64+0x46/0xf0
    [&lt;ffffffff890000ea&gt;] entry_SYSCALL_64_after_hwframe+0x6e/0x76

Call aa_free_str_table() on error path as was done before the blamed
commit. It implements all necessary checks, frees str_table if it is
available and nullifies the pointers.

Found by Linux Verification Center (linuxtesting.org).

Fixes: a0792e2ceddc ("apparmor: make transition table unpack generic so it can be reused")
Signed-off-by: Fedor Pchelkin &lt;pchelkin@ispras.ru&gt;
Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>apparmor: refcount the pdb</title>
<updated>2023-10-18T22:30:47+00:00</updated>
<author>
<name>John Johansen</name>
<email>john.johansen@canonical.com</email>
</author>
<published>2023-04-28T12:32:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=98b824ff8984fd523fc264fbb13208098ab09da3'/>
<id>98b824ff8984fd523fc264fbb13208098ab09da3</id>
<content type='text'>
With the move to permission tables the dfa is no longer a stand
alone entity when used, needing a minimum of a permission table.
However it still could be shared among different pdbs each using
a different permission table.

Instead of duping the permission table when sharing a pdb, add a
refcount to the pdb so it can be easily shared.

Reviewed-by: Georgia Garcia &lt;georgia.garcia@canonical.com&gt;
Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With the move to permission tables the dfa is no longer a stand
alone entity when used, needing a minimum of a permission table.
However it still could be shared among different pdbs each using
a different permission table.

Instead of duping the permission table when sharing a pdb, add a
refcount to the pdb so it can be easily shared.

Reviewed-by: Georgia Garcia &lt;georgia.garcia@canonical.com&gt;
Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>apparmor: rename audit_data-&gt;label to audit_data-&gt;subj_label</title>
<updated>2023-10-18T22:30:34+00:00</updated>
<author>
<name>John Johansen</name>
<email>john.johansen@canonical.com</email>
</author>
<published>2022-09-19T07:46:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=d20f5a1a6e792d22199c9989ec7ab9e95c48d60c'/>
<id>d20f5a1a6e792d22199c9989ec7ab9e95c48d60c</id>
<content type='text'>
rename audit_data's label field to subj_label to better reflect its
use. Also at the same time drop unneeded assignments to -&gt;subj_label
as the later call to aa_check_perms will do the assignment if needed.

Reviewed-by: Georgia Garcia &lt;georgia.garcia@canonical.com&gt;
Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
rename audit_data's label field to subj_label to better reflect its
use. Also at the same time drop unneeded assignments to -&gt;subj_label
as the later call to aa_check_perms will do the assignment if needed.

Reviewed-by: Georgia Garcia &lt;georgia.garcia@canonical.com&gt;
Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>apparmor: combine common_audit_data and apparmor_audit_data</title>
<updated>2023-10-18T22:30:29+00:00</updated>
<author>
<name>John Johansen</name>
<email>john.johansen@canonical.com</email>
</author>
<published>2022-09-14T07:20:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=bd7bd201ca46c211c3ab251ca9854787d1331a2f'/>
<id>bd7bd201ca46c211c3ab251ca9854787d1331a2f</id>
<content type='text'>
Everywhere where common_audit_data is used apparmor audit_data is also
used. We can simplify the code and drop the use of the aad macro
everywhere by combining the two structures.

Reviewed-by: Georgia Garcia &lt;georgia.garcia@canonical.com&gt;
Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Everywhere where common_audit_data is used apparmor audit_data is also
used. We can simplify the code and drop the use of the aad macro
everywhere by combining the two structures.

Reviewed-by: Georgia Garcia &lt;georgia.garcia@canonical.com&gt;
Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>apparmor: Fix kernel-doc warnings in apparmor/lib.c</title>
<updated>2023-07-10T08:13:52+00:00</updated>
<author>
<name>Gaosheng Cui</name>
<email>cuigaosheng1@huawei.com</email>
</author>
<published>2023-06-25T01:13:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=8921482286116af193980f04f2f2755775a410a5'/>
<id>8921482286116af193980f04f2f2755775a410a5</id>
<content type='text'>
Fix kernel-doc warnings:

security/apparmor/lib.c:33: warning: Excess function parameter
'str' description in 'aa_free_str_table'
security/apparmor/lib.c:33: warning: Function parameter or member
't' not described in 'aa_free_str_table'
security/apparmor/lib.c:94: warning: Function parameter or
member 'n' not described in 'skipn_spaces'
security/apparmor/lib.c:390: warning: Excess function parameter
'deny' description in 'aa_check_perms'

Signed-off-by: Gaosheng Cui &lt;cuigaosheng1@huawei.com&gt;
Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix kernel-doc warnings:

security/apparmor/lib.c:33: warning: Excess function parameter
'str' description in 'aa_free_str_table'
security/apparmor/lib.c:33: warning: Function parameter or member
't' not described in 'aa_free_str_table'
security/apparmor/lib.c:94: warning: Function parameter or
member 'n' not described in 'skipn_spaces'
security/apparmor/lib.c:390: warning: Excess function parameter
'deny' description in 'aa_check_perms'

Signed-off-by: Gaosheng Cui &lt;cuigaosheng1@huawei.com&gt;
Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>apparmor: rework profile-&gt;rules to be a list</title>
<updated>2022-10-03T21:49:04+00:00</updated>
<author>
<name>John Johansen</name>
<email>john.johansen@canonical.com</email>
</author>
<published>2022-09-06T03:47:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=1ad22fcc4d0d2fb2e0f35aed555a86d016d5e590'/>
<id>1ad22fcc4d0d2fb2e0f35aed555a86d016d5e590</id>
<content type='text'>
Convert profile-&gt;rules to a list as the next step towards supporting
multiple rulesets in a profile. For this step only support a single
list entry item. The logic for iterating the list will come as a
separate step.

Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Convert profile-&gt;rules to a list as the next step towards supporting
multiple rulesets in a profile. For this step only support a single
list entry item. The logic for iterating the list will come as a
separate step.

Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>apparmor: refactor profile rules and attachments</title>
<updated>2022-10-03T21:49:04+00:00</updated>
<author>
<name>John Johansen</name>
<email>john.johansen@canonical.com</email>
</author>
<published>2022-07-30T00:17:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=217af7e2f4deb629aaa49622685ccfee923898ca'/>
<id>217af7e2f4deb629aaa49622685ccfee923898ca</id>
<content type='text'>
In preparation for moving from a single set of rules and a single
attachment to multiple rulesets and attachments separate from the
profile refactor attachment information and ruleset info into their
own structures.

Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In preparation for moving from a single set of rules and a single
attachment to multiple rulesets and attachments separate from the
profile refactor attachment information and ruleset info into their
own structures.

Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>apparmor: cleanup: move perm accumulation into perms.h</title>
<updated>2022-10-03T21:49:04+00:00</updated>
<author>
<name>John Johansen</name>
<email>john.johansen@canonical.com</email>
</author>
<published>2022-09-06T06:57:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=3dfd16ab697ff23973b6fbb89808372bcd008dd1'/>
<id>3dfd16ab697ff23973b6fbb89808372bcd008dd1</id>
<content type='text'>
Perm accumulation is going to be used much more frequently so let
the compiler figure out if it can be optimized when used.

Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Perm accumulation is going to be used much more frequently so let
the compiler figure out if it can be optimized when used.

Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>apparmor: make sure perm indexes are accumulated</title>
<updated>2022-10-03T21:49:04+00:00</updated>
<author>
<name>John Johansen</name>
<email>john.johansen@canonical.com</email>
</author>
<published>2022-09-06T06:53:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=0bece4fa97a2bd397da66d4fced78f76eb214a3e'/>
<id>0bece4fa97a2bd397da66d4fced78f76eb214a3e</id>
<content type='text'>
accumulate permission indexes on a first encountered basis. This
favors original rulesets so that new ones can not override without
profile replacement.

Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
accumulate permission indexes on a first encountered basis. This
favors original rulesets so that new ones can not override without
profile replacement.

Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>apparmor: add user mode flag</title>
<updated>2022-10-03T21:49:03+00:00</updated>
<author>
<name>John Johansen</name>
<email>john.johansen@canonical.com</email>
</author>
<published>2019-12-17T23:40:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=22fac8a051191113becc0da62bf88b0ba8ce6c08'/>
<id>22fac8a051191113becc0da62bf88b0ba8ce6c08</id>
<content type='text'>
Allow the profile to contain a user mode prompt flag. This works similar
to complain mode but will try to send messages to a userspace daemon.
If the daemon is not present or timesout regular informent will occur.

Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Allow the profile to contain a user mode prompt flag. This works similar
to complain mode but will try to send messages to a userspace daemon.
If the daemon is not present or timesout regular informent will occur.

Signed-off-by: John Johansen &lt;john.johansen@canonical.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
