Subject: + memory-failure-send-right-signal-code-to-correct-thread.patch added to -mm tree To: tony.luck@xxxxxxxxx,andi@xxxxxxxxxxxxxx,bp@xxxxxxx,gong.chen@xxxxxxxxxxxxxxxxxx,n-horiguchi@xxxxxxxxxxxxx,otto.g.bruggeman@xxxxxxxxx,stable@xxxxxxxxxxxxxxx From: akpm@xxxxxxxxxxxxxxxxxxxx Date: Mon, 02 Jun 2014 15:45:12 -0700 The patch titled Subject: mm/memory-failure.c-failure: send right signal code to correct thread has been added to the -mm tree. Its filename is memory-failure-send-right-signal-code-to-correct-thread.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/memory-failure-send-right-signal-code-to-correct-thread.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/memory-failure-send-right-signal-code-to-correct-thread.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Tony Luck <tony.luck@xxxxxxxxx> Subject: mm/memory-failure.c-failure: send right signal code to correct thread When a thread in a multi-threaded application hits a machine check because of an uncorrectable error in memory - we want to send the SIGBUS with si.si_code = BUS_MCEERR_AR to that thread. Currently we fail to do that if the active thread is not the primary thread in the process. collect_procs() just finds primary threads and this test: if ((flags & MF_ACTION_REQUIRED) && t == current) { will see that the thread we found isn't the current thread and so send a si.si_code = BUS_MCEERR_AO to the primary (and nothing to the active thread at this time). We can fix this by checking whether "current" shares the same mm with the process that collect_procs() said owned the page. If so, we send the SIGBUS to current (with code BUS_MCEERR_AR). Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx> Signed-off-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Reported-by: Otto Bruggeman <otto.g.bruggeman@xxxxxxxxx> Cc: Andi Kleen <andi@xxxxxxxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxx> Cc: Chen Gong <gong.chen@xxxxxxxxxxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> [3.2+] Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory-failure.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -puN mm/memory-failure.c~memory-failure-send-right-signal-code-to-correct-thread mm/memory-failure.c --- a/mm/memory-failure.c~memory-failure-send-right-signal-code-to-correct-thread +++ a/mm/memory-failure.c @@ -204,9 +204,9 @@ static int kill_proc(struct task_struct #endif si.si_addr_lsb = page_size_order(page) + PAGE_SHIFT; - if ((flags & MF_ACTION_REQUIRED) && t == current) { + if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) { si.si_code = BUS_MCEERR_AR; - ret = force_sig_info(SIGBUS, &si, t); + ret = force_sig_info(SIGBUS, &si, current); } else { /* * Don't use force here, it's convenient if the signal _ Patches currently in -mm which might be from tony.luck@xxxxxxxxx are hugetlb-restrict-hugepage_migration_support-to-x86_64.patch memory-failure-send-right-signal-code-to-correct-thread.patch memory-failure-dont-let-collect_procs-skip-over-processes-for-mf_action_required.patch mm-memory-failurec-support-dedicated-thread-to-handle-sigbusbus_mceerr_ao.patch lib-scatterlist-make-arch_has_sg_chain-an-actual-kconfig.patch lib-scatterlist-clean-up-useless-architecture-versions-of-scatterlisth.patch linux-next.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html