summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2017-08-02 14:51:22 -0400
committerEric W. Biederman <ebiederm@xmission.com>2018-01-23 13:17:48 -0500
commitc0f45555b82450a56c0da11866163b764aeb1a21 (patch)
treef83742a8c53945acfc83a96ce4861712b38967b6
parent83b57531c58f4173d1c0d0b2c0bc88c853c32ea5 (diff)
signal/memory-failure: Use force_sig_mceerr and send_sig_mceerr
Delegate filling out struct siginfo to functions in kernel/signal.c to simplify the code. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
-rw-r--r--mm/memory-failure.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index c5f5f31bd979..4b80ccee4535 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -181,19 +181,16 @@ EXPORT_SYMBOL_GPL(hwpoison_filter);
181static int kill_proc(struct task_struct *t, unsigned long addr, 181static int kill_proc(struct task_struct *t, unsigned long addr,
182 unsigned long pfn, struct page *page, int flags) 182 unsigned long pfn, struct page *page, int flags)
183{ 183{
184 struct siginfo si; 184 short addr_lsb;
185 int ret; 185 int ret;
186 186
187 pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n", 187 pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n",
188 pfn, t->comm, t->pid); 188 pfn, t->comm, t->pid);
189 si.si_signo = SIGBUS; 189 addr_lsb = compound_order(compound_head(page)) + PAGE_SHIFT;
190 si.si_errno = 0;
191 si.si_addr = (void *)addr;
192 si.si_addr_lsb = compound_order(compound_head(page)) + PAGE_SHIFT;
193 190
194 if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) { 191 if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) {
195 si.si_code = BUS_MCEERR_AR; 192 ret = force_sig_mceerr(BUS_MCEERR_AR, (void __user *)addr,
196 ret = force_sig_info(SIGBUS, &si, current); 193 addr_lsb, current);
197 } else { 194 } else {
198 /* 195 /*
199 * Don't use force here, it's convenient if the signal 196 * Don't use force here, it's convenient if the signal
@@ -201,8 +198,8 @@ static int kill_proc(struct task_struct *t, unsigned long addr,
201 * This could cause a loop when the user sets SIGBUS 198 * This could cause a loop when the user sets SIGBUS
202 * to SIG_IGN, but hopefully no one will do that? 199 * to SIG_IGN, but hopefully no one will do that?
203 */ 200 */
204 si.si_code = BUS_MCEERR_AO; 201 ret = send_sig_mceerr(BUS_MCEERR_AO, (void __user *)addr,
205 ret = send_sig_info(SIGBUS, &si, t); /* synchronous? */ 202 addr_lsb, t); /* synchronous? */
206 } 203 }
207 if (ret < 0) 204 if (ret < 0)
208 pr_info("Memory failure: Error sending signal to %s:%d: %d\n", 205 pr_info("Memory failure: Error sending signal to %s:%d: %d\n",