From: Seung-Woo Kim Date: Tue, 15 Dec 2020 06:49:50 +0000 (+0900) Subject: Support linux kernel earlier than 4.17 for security_cred_getsecid() X-Git-Tag: submit/tizen/20211126.100737~8^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b514416c974d200313014a4068f7cf8844ad38a8;p=platform%2Fkernel%2Flinux-tizen-modules-source.git Support linux kernel earlier than 4.17 for security_cred_getsecid() Earlier than Linux v4.17, there was no security_cred_getsecid() and it is used to get secid for task. For the earlier kernel, use security_task_getsecid() instead. Change-Id: I7a6284adf4f316efb124a5659a1458adc0b85d1f Ref: v4.17 commit 3ec30113264a ("security: Add a cred_getsecid hook") Signed-off-by: Seung-Woo Kim --- diff --git a/kernel/proc-tsm.c b/kernel/proc-tsm.c index 248aaa1..3f25335 100644 --- a/kernel/proc-tsm.c +++ b/kernel/proc-tsm.c @@ -142,7 +142,11 @@ static int stability_monitor_show(struct seq_file *m, void *v) continue; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) security_cred_getsecid(((struct cred *)task->real_cred), &secid); +#else + security_task_getsecid(task, &secid); +#endif if (!security_secid_to_secctx(secid, &label, &label_len)) { blacklisted = 0; for (i = 0; i < blacklist_c; i++) {