[PATCH] Allow core_pattern to name block devices.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow core dumps to block devices by allowing the user to name a block
device in core_pattern.

This is extremely useful when running the kernel in a "captive"
appliance.  There is not necessarily a writable, mounted filesystem
that can be used to catch a core dump, so instead we set aside a
virtual disk for core dumps and allow the kernel to write a core to
that.

This patch was tested by running the modified kernel under qemu (using
libguestfs) and forcing various core dumps to attached virtual disks.

Signed-off-by: Richard W.M. Jones <rjones@xxxxxxxxxx>
---
 fs/exec.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 52a447d..7aa4b19 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -2047,10 +2047,11 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 		if (d_unhashed(cprm.file->f_path.dentry))
 			goto close_fail;
 		/*
-		 * AK: actually i see no reason to not allow this for named
-		 * pipes etc, but keep the previous behaviour for now.
+		 * Previously coredumps were only allowed to regular files.
+		 * Block devices are useful too for capturing errors in
+		 * captive appliances.
 		 */
-		if (!S_ISREG(inode->i_mode))
+		if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))
 			goto close_fail;
 		/*
 		 * Dont allow local users get cute and trick others to coredump
-- 
1.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux