lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1224258385-12984-1-git-send-email-viktor.rosendahl@nokia.com>
Date:	Fri, 17 Oct 2008 18:46:25 +0300
From:	Viktor Rosendahl <viktor.rosendahl@...ia.com>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH] RFC: Pass process information to userspace coredump

When dumping core to pipe, set CORE_{EXE,PID,SIG,UID,GID} environment
variables. The userspace helper can then use them or look in
/proc/${CORE_PID} for more information.

This code is from the Nokia N810 kernel; I did not write it.

Signed-off-by: Viktor Rosendahl <viktor.rosendahl@...ia.com>
---
 fs/exec.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index a41e790..3a9625d 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1771,6 +1771,14 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
 		goto fail_unlock;
 
  	if (ispipe) {
+		char env_exe[64];
+		char env_pid[16], env_sig[16];
+		char env_uid[16], env_gid[16];
+		char *envp[] = { env_exe,
+				 env_pid, env_sig,
+				 env_uid, env_gid,
+				 NULL };
+
 		helper_argv = argv_split(GFP_KERNEL, corename+1, &helper_argc);
 		/* Terminate the string before the first option */
 		delimit = strchr(corename, ' ');
@@ -1789,8 +1797,16 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
 
 		core_limit = RLIM_INFINITY;
 
+		snprintf(env_exe, sizeof(env_exe), "CORE_EXE=%s",
+			current->comm);
+		snprintf(env_pid, sizeof(env_pid), "CORE_PID=%d",
+			current->tgid);
+		snprintf(env_sig, sizeof(env_sig), "CORE_SIG=%ld", signr);
+		snprintf(env_uid, sizeof(env_uid), "CORE_UID=%u", current->uid);
+		snprintf(env_gid, sizeof(env_gid), "CORE_GID=%u", current->gid);
+
 		/* SIGPIPE can happen, but it's just never processed */
- 		if (call_usermodehelper_pipe(corename+1, helper_argv, NULL,
+		if (call_usermodehelper_pipe(corename+1, helper_argv, envp,
 				&file)) {
  			printk(KERN_INFO "Core dump to %s pipe failed\n",
 			       corename);
-- 
1.5.6.5

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ