All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg KH <gregkh@linuxfoundation.org>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Tony Luck <tony.luck@intel.com>,
	Borislav Petkov <borislav.petkov@amd.com>
Subject: [ 038/122] x86/mce: Fix siginfo_t->si_addr value for non-recoverable memory faults
Date: Tue,  7 Aug 2012 15:25:26 -0700	[thread overview]
Message-ID: <20120807221951.654665148@linuxfoundation.org> (raw)
In-Reply-To: <20120807221948.220495155@linuxfoundation.org>

From: Greg KH <gregkh@linuxfoundation.org>

3.5-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tony Luck <tony.luck@intel.com>

commit 6751ed65dc6642af64f7b8a440a75563c8aab7ae upstream.

In commit dad1743e5993f1 ("x86/mce: Only restart instruction after machine
check recovery if it is safe") we fixed mce_notify_process() to force a
signal to the current process if it was not restartable (RIPV bit not
set in MCG_STATUS). But doing it here means that the process doesn't
get told the virtual address of the fault via siginfo_t->si_addr. This
would prevent application level recovery from the fault.

Make a new MF_MUST_KILL flag bit for memory_failure() et al. to use so
that we will provide the right information with the signal.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Acked-by: Borislav Petkov <borislav.petkov@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kernel/cpu/mcheck/mce.c |    6 ++++--
 include/linux/mm.h               |    1 +
 mm/memory-failure.c              |   14 ++++++++------
 3 files changed, 13 insertions(+), 8 deletions(-)

--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1186,6 +1186,7 @@ void mce_notify_process(void)
 {
 	unsigned long pfn;
 	struct mce_info *mi = mce_find_info();
+	int flags = MF_ACTION_REQUIRED;
 
 	if (!mi)
 		mce_panic("Lost physical address for unconsumed uncorrectable error", NULL, NULL);
@@ -1200,8 +1201,9 @@ void mce_notify_process(void)
 	 * doomed. We still need to mark the page as poisoned and alert any
 	 * other users of the page.
 	 */
-	if (memory_failure(pfn, MCE_VECTOR, MF_ACTION_REQUIRED) < 0 ||
-			   mi->restartable == 0) {
+	if (!mi->restartable)
+		flags |= MF_MUST_KILL;
+	if (memory_failure(pfn, MCE_VECTOR, flags) < 0) {
 		pr_err("Memory error not recovered");
 		force_sig(SIGBUS, current);
 	}
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1591,6 +1591,7 @@ void vmemmap_populate_print_last(void);
 enum mf_flags {
 	MF_COUNT_INCREASED = 1 << 0,
 	MF_ACTION_REQUIRED = 1 << 1,
+	MF_MUST_KILL = 1 << 2,
 };
 extern int memory_failure(unsigned long pfn, int trapno, int flags);
 extern void memory_failure_queue(unsigned long pfn, int trapno, int flags);
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -345,14 +345,14 @@ static void add_to_kill(struct task_stru
  * Also when FAIL is set do a force kill because something went
  * wrong earlier.
  */
-static void kill_procs(struct list_head *to_kill, int doit, int trapno,
+static void kill_procs(struct list_head *to_kill, int forcekill, int trapno,
 			  int fail, struct page *page, unsigned long pfn,
 			  int flags)
 {
 	struct to_kill *tk, *next;
 
 	list_for_each_entry_safe (tk, next, to_kill, nd) {
-		if (doit) {
+		if (forcekill) {
 			/*
 			 * In case something went wrong with munmapping
 			 * make sure the process doesn't catch the
@@ -858,7 +858,7 @@ static int hwpoison_user_mappings(struct
 	struct address_space *mapping;
 	LIST_HEAD(tokill);
 	int ret;
-	int kill = 1;
+	int kill = 1, forcekill;
 	struct page *hpage = compound_head(p);
 	struct page *ppage;
 
@@ -888,7 +888,7 @@ static int hwpoison_user_mappings(struct
 	 * be called inside page lock (it's recommended but not enforced).
 	 */
 	mapping = page_mapping(hpage);
-	if (!PageDirty(hpage) && mapping &&
+	if (!(flags & MF_MUST_KILL) && !PageDirty(hpage) && mapping &&
 	    mapping_cap_writeback_dirty(mapping)) {
 		if (page_mkclean(hpage)) {
 			SetPageDirty(hpage);
@@ -965,12 +965,14 @@ static int hwpoison_user_mappings(struct
 	 * Now that the dirty bit has been propagated to the
 	 * struct page and all unmaps done we can decide if
 	 * killing is needed or not.  Only kill when the page
-	 * was dirty, otherwise the tokill list is merely
+	 * was dirty or the process is not restartable,
+	 * otherwise the tokill list is merely
 	 * freed.  When there was a problem unmapping earlier
 	 * use a more force-full uncatchable kill to prevent
 	 * any accesses to the poisoned memory.
 	 */
-	kill_procs(&tokill, !!PageDirty(ppage), trapno,
+	forcekill = PageDirty(ppage) || (flags & MF_MUST_KILL);
+	kill_procs(&tokill, forcekill, trapno,
 		      ret != SWAP_SUCCESS, p, pfn, flags);
 
 	return ret;



  parent reply	other threads:[~2012-08-07 22:29 UTC|newest]

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-07 22:24 [ 000/122] 3.5.1-stable review Greg Kroah-Hartman
2012-08-07 22:24 ` [ 001/122] target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE Greg Kroah-Hartman
2012-08-07 22:24 ` [ 002/122] iscsi-target: Drop bogus struct file usage for iSCSI/SCTP Greg Kroah-Hartman
2012-08-07 22:24 ` [ 003/122] mmc: sdhci-pci: CaFe has broken card detection Greg Kroah-Hartman
2012-08-07 22:24 ` [ 004/122] mmc: sdhci: fix incorrect command used in tuning Greg Kroah-Hartman
2012-08-07 22:24 ` [ 005/122] powerpc/ftrace: Fix assembly trampoline register usage Greg Kroah-Hartman
2012-08-07 22:24 ` [ 006/122] powerpc: Add "memory" attribute for mfmsr() Greg Kroah-Hartman
2012-08-07 22:24 ` [ 007/122] powerpc/eeh: Check handle_eeh_events() return value Greg Kroah-Hartman
2012-08-07 22:24 ` [ 008/122] be2net: Missing byteswap in be_get_fw_log_level causes oops on PowerPC Greg Kroah-Hartman
2012-08-07 22:24 ` [ 009/122] powerpc/85xx: use the BRx registers to enable indirect mode on the P1022DS Greg Kroah-Hartman
2012-08-07 22:24 ` [ 010/122] smack: off by one error Greg Kroah-Hartman
2012-08-07 22:53   ` Casey Schaufler
2012-08-08  0:11   ` Casey Schaufler
2012-08-07 22:24 ` [ 011/122] SCSI: libsas: continue revalidation Greg Kroah-Hartman
2012-08-07 22:25 ` [ 012/122] SCSI: libsas: fix sas_discover_devices return code handling Greg Kroah-Hartman
2012-08-07 22:25 ` [ 013/122] SCSI: fix eh wakeup (scsi_schedule_eh vs scsi_restart_operations) Greg Kroah-Hartman
2012-08-07 22:25 ` [ 014/122] SCSI: fix hot unplug vs async scan race Greg Kroah-Hartman
2012-08-07 22:25 ` [ 015/122] SCSI: Fix device removal NULL pointer dereference Greg Kroah-Hartman
2012-08-07 22:25 ` [ 016/122] SCSI: Avoid dangling pointer in scsi_requeue_command() Greg Kroah-Hartman
2012-08-07 22:25 ` [ 017/122] rt2800usb: 2001:3c17 is an RT3370 device Greg Kroah-Hartman
2012-08-07 22:25 ` [ 018/122] ARM: dt: tegra trimslice: enable USB2 port Greg Kroah-Hartman
2012-08-07 22:25 ` [ 019/122] ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one Greg Kroah-Hartman
2012-08-07 22:25 ` [ 020/122] ARM: dt: tegra trimslice: add vbus-gpio property Greg Kroah-Hartman
2012-08-07 22:25 ` [ 021/122] ASoC: dapm: Fix locking during codec shutdown Greg Kroah-Hartman
2012-08-07 22:25 ` [ 022/122] ASoC: dapm: Fix _PRE and _POST events for DAPM performance improvements Greg Kroah-Hartman
2012-08-07 22:25 ` [ 023/122] ASoC: wm8962: Redo early init of the part on resume Greg Kroah-Hartman
2012-08-07 22:25 ` [ 024/122] ALSA: hda - Add support for Realtek ALC282 Greg Kroah-Hartman
2012-08-07 22:25 ` [ 025/122] ALSA: hda - Turn on PIN_OUT from hdmi playback prepare Greg Kroah-Hartman
2012-08-07 22:25 ` [ 026/122] ALSA: hda - Dont power up when not powered down Greg Kroah-Hartman
2012-08-07 22:25 ` [ 027/122] HID: hid-multitouch: fix input mode feature command Greg Kroah-Hartman
2012-08-07 22:25 ` [ 028/122] usbdevfs: Correct amount of data copied to user in processcompl_compat Greg Kroah-Hartman
2012-08-07 22:25 ` [ 029/122] usb: gadget: Fix g_ether interface link status Greg Kroah-Hartman
2012-08-07 22:25 ` [ 030/122] USB: option: add ZTE MF821D Greg Kroah-Hartman
2012-08-07 22:25 ` [ 031/122] Revert "usb/uas: make sure data urb is gone if we receive status before that" Greg Kroah-Hartman
2012-08-07 22:25 ` [ 032/122] USB: Disable LPM while the device is unconfigured Greg Kroah-Hartman
2012-08-07 22:25 ` [ 033/122] USB: Fix LPM disable/enable during device reset Greg Kroah-Hartman
2012-08-07 22:25 ` [ 034/122] USB: Remove unused LPM variable Greg Kroah-Hartman
2012-08-07 22:25 ` [ 035/122] USB: Fix LPM disable count mismatch on driver unbind Greg Kroah-Hartman
2012-08-07 22:25 ` [ 036/122] ALSA: hda - add dock support for Thinkpad X230 Tablet Greg Kroah-Hartman
2012-08-07 22:25 ` [ 037/122] x86, microcode: Sanitize per-cpu microcode reloading interface Greg Kroah-Hartman
2012-08-07 22:25 ` Greg Kroah-Hartman [this message]
2012-08-07 22:25 ` [ 039/122] locks: fix checking of fcntl_setlease argument Greg Kroah-Hartman
2012-08-07 22:25 ` [ 040/122] batman-adv: fix skb->data assignment Greg Kroah-Hartman
2012-08-09  3:13   ` Ben Hutchings
2012-08-09 15:17     ` Greg Kroah-Hartman
2012-08-07 22:25 ` [ 041/122] ftrace: Disable function tracing during suspend/resume and hibernation, again Greg Kroah-Hartman
2012-08-07 22:25 ` [ 042/122] PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock Greg Kroah-Hartman
2012-08-07 22:25 ` [ 043/122] PM / Sleep: call early resume handlers when suspend_noirq fails Greg Kroah-Hartman
2012-08-07 22:25 ` [ 044/122] TPM: chip disabled state erronously being reported as error Greg Kroah-Hartman
2012-08-07 22:25 ` [ 045/122] tun: fix a crash bug and a memory leak Greg Kroah-Hartman
2012-08-07 22:25 ` [ 046/122] mac80211: fix crash with single-queue drivers Greg Kroah-Hartman
2012-08-07 22:25 ` [ 047/122] b43: fix crash with OpenFWWF Greg Kroah-Hartman
2012-08-07 22:25 ` [ 048/122] mac80211: fix read outside array bounds Greg Kroah-Hartman
2012-08-07 22:25 ` [ 049/122] mac80211: fail authentication when AP denied authentication Greg Kroah-Hartman
2012-08-07 22:25 ` [ 050/122] iwlwifi: Check BSS ctx active before call mac80211 Greg Kroah-Hartman
2012-08-07 22:25 ` [ 051/122] iwlwifi: fix debug print in iwl_sta_calc_ht_flags Greg Kroah-Hartman
2012-08-07 22:25 ` [ 052/122] atl1c: fix issue of io access mode for AR8152 v2.1 Greg Kroah-Hartman
2012-08-07 22:25 ` [ 053/122] rtlwifi: rtl8192cu: Change buffer allocation for synchronous reads Greg Kroah-Hartman
2012-08-07 22:25 ` [ 054/122] rtlwifi: rtl8192de: Fix phy-based version calculation Greg Kroah-Hartman
2012-08-07 22:25 ` [ 055/122] mwifiex: correction in mcs index check Greg Kroah-Hartman
2012-08-07 22:25 ` [ 056/122] s390/idle: fix sequence handling vs cpu hotplug Greg Kroah-Hartman
2012-08-07 22:25 ` [ 057/122] s390/mm: downgrade page table after fork of a 31 bit process Greg Kroah-Hartman
2012-08-07 22:25 ` [ 058/122] s390/mm: fix fault handling for page table walk case Greg Kroah-Hartman
2012-08-07 22:25 ` [ 059/122] cgroup: cgroup_rm_files() was calling simple_unlink() with the wrong inode Greg Kroah-Hartman
2012-08-07 22:25 ` [ 060/122] iommu/amd: Add missing spin_lock initialization Greg Kroah-Hartman
2012-08-07 22:25 ` [ 061/122] iommu/amd: Fix hotplug with iommu=pt Greg Kroah-Hartman
2012-08-07 22:25 ` [ 062/122] udf: Improve table length check to avoid possible overflow Greg Kroah-Hartman
2012-08-07 22:25 ` [ 063/122] stable: update references to older 2.6 versions for 3.x Greg Kroah-Hartman
2012-08-07 22:25 ` [ 064/122] staging: zsmalloc: Finish conversion to a separate module Greg Kroah-Hartman
2012-08-07 22:25 ` [ 065/122] workqueue: perform cpu down operations from low priority cpu_notifier() Greg Kroah-Hartman
2012-08-07 22:25 ` [ 066/122] ACPI, APEI: Fixup common access width firmware bug Greg Kroah-Hartman
2012-08-07 22:25 ` [ 067/122] ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check Greg Kroah-Hartman
2012-08-07 22:25 ` [ 068/122] kmsg - properly print over-long continuation lines Greg Kroah-Hartman
2012-08-07 22:25 ` [ 069/122] Btrfs: call the ordered free operation without any locks held Greg Kroah-Hartman
2012-08-07 22:25 ` [ 070/122] cifs: reinstate sec=ntlmv2 mount option Greg Kroah-Hartman
2012-08-07 22:25 ` [ 071/122] cifs: ensure that we always do cifsFileInfo_get under the spinlock Greg Kroah-Hartman
2012-08-07 22:26 ` [ 072/122] spi/pl022: disable port when unused Greg Kroah-Hartman
2012-08-07 22:26 ` [ 073/122] qeth: repair crash in qeth_l3_vlan_rx_kill_vid() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 074/122] tg3: add device id of Apple Thunderbolt Ethernet device Greg Kroah-Hartman
2012-08-07 22:26 ` [ 075/122] tg3: Fix Read DMA workaround for 5719 A0 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 076/122] tg3: Fix race condition in tg3_get_stats64() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 077/122] drm/radeon: fix fence related segfault in CS Greg Kroah-Hartman
2012-08-07 22:26 ` [ 078/122] drm/radeon: fix bo creation retry path Greg Kroah-Hartman
2012-08-07 22:26 ` [ 079/122] drm/radeon: Try harder to avoid HW cursor ending on a multiple of 128 columns Greg Kroah-Hartman
2012-08-07 22:26 ` [ 080/122] drm/radeon: fix non revealent error message Greg Kroah-Hartman
2012-08-07 22:26 ` [ 081/122] drm/radeon: fix hotplug of DP to DVI|HDMI passive adapters (v2) Greg Kroah-Hartman
2012-08-07 22:26 ` [ 082/122] drm/radeon: on hotplug force link training to happen (v2) Greg Kroah-Hartman
2012-08-07 22:26 ` [ 083/122] drm/radeon: fix dpms on/off on trinity/aruba v2 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 084/122] drm/nouveau: init vblank requests list Greg Kroah-Hartman
2012-08-07 22:26 ` [ 085/122] posix_types.h: Cleanup stale __NFDBITS and related definitions Greg Kroah-Hartman
2012-08-07 22:26 ` [ 086/122] dm thin: reduce endio_hook pool size Greg Kroah-Hartman
2012-08-07 22:26 ` [ 087/122] dm thin: fix memory leak in process_prepared_mapping error paths Greg Kroah-Hartman
2012-08-07 22:26 ` [ 088/122] nfsd4: our filesystems are normally case sensitive Greg Kroah-Hartman
2012-08-07 22:26 ` [ 089/122] nfsd4: fix cr_principal comparison check in same_creds Greg Kroah-Hartman
2012-08-07 22:26 ` [ 090/122] nfs: skip commit in releasepage if were freeing memory for fs-related reasons Greg Kroah-Hartman
2012-08-07 22:26 ` [ 091/122] NFS: Fix a number of bugs in the idmapper Greg Kroah-Hartman
2012-08-07 22:26 ` [ 092/122] nouveau: Fix alignment requirements on src and dst addresses Greg Kroah-Hartman
2012-08-07 22:26 ` [ 093/122] ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr Greg Kroah-Hartman
2012-08-07 22:26 ` [ 094/122] ext4: fix overhead calculation used by ext4_statfs() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 095/122] ext4: fix hole punch failure when depth is greater than 0 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 096/122] ext4: dont let i_reserved_meta_blocks go negative Greg Kroah-Hartman
2012-08-07 22:26 ` [ 097/122] ext4: undo ext4_calc_metadata_amount if we fail to claim space Greg Kroah-Hartman
2012-08-07 22:26 ` [ 098/122] ext4: use proper csum calculation in ext4_rename Greg Kroah-Hartman
2012-08-07 22:26 ` [ 099/122] ext4: use s_csum_seed instead of i_csum_seed for xattr block Greg Kroah-Hartman
2012-08-07 22:26 ` [ 100/122] net: Fix references to out-of-scope variables in put_cmsg_compat() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 101/122] r8169: revert "add byte queue limit support" Greg Kroah-Hartman
2012-08-07 22:26 ` [ 102/122] caif: fix NULL pointer check Greg Kroah-Hartman
2012-08-07 22:26 ` [ 103/122] wanmain: comparing array with NULL Greg Kroah-Hartman
2012-08-07 22:26 ` [ 104/122] tcp: Add TCP_USER_TIMEOUT negative value check Greg Kroah-Hartman
2012-08-07 22:26 ` [ 105/122] USB: kaweth.c: use GFP_ATOMIC under spin_lock Greg Kroah-Hartman
2012-08-07 22:26 ` [ 106/122] net: fix rtnetlink IFF_PROMISC and IFF_ALLMULTI handling Greg Kroah-Hartman
2012-08-07 22:26 ` [ 107/122] tcp: perform DMA to userspace only if there is a task waiting for it Greg Kroah-Hartman
2012-08-07 22:26 ` [ 108/122] net/tun: fix ioctl() based info leaks Greg Kroah-Hartman
2012-08-07 22:26 ` [ 109/122] USB: echi-dbgp: increase the controller wait time to come out of halt Greg Kroah-Hartman
2012-08-07 22:26 ` [ 110/122] ALSA: snd-usb: fix clock source validity index Greg Kroah-Hartman
2012-08-07 22:26 ` [ 111/122] ALSA: mpu401: Fix missing initialization of irq field Greg Kroah-Hartman
2012-08-07 22:26 ` [ 112/122] ALSA: hda - Fix invalid D3 of headphone DAC on VT202x codecs Greg Kroah-Hartman
2012-08-07 22:26 ` [ 113/122] ALSA: hda - Fix mute-LED GPIO setup for HP Mini 210 Greg Kroah-Hartman
2012-08-07 22:26 ` [ 114/122] ALSA: hda - Fix polarity of mute LED on " Greg Kroah-Hartman
2012-08-07 22:26 ` [ 115/122] ALSA: hda - Fix mute-LED GPIO initialization for IDT codecs Greg Kroah-Hartman
2012-08-07 22:26 ` [ 116/122] ALSA: hda - Support dock on Lenovo Thinkpad T530 with ALC269VC Greg Kroah-Hartman
2012-08-07 22:26 ` [ 117/122] ASoC: wm8962: Allow VMID time to fully ramp Greg Kroah-Hartman
2012-08-07 22:26 ` [ 118/122] ASoC: wm8994: Ensure there are enough BCLKs for four channels Greg Kroah-Hartman
2012-08-07 22:26 ` [ 119/122] m68k: Make sys_atomic_cmpxchg_32 work on classic m68k Greg Kroah-Hartman
2012-08-07 22:26 ` [ 120/122] futex: Test for pi_mutex on fault in futex_wait_requeue_pi() Greg Kroah-Hartman
2012-08-07 22:26 ` [ 121/122] futex: Fix bug in WARN_ON for NULL q.pi_state Greg Kroah-Hartman
2012-08-07 22:26 ` [ 122/122] futex: Forbid uaddr == uaddr2 in futex_wait_requeue_pi() Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120807221951.654665148@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=borislav.petkov@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.