提交 c0f45555 编写于 作者: E Eric W. Biederman

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: N"Eric W. Biederman" <ebiederm@xmission.com>
上级 83b57531
...@@ -181,19 +181,16 @@ EXPORT_SYMBOL_GPL(hwpoison_filter); ...@@ -181,19 +181,16 @@ EXPORT_SYMBOL_GPL(hwpoison_filter);
static int kill_proc(struct task_struct *t, unsigned long addr, static int kill_proc(struct task_struct *t, unsigned long addr,
unsigned long pfn, struct page *page, int flags) unsigned long pfn, struct page *page, int flags)
{ {
struct siginfo si; short addr_lsb;
int ret; int ret;
pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n", pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n",
pfn, t->comm, t->pid); pfn, t->comm, t->pid);
si.si_signo = SIGBUS; addr_lsb = compound_order(compound_head(page)) + PAGE_SHIFT;
si.si_errno = 0;
si.si_addr = (void *)addr;
si.si_addr_lsb = compound_order(compound_head(page)) + PAGE_SHIFT;
if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) { if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) {
si.si_code = BUS_MCEERR_AR; ret = force_sig_mceerr(BUS_MCEERR_AR, (void __user *)addr,
ret = force_sig_info(SIGBUS, &si, current); addr_lsb, current);
} else { } else {
/* /*
* Don't use force here, it's convenient if the signal * 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,8 +198,8 @@ static int kill_proc(struct task_struct *t, unsigned long addr,
* This could cause a loop when the user sets SIGBUS * This could cause a loop when the user sets SIGBUS
* to SIG_IGN, but hopefully no one will do that? * to SIG_IGN, but hopefully no one will do that?
*/ */
si.si_code = BUS_MCEERR_AO; ret = send_sig_mceerr(BUS_MCEERR_AO, (void __user *)addr,
ret = send_sig_info(SIGBUS, &si, t); /* synchronous? */ addr_lsb, t); /* synchronous? */
} }
if (ret < 0) if (ret < 0)
pr_info("Memory failure: Error sending signal to %s:%d: %d\n", pr_info("Memory failure: Error sending signal to %s:%d: %d\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册