[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1312182213340.1247@chino.kir.corp.google.com>
Date: Wed, 18 Dec 2013 22:14:20 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Vegard Nossum <vegard.nossum@...cle.com>
cc: linux-kernel@...r.kernel.org, Tommi Rantala <tt.rantala@...il.com>,
Ingo Molnar <mingo@...nel.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Andy Lutomirski <luto@...capital.net>,
Kees Cook <keescook@...omium.org>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Alan Cox <alan@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jason Wang <jasowang@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Dan Carpenter <dan.carpenter@...cle.com>,
James Morris <james.l.morris@...cle.com>
Subject: Re: [PATCH 1/9] Known exploit detection
On Thu, 12 Dec 2013, vegard.nossum@...cle.com wrote:
> diff --git a/security/exploit.c b/security/exploit.c
> new file mode 100644
> index 0000000..a732613
> --- /dev/null
> +++ b/security/exploit.c
> @@ -0,0 +1,28 @@
> +#include <linux/cred.h>
> +#include <linux/exploit.h>
> +#include <linux/printk.h>
> +#include <linux/ratelimit.h>
> +#include <linux/sched.h>
> +
> +void _exploit(const char *id)
> +{
> + /*
> + * This function needs to be super defensive/conservative, since
> + * userspace can easily get to it from several different contexts.
> + * We don't want it to become an attack vector in itself!
> + *
> + * We can assume that we're in process context, but spinlocks may
> + * be held, etc.
Not task_lock(current), though.
> + */
> +
> + struct task_struct *task = current;
> + pid_t pid = task_pid_nr(task);
> + uid_t uid = from_kuid(&init_user_ns, current_uid());
> + char comm[sizeof(task->comm)];
> +
> + get_task_comm(comm, task);
> +
> + pr_warn_ratelimited("warning: possible %s exploit attempt by pid=%u uid=%u comm=%s\n",
> + id, pid, uid, comm);
> +}
> +EXPORT_SYMBOL(_exploit);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists