소스 검색

apparmor: fail task profile update if current_cred isn't real_cred

Trying to update the task cred while the task current cred is not the
real cred will result in an error at the cred layer. Avoid this by
failing early and delaying the update.

Signed-off-by: John Johansen <john.johansen@canonical.com>
John Johansen 9 년 전
부모
커밋
a20aa95fbe
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      security/apparmor/context.c

+ 3 - 0
security/apparmor/context.c

@@ -100,6 +100,9 @@ int aa_replace_current_profile(struct aa_profile *profile)
 	if (cxt->profile == profile)
 		return 0;
 
+	if (current_cred() != current_real_cred())
+		return -EBUSY;
+
 	new  = prepare_creds();
 	if (!new)
 		return -ENOMEM;