From: "Serge E. Hallyn" <serge-A9i7LUbDfNHQT0dZR+AlfA@public.gmane.org>
To: Richard Guy Briggs <rgb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
linux-audit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org,
sgrubb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH 2/2] audit: log namespace serial numbers
Date: Fri, 2 May 2014 01:01:59 +0200 [thread overview]
Message-ID: <20140501230159.GC25669@mail.hallyn.com> (raw)
In-Reply-To: <644ef842bae19c55ae11af07e9fd7ac0ec9c74a1.1398176489.git.rgb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Quoting Richard Guy Briggs (rgb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org):
> Log the namespace details of a task.
>
> Signed-off-by: Richard Guy Briggs <rgb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Acked-by: Serge Hallyn <serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Looks good, and does look useful. We'll certainly want to also dump
netns and userns for some target objects eventually.
> ---
> include/linux/audit.h | 7 +++++++
> kernel/audit.c | 38 ++++++++++++++++++++++++++++++++++++++
> 2 files changed, 45 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/audit.h b/include/linux/audit.h
> index 22cfddb..0ef404a 100644
> --- a/include/linux/audit.h
> +++ b/include/linux/audit.h
> @@ -101,6 +101,13 @@ extern int __weak audit_classify_compat_syscall(int abi, unsigned syscall);
> struct filename;
>
> extern void audit_log_session_info(struct audit_buffer *ab);
> +#ifdef CONFIG_NAMESPACES
> +extern void audit_log_namespace_info(struct audit_buffer *ab, struct task_struct *tsk);
> +#else
> +void audit_log_namespace_info(struct audit_buffer *ab, struct task_struct *tsk)
> +{
> +}
> +#endif
>
> #ifdef CONFIG_AUDIT_COMPAT_GENERIC
> #define audit_is_compat(arch) (!((arch) & __AUDIT_ARCH_64BIT))
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 59c0bbe..9049049 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -64,7 +64,15 @@
> #endif
> #include <linux/freezer.h>
> #include <linux/tty.h>
> +#include <linux/nsproxy.h>
> +#include <linux/utsname.h>
> +#include <linux/ipc_namespace.h>
> +#include "../fs/mount.h"
> +#include <linux/mount.h>
> +#include <linux/mnt_namespace.h>
> #include <linux/pid_namespace.h>
> +#include <net/net_namespace.h>
> +#include <linux/user_namespace.h>
> #include <net/netns/generic.h>
>
> #include "audit.h"
> @@ -1617,6 +1625,35 @@ void audit_log_session_info(struct audit_buffer *ab)
> audit_log_format(ab, " auid=%u ses=%u", auid, sessionid);
> }
>
> +#ifdef CONFIG_NAMESPACES
> +void audit_log_namespace_info(struct audit_buffer *ab, struct task_struct *tsk)
> +{
> + struct nsproxy *nsproxy;
> +
> + rcu_read_lock();
> + nsproxy = task_nsproxy(tsk);
> + if (nsproxy != NULL) {
> + audit_log_format(ab, " mntns=%x", nsproxy->mnt_ns->serial_num);
> +#ifdef CONFIG_NET_NS
> + audit_log_format(ab, " netns=%x", nsproxy->net_ns->serial_num);
> +#endif
> +#ifdef CONFIG_UTS_NS
> + audit_log_format(ab, " utsns=%x", nsproxy->uts_ns->serial_num);
> +#endif
> +#ifdef CONFIG_IPC_NS
> + audit_log_format(ab, " ipcns=%x", nsproxy->ipc_ns->serial_num);
> +#endif
> + }
> +#ifdef CONFIG_PID_NS
> + audit_log_format(ab, " pidns=%x", task_active_pid_ns(tsk)->serial_num);
> +#endif
> +#ifdef CONFIG_USER_NS
> + audit_log_format(ab, " userns=%x", task_cred_xxx(tsk, user_ns)->serial_num);
> +#endif
> + rcu_read_unlock();
> +}
> +#endif /* CONFIG_NAMESPACES */
> +
> void audit_log_key(struct audit_buffer *ab, char *key)
> {
> audit_log_format(ab, " key=");
> @@ -1861,6 +1898,7 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
> up_read(&mm->mmap_sem);
> } else
> audit_log_format(ab, " exe=(null)");
> + audit_log_namespace_info(ab, tsk);
> audit_log_task_context(ab);
> }
> EXPORT_SYMBOL(audit_log_task_info);
> --
> 1.7.1
>
> _______________________________________________
> Containers mailing list
> Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linuxfoundation.org/mailman/listinfo/containers
WARNING: multiple messages have this Message-ID (diff)
From: "Serge E. Hallyn" <serge@hallyn.com>
To: Richard Guy Briggs <rgb@redhat.com>
Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org,
containers@lists.linux-foundation.org, serge.hallyn@ubuntu.com,
eparis@redhat.com, sgrubb@redhat.com, ebiederm@xmission.com
Subject: Re: [PATCH 2/2] audit: log namespace serial numbers
Date: Fri, 2 May 2014 01:01:59 +0200 [thread overview]
Message-ID: <20140501230159.GC25669@mail.hallyn.com> (raw)
In-Reply-To: <644ef842bae19c55ae11af07e9fd7ac0ec9c74a1.1398176489.git.rgb@redhat.com>
Quoting Richard Guy Briggs (rgb@redhat.com):
> Log the namespace details of a task.
>
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Looks good, and does look useful. We'll certainly want to also dump
netns and userns for some target objects eventually.
> ---
> include/linux/audit.h | 7 +++++++
> kernel/audit.c | 38 ++++++++++++++++++++++++++++++++++++++
> 2 files changed, 45 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/audit.h b/include/linux/audit.h
> index 22cfddb..0ef404a 100644
> --- a/include/linux/audit.h
> +++ b/include/linux/audit.h
> @@ -101,6 +101,13 @@ extern int __weak audit_classify_compat_syscall(int abi, unsigned syscall);
> struct filename;
>
> extern void audit_log_session_info(struct audit_buffer *ab);
> +#ifdef CONFIG_NAMESPACES
> +extern void audit_log_namespace_info(struct audit_buffer *ab, struct task_struct *tsk);
> +#else
> +void audit_log_namespace_info(struct audit_buffer *ab, struct task_struct *tsk)
> +{
> +}
> +#endif
>
> #ifdef CONFIG_AUDIT_COMPAT_GENERIC
> #define audit_is_compat(arch) (!((arch) & __AUDIT_ARCH_64BIT))
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 59c0bbe..9049049 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -64,7 +64,15 @@
> #endif
> #include <linux/freezer.h>
> #include <linux/tty.h>
> +#include <linux/nsproxy.h>
> +#include <linux/utsname.h>
> +#include <linux/ipc_namespace.h>
> +#include "../fs/mount.h"
> +#include <linux/mount.h>
> +#include <linux/mnt_namespace.h>
> #include <linux/pid_namespace.h>
> +#include <net/net_namespace.h>
> +#include <linux/user_namespace.h>
> #include <net/netns/generic.h>
>
> #include "audit.h"
> @@ -1617,6 +1625,35 @@ void audit_log_session_info(struct audit_buffer *ab)
> audit_log_format(ab, " auid=%u ses=%u", auid, sessionid);
> }
>
> +#ifdef CONFIG_NAMESPACES
> +void audit_log_namespace_info(struct audit_buffer *ab, struct task_struct *tsk)
> +{
> + struct nsproxy *nsproxy;
> +
> + rcu_read_lock();
> + nsproxy = task_nsproxy(tsk);
> + if (nsproxy != NULL) {
> + audit_log_format(ab, " mntns=%x", nsproxy->mnt_ns->serial_num);
> +#ifdef CONFIG_NET_NS
> + audit_log_format(ab, " netns=%x", nsproxy->net_ns->serial_num);
> +#endif
> +#ifdef CONFIG_UTS_NS
> + audit_log_format(ab, " utsns=%x", nsproxy->uts_ns->serial_num);
> +#endif
> +#ifdef CONFIG_IPC_NS
> + audit_log_format(ab, " ipcns=%x", nsproxy->ipc_ns->serial_num);
> +#endif
> + }
> +#ifdef CONFIG_PID_NS
> + audit_log_format(ab, " pidns=%x", task_active_pid_ns(tsk)->serial_num);
> +#endif
> +#ifdef CONFIG_USER_NS
> + audit_log_format(ab, " userns=%x", task_cred_xxx(tsk, user_ns)->serial_num);
> +#endif
> + rcu_read_unlock();
> +}
> +#endif /* CONFIG_NAMESPACES */
> +
> void audit_log_key(struct audit_buffer *ab, char *key)
> {
> audit_log_format(ab, " key=");
> @@ -1861,6 +1898,7 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
> up_read(&mm->mmap_sem);
> } else
> audit_log_format(ab, " exe=(null)");
> + audit_log_namespace_info(ab, tsk);
> audit_log_task_context(ab);
> }
> EXPORT_SYMBOL(audit_log_task_info);
> --
> 1.7.1
>
> _______________________________________________
> Containers mailing list
> Containers@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/containers
next prev parent reply other threads:[~2014-05-01 23:01 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-22 18:12 [PATCH 0/2] namespaces: log namespaces per task Richard Guy Briggs
2014-04-22 18:12 ` Richard Guy Briggs
[not found] ` <cover.1398176489.git.rgb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-04-22 18:12 ` [PATCH 1/2] namespaces: give each namespace a serial number Richard Guy Briggs
2014-04-22 18:12 ` Richard Guy Briggs
[not found] ` <be1358c6da51252cd79c51a51bb30bf157624ccd.1398176489.git.rgb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-05-01 22:51 ` Serge E. Hallyn
2014-05-01 22:51 ` Serge E. Hallyn
[not found] ` <20140501225116.GB25669-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2014-05-02 14:15 ` Richard Guy Briggs
2014-05-02 14:15 ` Richard Guy Briggs
[not found] ` <20140502141530.GB24111-bcJWsdo4jJjeVoXN4CMphl7TgLCtbB0G@public.gmane.org>
2014-05-02 20:50 ` Serge Hallyn
2014-05-02 20:50 ` Serge Hallyn
2014-04-22 18:12 ` [PATCH 2/2] audit: log namespace serial numbers Richard Guy Briggs
2014-04-22 18:12 ` Richard Guy Briggs
[not found] ` <644ef842bae19c55ae11af07e9fd7ac0ec9c74a1.1398176489.git.rgb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-05-01 23:01 ` Serge E. Hallyn [this message]
2014-05-01 23:01 ` Serge E. Hallyn
2014-05-01 22:32 ` [PATCH 0/2] namespaces: log namespaces per task Serge E. Hallyn
2014-05-01 22:32 ` Serge E. Hallyn
[not found] ` <20140501223212.GA25669-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2014-05-02 14:28 ` Richard Guy Briggs
2014-05-02 14:28 ` Richard Guy Briggs
[not found] ` <20140502142851.GC24111-bcJWsdo4jJjeVoXN4CMphl7TgLCtbB0G@public.gmane.org>
2014-05-02 21:00 ` Serge Hallyn
2014-05-02 21:00 ` Serge Hallyn
2014-05-05 21:29 ` Richard Guy Briggs
2014-05-05 9:23 ` Nicolas Dichtel
[not found] ` <5367587B.20801-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-05-06 21:15 ` Richard Guy Briggs
2014-05-06 21:15 ` Richard Guy Briggs
[not found] ` <20140506211530.GB15100-bcJWsdo4jJjeVoXN4CMphl7TgLCtbB0G@public.gmane.org>
2014-05-07 9:35 ` Nicolas Dichtel
2014-05-07 9:35 ` Nicolas Dichtel
2014-05-03 21:58 ` James Bottomley
2014-05-03 21:58 ` James Bottomley
2014-05-05 3:48 ` Serge E. Hallyn
2014-05-05 21:48 ` Richard Guy Briggs
2014-05-05 21:51 ` James Bottomley
2014-05-05 22:11 ` Richard Guy Briggs
2014-05-05 22:24 ` James Bottomley
2014-05-05 22:27 ` Serge Hallyn
2014-05-05 22:30 ` James Bottomley
2014-05-05 22:36 ` Serge Hallyn
2014-05-05 23:23 ` James Bottomley
2014-05-05 23:23 ` James Bottomley
2014-05-06 3:27 ` Serge Hallyn
2014-05-06 3:27 ` Serge Hallyn
2014-05-06 4:59 ` James Bottomley
[not found] ` <1399352350.2164.91.camel-sFMDBYUN5F8GjUHQrlYNx2Wm91YjaHnnhRte9Li2A+AAvxtiuMwx3w@public.gmane.org>
2014-05-06 14:50 ` Serge Hallyn
2014-05-06 14:50 ` Serge Hallyn
2014-05-06 21:59 ` Richard Guy Briggs
2014-05-06 21:59 ` Richard Guy Briggs
2014-05-06 12:35 ` Nicolas Dichtel
2014-05-06 12:35 ` Nicolas Dichtel
[not found] ` <a09ed85b-d6ef-4472-853b-84057d5957c2-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org>
2014-05-06 12:35 ` Nicolas Dichtel
2014-05-06 21:41 ` Richard Guy Briggs
2014-05-06 21:41 ` Richard Guy Briggs
2014-05-06 21:41 ` Richard Guy Briggs
[not found] ` <20140506214129.GC15100-bcJWsdo4jJjeVoXN4CMphl7TgLCtbB0G@public.gmane.org>
2014-05-06 23:57 ` James Bottomley
2014-05-06 23:57 ` James Bottomley
2014-05-05 21:44 ` Richard Guy Briggs
2014-05-06 3:33 ` Serge Hallyn
2014-05-06 14:03 ` Richard Guy Briggs
2014-05-06 14:03 ` Richard Guy Briggs
2014-05-06 14:03 ` Richard Guy Briggs
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=20140501230159.GC25669@mail.hallyn.com \
--to=serge-a9i7lubdfnhqt0dzr+alfa@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-audit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rgb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org \
--cc=sgrubb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
/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: link
Be 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.