From: Geliang Tang <geliangtang@gmail.com> To: James Morris <james.l.morris@oracle.com>, "Serge E. Hallyn" <serge@hallyn.com> Cc: Geliang Tang <geliangtang@gmail.com>, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] lsm_audit: use get_task_comm Date: Mon, 28 Aug 2017 21:58:58 +0800 [thread overview] Message-ID: <304ab87b276f87462fbeaccacb9dc1e02300df75.1502451616.git.geliangtang@gmail.com> (raw) get_task_comm() copys the task's comm under the task_lock, it's safer than directly using memcpy(). Signed-off-by: Geliang Tang <geliangtang@gmail.com> --- security/lsm_audit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/lsm_audit.c b/security/lsm_audit.c index 28d4c3a..555b1c4 100644 --- a/security/lsm_audit.c +++ b/security/lsm_audit.c @@ -221,7 +221,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, BUILD_BUG_ON(sizeof(a->u) > sizeof(void *)*2); audit_log_format(ab, " pid=%d comm=", task_tgid_nr(current)); - audit_log_untrustedstring(ab, memcpy(comm, current->comm, sizeof(comm))); + audit_log_untrustedstring(ab, get_task_comm(comm, current)); switch (a->type) { case LSM_AUDIT_DATA_NONE: @@ -312,7 +312,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, char comm[sizeof(tsk->comm)]; audit_log_format(ab, " opid=%d ocomm=", pid); audit_log_untrustedstring(ab, - memcpy(comm, tsk->comm, sizeof(comm))); + get_task_comm(comm, tsk)); } } break; -- 2.9.3
WARNING: multiple messages have this Message-ID (diff)
From: geliangtang@gmail.com (Geliang Tang) To: linux-security-module@vger.kernel.org Subject: [PATCH] lsm_audit: use get_task_comm Date: Mon, 28 Aug 2017 21:58:58 +0800 [thread overview] Message-ID: <304ab87b276f87462fbeaccacb9dc1e02300df75.1502451616.git.geliangtang@gmail.com> (raw) get_task_comm() copys the task's comm under the task_lock, it's safer than directly using memcpy(). Signed-off-by: Geliang Tang <geliangtang@gmail.com> --- security/lsm_audit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/lsm_audit.c b/security/lsm_audit.c index 28d4c3a..555b1c4 100644 --- a/security/lsm_audit.c +++ b/security/lsm_audit.c @@ -221,7 +221,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, BUILD_BUG_ON(sizeof(a->u) > sizeof(void *)*2); audit_log_format(ab, " pid=%d comm=", task_tgid_nr(current)); - audit_log_untrustedstring(ab, memcpy(comm, current->comm, sizeof(comm))); + audit_log_untrustedstring(ab, get_task_comm(comm, current)); switch (a->type) { case LSM_AUDIT_DATA_NONE: @@ -312,7 +312,7 @@ static void dump_common_audit_data(struct audit_buffer *ab, char comm[sizeof(tsk->comm)]; audit_log_format(ab, " opid=%d ocomm=", pid); audit_log_untrustedstring(ab, - memcpy(comm, tsk->comm, sizeof(comm))); + get_task_comm(comm, tsk)); } } break; -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2017-08-28 13:59 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-08-28 13:58 Geliang Tang [this message] 2017-08-28 13:58 ` [PATCH] lsm_audit: use get_task_comm Geliang Tang 2017-08-28 21:54 ` Paul Moore 2017-08-28 21:54 ` Paul Moore 2017-08-29 5:06 ` Richard Guy Briggs 2017-08-29 5:06 ` Richard Guy Briggs 2017-08-29 5:06 ` Richard Guy Briggs 2017-08-29 11:34 ` Paul Moore 2017-08-29 11:34 ` Paul Moore
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=304ab87b276f87462fbeaccacb9dc1e02300df75.1502451616.git.geliangtang@gmail.com \ --to=geliangtang@gmail.com \ --cc=james.l.morris@oracle.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-security-module@vger.kernel.org \ --cc=serge@hallyn.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.