@@ -1229,10 +1229,11 @@ static int p_cmp_tasks(struct p_ed_process *p_orig, char p_kill) {
1229
1229
* each other, which lets us perform additional checks.
1230
1230
*
1231
1231
* commit_creds() changes both pointers, override_creds() only the cred
1232
- * pointer, but nothing valid changes only the real_cred pointer, so that's
1233
- * what we can detect as a violation on all kernels. This violation implies
1234
- * that the two current pointers differ from each other, but not the other
1235
- * way around.
1232
+ * pointer, but nothing valid changes only the real_cred pointer.
1233
+ * Unfortunately, we cannot reliably detect this as a violation on pre-6.13
1234
+ * kernels because there may have been both an untracked commit_creds()
1235
+ * changing both pointers and an override_creds() changing the cred pointer
1236
+ * potentially in such a way that the old pointer value we saved is reused.
1236
1237
*
1237
1238
* On kernels below 6.13, we directly detect pointers differing from each
1238
1239
* other as a violation, which covers the above case and also unexpected
@@ -1242,18 +1243,13 @@ static int p_cmp_tasks(struct p_ed_process *p_orig, char p_kill) {
1242
1243
* from each other, a check of the actual subjective credentials wouldn't be
1243
1244
* redundant with what we performed above, so we perform it as well.
1244
1245
*/
1245
- if (current == p_current && unlikely (
1246
1246
#if LINUX_VERSION_CODE < KERNEL_VERSION (6 ,13 ,0 )
1247
- p_current_real_cred != p_current_cred
1248
- #else
1249
- p_orig -> p_ed_task .p_real_cred_ptr != p_current_real_cred &&
1250
- p_orig -> p_ed_task .p_real_cred_ptr == p_current_cred
1251
- #endif
1252
- )) {
1247
+ if (current == p_current && unlikely (p_current_real_cred != p_current_cred )) {
1253
1248
P_CMP_PTR (p_orig -> p_ed_task .p_real_cred_ptr , p_current_real_cred , "real_cred" )
1254
1249
p_ret += p_cmp_creds (& p_orig -> p_ed_task .p_real_cred , p_current_cred , p_current );
1255
1250
P_CMP_PTR (p_orig -> p_ed_task .p_real_cred_ptr , p_current_cred , "cred" )
1256
1251
}
1252
+ #endif
1257
1253
1258
1254
/* Namespaces */
1259
1255
if (p_orig -> p_ed_task .p_nsproxy && (p_current == current || spin_trylock (& p_current -> alloc_lock ))) {
0 commit comments