This patchset is almost completely updating the various pieces of
architecture code from filling out a struct siginfo and then calling
force_sig_info. To using the helper force_sig_fault instead. Which
takes the values that would have gone in siginfo as arguments.
As the diffstat below shows this noticeable reduces the amount of code.
There are a couple of minor and straight forward bug fixes as well
that I came across while working on the aforementioned changes.
This applies on my last round of siginfo changes simply to remove the
possibility of conflicts. The changes should be semantically separate.
I intend to merge these changes through my siginfo tree. If you have
any objections or would prefer to carry these changes in your
architecture trees please let me know.
The changes are also available at:
git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace.git siginfo-review2
Eric W. Biederman (22):
signal/alpha: Use send_sig_fault where appropriate
signal/alpha: Use force_sig_fault where appropriate
signal/c6x: Use force_sig_fault where appropriate
signal/hexagon: Use force_sig_fault as appropriate
signal/m68k: Use force_sig_fault where appropriate
signal/microblaze: Remove the commented out force_sig_info in do_page_fault
signal/microblaze: Use force_sig_fault where appropriate
signal/mips: Use force_sig_fault where appropriate
signal/nds32: Use force_sig_fault where appropriate
signal/nios2: Use force_sig_fault where appropriate
signal/openrisc: Use force_sig_fault where appropriate
signal/parisc: Use force_sig_mceerr where appropriate
signal/parisc: Use force_sig_fault where appropriate
signal/riscv: Use force_sig_fault where appropriate
signal/s390: Use force_sig_fault where appropriate
signal/sh: Use force_sig_fault where appropriate
signal/sparc: Use send_sig_fault where appropriate
signal/sparc: Use force_sig_fault where appropriate
signal/um: Use force_sig_fault in relay_signal.
signal/um: Use force_sig_fault where appropriate
signal/xtensa: Consistenly use SIGBUS in do_unaligned_user
signal/xtensa: Use force_sig_fault where appropriate
arch/alpha/kernel/osf_sys.c | 10 +--
arch/alpha/kernel/signal.c | 22 +-----
arch/alpha/kernel/traps.c | 80 +++++---------------
arch/alpha/mm/fault.c | 15 +---
arch/c6x/kernel/traps.c | 10 +--
arch/hexagon/kernel/traps.c | 10 +--
arch/hexagon/mm/vm_fault.c | 21 ++----
arch/m68k/kernel/traps.c | 60 +++++++--------
arch/m68k/mm/fault.c | 25 +++----
arch/microblaze/kernel/exceptions.c | 9 +--
arch/microblaze/mm/fault.c | 14 +---
arch/mips/kernel/traps.c | 65 +++++-----------
arch/mips/mm/fault.c | 19 ++---
arch/nds32/kernel/traps.c | 20 +----
arch/nds32/mm/fault.c | 19 ++---
arch/nios2/kernel/traps.c | 9 +--
arch/openrisc/kernel/traps.c | 33 +-------
arch/openrisc/mm/fault.c | 19 ++---
arch/parisc/kernel/ptrace.c | 11 +--
arch/parisc/kernel/traps.c | 63 +++++-----------
arch/parisc/kernel/unaligned.c | 16 +---
arch/parisc/math-emu/driver.c | 9 +--
arch/parisc/mm/fault.c | 55 +++++++-------
arch/riscv/kernel/traps.c | 9 +--
arch/s390/kernel/traps.c | 32 ++------
arch/s390/mm/fault.c | 23 ++----
arch/sh/kernel/traps_32.c | 19 ++---
arch/sh/math-emu/math.c | 9 +--
arch/sh/mm/fault.c | 10 +--
arch/sparc/kernel/process_64.c | 10 +--
arch/sparc/kernel/sys_sparc_32.c | 9 +--
arch/sparc/kernel/sys_sparc_64.c | 8 +-
arch/sparc/kernel/traps_32.c | 114 +++++-----------------------
arch/sparc/kernel/traps_64.c | 145 +++++++-----------------------------
arch/sparc/kernel/unaligned_32.c | 12 +--
arch/sparc/mm/fault_32.c | 13 +---
arch/sparc/mm/fault_64.c | 9 +--
arch/um/kernel/ptrace.c | 13 +---
arch/um/kernel/trap.c | 54 ++++++--------
arch/xtensa/kernel/traps.c | 10 +--
arch/xtensa/mm/fault.c | 19 ++---
41 files changed, 280 insertions(+), 852 deletions(-)
Eric
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 25524288631fc5b7d33259fca1e0dc38146be5d6 Mon Sep 17 00:00:00 2001
From: Chuck Lever <chuck.lever(a)oracle.com>
Date: Mon, 19 Mar 2018 14:23:16 -0400
Subject: [PATCH] xprtrdma: Fix corner cases when handling device removal
Michal Kalderon has found some corner cases around device unload
with active NFS mounts that I didn't have the imagination to test
when xprtrdma device removal was added last year.
- The ULP device removal handler is responsible for deallocating
the PD. That wasn't clear to me initially, and my own testing
suggested it was not necessary, but that is incorrect.
- The transport destruction path can no longer assume that there
is a valid ID.
- When destroying a transport, ensure that ib_free_cq() is not
invoked on a CQ that was already released.
Reported-by: Michal Kalderon <Michal.Kalderon(a)cavium.com>
Fixes: bebd031866ca ("xprtrdma: Support unplugging an HCA from ...")
Signed-off-by: Chuck Lever <chuck.lever(a)oracle.com>
Cc: stable(a)vger.kernel.org # v4.12+
Signed-off-by: Anna Schumaker <Anna.Schumaker(a)Netapp.com>
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index 6a7a5a277e75..fe5eaca2d197 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -250,7 +250,6 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
wait_for_completion(&ia->ri_remove_done);
ia->ri_id = NULL;
- ia->ri_pd = NULL;
ia->ri_device = NULL;
/* Return 1 to ensure the core destroys the id. */
return 1;
@@ -447,7 +446,9 @@ rpcrdma_ia_remove(struct rpcrdma_ia *ia)
ia->ri_id->qp = NULL;
}
ib_free_cq(ep->rep_attr.recv_cq);
+ ep->rep_attr.recv_cq = NULL;
ib_free_cq(ep->rep_attr.send_cq);
+ ep->rep_attr.send_cq = NULL;
/* The ULP is responsible for ensuring all DMA
* mappings and MRs are gone.
@@ -460,6 +461,8 @@ rpcrdma_ia_remove(struct rpcrdma_ia *ia)
rpcrdma_dma_unmap_regbuf(req->rl_recvbuf);
}
rpcrdma_mrs_destroy(buf);
+ ib_dealloc_pd(ia->ri_pd);
+ ia->ri_pd = NULL;
/* Allow waiters to continue */
complete(&ia->ri_remove_done);
@@ -627,14 +630,16 @@ rpcrdma_ep_destroy(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
{
cancel_delayed_work_sync(&ep->rep_connect_worker);
- if (ia->ri_id->qp) {
+ if (ia->ri_id && ia->ri_id->qp) {
rpcrdma_ep_disconnect(ep, ia);
rdma_destroy_qp(ia->ri_id);
ia->ri_id->qp = NULL;
}
- ib_free_cq(ep->rep_attr.recv_cq);
- ib_free_cq(ep->rep_attr.send_cq);
+ if (ep->rep_attr.recv_cq)
+ ib_free_cq(ep->rep_attr.recv_cq);
+ if (ep->rep_attr.send_cq)
+ ib_free_cq(ep->rep_attr.send_cq);
}
/* Re-establish a connection after a device removal event.
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From e40ff213898502d299351cc2fe1e350cd186f0d3 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso(a)mit.edu>
Date: Sun, 1 Apr 2018 23:21:03 -0400
Subject: [PATCH] ext4: force revalidation of directory pointer after
seekdir(2)
A malicious user could force the directory pointer to be in an invalid
spot by using seekdir(2). Use the mechanism we already have to notice
if the directory has changed since the last time we called
ext4_readdir() to force a revalidation of the pointer.
Reported-by: syzbot+1236ce66f79263e8a862(a)syzkaller.appspotmail.com
Signed-off-by: Theodore Ts'o <tytso(a)mit.edu>
Cc: stable(a)vger.kernel.org
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index da87cf757f7d..e2902d394f1b 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -365,13 +365,15 @@ static loff_t ext4_dir_llseek(struct file *file, loff_t offset, int whence)
{
struct inode *inode = file->f_mapping->host;
int dx_dir = is_dx_dir(inode);
- loff_t htree_max = ext4_get_htree_eof(file);
+ loff_t ret, htree_max = ext4_get_htree_eof(file);
if (likely(dx_dir))
- return generic_file_llseek_size(file, offset, whence,
+ ret = generic_file_llseek_size(file, offset, whence,
htree_max, htree_max);
else
- return ext4_llseek(file, offset, whence);
+ ret = ext4_llseek(file, offset, whence);
+ file->f_version = inode_peek_iversion(inode) - 1;
+ return ret;
}
/*
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From 18db4b4e6fc31eda838dd1c1296d67dbcb3dc957 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso(a)mit.edu>
Date: Thu, 29 Mar 2018 22:10:35 -0400
Subject: [PATCH] ext4: don't allow r/w mounts if metadata blocks overlap the
superblock
If some metadata block, such as an allocation bitmap, overlaps the
superblock, it's very likely that if the file system is mounted
read/write, the results will not be pretty. So disallow r/w mounts
for file systems corrupted in this particular way.
Signed-off-by: Theodore Ts'o <tytso(a)mit.edu>
Cc: stable(a)vger.kernel.org
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 7cd022c344d1..edcfe6956eba 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2335,6 +2335,8 @@ static int ext4_check_descriptors(struct super_block *sb,
ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
"Block bitmap for group %u overlaps "
"superblock", i);
+ if (!sb_rdonly(sb))
+ return 0;
}
if (block_bitmap < first_block || block_bitmap > last_block) {
ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
@@ -2347,6 +2349,8 @@ static int ext4_check_descriptors(struct super_block *sb,
ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
"Inode bitmap for group %u overlaps "
"superblock", i);
+ if (!sb_rdonly(sb))
+ return 0;
}
if (inode_bitmap < first_block || inode_bitmap > last_block) {
ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
@@ -2359,6 +2363,8 @@ static int ext4_check_descriptors(struct super_block *sb,
ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
"Inode table for group %u overlaps "
"superblock", i);
+ if (!sb_rdonly(sb))
+ return 0;
}
if (inode_table < first_block ||
inode_table + sbi->s_itb_per_group - 1 > last_block) {
The patch below does not apply to the 4.9-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable(a)vger.kernel.org>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
>From e40ff213898502d299351cc2fe1e350cd186f0d3 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso(a)mit.edu>
Date: Sun, 1 Apr 2018 23:21:03 -0400
Subject: [PATCH] ext4: force revalidation of directory pointer after
seekdir(2)
A malicious user could force the directory pointer to be in an invalid
spot by using seekdir(2). Use the mechanism we already have to notice
if the directory has changed since the last time we called
ext4_readdir() to force a revalidation of the pointer.
Reported-by: syzbot+1236ce66f79263e8a862(a)syzkaller.appspotmail.com
Signed-off-by: Theodore Ts'o <tytso(a)mit.edu>
Cc: stable(a)vger.kernel.org
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index da87cf757f7d..e2902d394f1b 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -365,13 +365,15 @@ static loff_t ext4_dir_llseek(struct file *file, loff_t offset, int whence)
{
struct inode *inode = file->f_mapping->host;
int dx_dir = is_dx_dir(inode);
- loff_t htree_max = ext4_get_htree_eof(file);
+ loff_t ret, htree_max = ext4_get_htree_eof(file);
if (likely(dx_dir))
- return generic_file_llseek_size(file, offset, whence,
+ ret = generic_file_llseek_size(file, offset, whence,
htree_max, htree_max);
else
- return ext4_llseek(file, offset, whence);
+ ret = ext4_llseek(file, offset, whence);
+ file->f_version = inode_peek_iversion(inode) - 1;
+ return ret;
}
/*