[PATCH] Only send SIGXFSZ when exceeding rlimits.

From: Micah Cowan
Date: Wed May 23 2007 - 09:20:16 EST


Some users have been having problems with utilities like cp or dd
dumping core when they try to copy a file that's too large for the
destination filesystem (typically, > 4gb). Apparently, some defunct
standards required SIGXFSZ to be sent in such circumstances, but SUS
only requires/allows it for when a written file exceeds the process's
resource limits. I'd like to limit SIGXFSZs to the bare minimum required
by SUS.

Patch sent per http://lkml.org/lkml/2007/4/10/302

Signed-off-by: Micah Cowan <micahcowan@xxxxxxxxxx>
---
fs/ncpfs/file.c | 2 --
fs/reiserfs/file.c | 1 -
mm/filemap.c | 2 --
3 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c
index addfd31..65b5802 100644
--- a/fs/ncpfs/file.c
+++ b/fs/ncpfs/file.c
@@ -202,7 +202,6 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *

if (pos + count > MAX_NON_LFS && !(file->f_flags&O_LARGEFILE)) {
if (pos >= MAX_NON_LFS) {
- send_sig(SIGXFSZ, current, 0);
return -EFBIG;
}
if (count > MAX_NON_LFS - (u32)pos) {
@@ -211,7 +210,6 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *
}
if (pos >= inode->i_sb->s_maxbytes) {
if (count || pos > inode->i_sb->s_maxbytes) {
- send_sig(SIGXFSZ, current, 0);
return -EFBIG;
}
}
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 9e451a6..465cde1 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -1305,7 +1305,6 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t
if (get_inode_item_key_version (inode) == KEY_FORMAT_3_5 &&
*ppos + count > MAX_NON_LFS) {
if (*ppos >= MAX_NON_LFS) {
- send_sig(SIGXFSZ, current, 0);
return -EFBIG;
}
if (count > MAX_NON_LFS - (unsigned long)*ppos)
diff --git a/mm/filemap.c b/mm/filemap.c
index edb1b0b..01b577a 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1985,7 +1985,6 @@ inline int generic_write_checks(struct file *file, loff_t *pos, size_t *count, i
if (unlikely(*pos + *count > MAX_NON_LFS &&
!(file->f_flags & O_LARGEFILE))) {
if (*pos >= MAX_NON_LFS) {
- send_sig(SIGXFSZ, current, 0);
return -EFBIG;
}
if (*count > MAX_NON_LFS - (unsigned long)*pos) {
@@ -2003,7 +2002,6 @@ inline int generic_write_checks(struct file *file, loff_t *pos, size_t *count, i
if (likely(!isblk)) {
if (unlikely(*pos >= inode->i_sb->s_maxbytes)) {
if (*count || *pos > inode->i_sb->s_maxbytes) {
- send_sig(SIGXFSZ, current, 0);
return -EFBIG;
}
/* zero-length writes at ->s_maxbytes are OK */
--
1.4.4.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/