Commit 32e9276
apparmor: grab ns lock and refresh when looking up changehat child profiles
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>1 parent ad213bb commit 32e9276
1 file changed
Lines changed: 31 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
1109 | 1110 | | |
1110 | 1111 | | |
1111 | 1112 | | |
| 1113 | + | |
1112 | 1114 | | |
1113 | 1115 | | |
1114 | 1116 | | |
| |||
1119 | 1121 | | |
1120 | 1122 | | |
1121 | 1123 | | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
1122 | 1150 | | |
1123 | 1151 | | |
1124 | 1152 | | |
| |||
1127 | 1155 | | |
1128 | 1156 | | |
1129 | 1157 | | |
1130 | | - | |
| 1158 | + | |
1131 | 1159 | | |
1132 | 1160 | | |
1133 | 1161 | | |
| |||
1187 | 1215 | | |
1188 | 1216 | | |
1189 | 1217 | | |
| 1218 | + | |
1190 | 1219 | | |
1191 | 1220 | | |
1192 | 1221 | | |
| |||
1199 | 1228 | | |
1200 | 1229 | | |
1201 | 1230 | | |
1202 | | - | |
| 1231 | + | |
1203 | 1232 | | |
1204 | 1233 | | |
1205 | 1234 | | |
| |||
0 commit comments