Allow core dumps to block devices as well as regular files.
Subsystems (2)
PATCH v2 1/1 Allow core dumps to block devices as well as regular files.
Allow core dumps to block devices by allowing the user to name a block device in core_pattern. This change also removes the historical comment which would no longer be accurate.
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 <[email protected]>
--- fs/exec.c | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-)
fs/exec.c +1 -5
@@ -2052,11 +2052,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs) goto close_fail;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. -*/ -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
Signature · 1 line
1.7.4