Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
435222bc
Commit
435222bc
authored
Jun 09, 2017
by
John Johansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apparmor: refactor updating profiles to the newest parent
Signed-off-by:
John Johansen
<
john.johansen@canonical.com
>
parent
a1bd627b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
4 deletions
+31
-4
security/apparmor/policy.c
security/apparmor/policy.c
+31
-4
No files found.
security/apparmor/policy.c
View file @
435222bc
...
...
@@ -837,6 +837,27 @@ static void share_name(struct aa_profile *old, struct aa_profile *new)
new
->
base
.
name
=
old
->
base
.
name
;
}
/* Update to newest version of parent after previous replacements
* Returns: unrefcount newest version of parent
*/
static
struct
aa_profile
*
update_to_newest_parent
(
struct
aa_profile
*
new
)
{
struct
aa_profile
*
parent
,
*
newest
;
parent
=
rcu_dereference_protected
(
new
->
parent
,
mutex_is_locked
(
&
new
->
ns
->
lock
));
newest
=
aa_get_newest_profile
(
parent
);
/* parent replaced in this atomic set? */
if
(
newest
!=
parent
)
{
aa_put_profile
(
parent
);
rcu_assign_pointer
(
new
->
parent
,
newest
);
}
else
aa_put_profile
(
newest
);
return
newest
;
}
/**
* aa_replace_profiles - replace profile(s) on the profile list
* @policy_ns: namespace load is occurring on
...
...
@@ -1052,10 +1073,16 @@ ssize_t aa_replace_profiles(struct aa_ns *policy_ns, struct aa_profile *profile,
__list_add_profile
(
&
newest
->
base
.
profiles
,
ent
->
new
);
aa_put_profile
(
newest
);
}
else
{
/* aafs interface uses proxy */
rcu_assign_pointer
(
ent
->
new
->
proxy
->
profile
,
aa_get_profile
(
ent
->
new
));
__list_add_profile
(
&
ns
->
base
.
profiles
,
ent
->
new
);
struct
list_head
*
lh
;
if
(
rcu_access_pointer
(
ent
->
new
->
parent
))
{
struct
aa_profile
*
parent
;
parent
=
update_to_newest_parent
(
ent
->
new
);
lh
=
&
parent
->
base
.
profiles
;
}
else
lh
=
&
ns
->
base
.
profiles
;
__list_add_profile
(
lh
,
ent
->
new
);
}
skip:
aa_load_ent_free
(
ent
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment