Commit 5acb878
apparmor: grab ns lock and refresh when looking up changehat child profiles
[ Upstream commit 32e9276 ]
There was a race condition involving change_hat and profile replacement in
which replacement of the parent profile during a changehat operation could
result in the list of children becoming empty and the changehat operation
failing. To prevent this:
- grab the namespace lock until we've built the hat transition, and
- use aa_get_newest_profile to avoid using stale profile objects.
Link: https://bugs.launchpad.net/bugs/2139664
Fixes: 89dbf19 ("apparmor: move change_hat mediation to using labels")
Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com>
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 6a26de6 commit 5acb878
1 file changed
Lines changed: 31 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
1061 | 1062 | | |
1062 | 1063 | | |
1063 | 1064 | | |
| 1065 | + | |
1064 | 1066 | | |
1065 | 1067 | | |
1066 | 1068 | | |
| |||
1071 | 1073 | | |
1072 | 1074 | | |
1073 | 1075 | | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1074 | 1102 | | |
1075 | 1103 | | |
1076 | 1104 | | |
| |||
1079 | 1107 | | |
1080 | 1108 | | |
1081 | 1109 | | |
1082 | | - | |
| 1110 | + | |
1083 | 1111 | | |
1084 | 1112 | | |
1085 | 1113 | | |
| |||
1139 | 1167 | | |
1140 | 1168 | | |
1141 | 1169 | | |
| 1170 | + | |
1142 | 1171 | | |
1143 | 1172 | | |
1144 | 1173 | | |
| |||
1151 | 1180 | | |
1152 | 1181 | | |
1153 | 1182 | | |
1154 | | - | |
| 1183 | + | |
1155 | 1184 | | |
1156 | 1185 | | |
1157 | 1186 | | |
| |||
0 commit comments