mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Alex Smith <alex.smith@imgtec.com>,
	linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>,
	Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 3.11 033/128] recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules
Date: Thu, 24 Jul 2014 10:44:42 +0100	[thread overview]
Message-ID: <1406195177-8656-34-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1406195177-8656-1-git-send-email-luis.henriques@canonical.com>

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

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

From: Alex Smith <alex.smith@imgtec.com>

commit 91ad11d7cc6f4472ebf177a6252fbf0fd100d798 upstream.

On MIPS calls to _mcount in modules generate 2 instructions to load
the _mcount address (and therefore 2 relocations). The mcount_loc
table should only reference the first of these, so the second is
filtered out by checking the relocation offset and ignoring ones that
immediately follow the previous one seen.

However if a module has an _mcount call at offset 0, the second
relocation would not be filtered out due to old_r_offset == 0
being taken to mean that the current relocation is the first one
seen, and both would end up in the mcount_loc table.

This results in ftrace_make_nop() patching both (adjacent)
instructions to branches over the _mcount call sequence like so:

  0xffffffffc08a8000:  04 00 00 10     b       0xffffffffc08a8014
  0xffffffffc08a8004:  04 00 00 10     b       0xffffffffc08a8018
  0xffffffffc08a8008:  2d 08 e0 03     move    at,ra
  ...

The second branch is in the delay slot of the first, which is
defined to be unpredictable - on the platform on which this bug was
encountered, it triggers a reserved instruction exception.

Fix by initializing old_r_offset to ~0 and using that instead of 0
to determine whether the current relocation is the first seen.

Signed-off-by: Alex Smith <alex.smith@imgtec.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7098/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 scripts/recordmcount.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 9d1421e63ff8..49b582a225b0 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -163,11 +163,11 @@ static int mcount_adjust = 0;
 
 static int MIPS_is_fake_mcount(Elf_Rel const *rp)
 {
-	static Elf_Addr old_r_offset;
+	static Elf_Addr old_r_offset = ~(Elf_Addr)0;
 	Elf_Addr current_r_offset = _w(rp->r_offset);
 	int is_fake;
 
-	is_fake = old_r_offset &&
+	is_fake = (old_r_offset != ~(Elf_Addr)0) &&
 		(current_r_offset - old_r_offset == MIPS_FAKEMCOUNT_OFFSET);
 	old_r_offset = current_r_offset;
 
-- 
1.9.1


  parent reply	other threads:[~2014-07-24 10:20 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-24  9:44 [3.11.y.z extended stable] Linux 3.11.10.14 stable review Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 001/128] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 002/128] MIPS: KVM: Remove redundant NULL checks before kfree() Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 003/128] MIPS: KVM: Fix memory leak on VCPU Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 004/128] btrfs: Add ctime/mtime update for btrfs device add/remove Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 005/128] Btrfs: output warning instead of error when loading free space cache failed Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 006/128] Btrfs: make sure there are not any read requests before stopping workers Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 007/128] Btrfs: fix NULL pointer crash of deleting a seed device Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 008/128] Btrfs: mark mapping with error flag to report errors to userspace Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 009/128] Btrfs: set right total device count for seeding support Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 010/128] Btrfs: send, don't error in the presence of subvols/snapshots Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 011/128] fs: btrfs: volumes.c: Fix for possible null pointer dereference Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 012/128] Btrfs: use right type to get real comparison Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 013/128] Btrfs: fix scrub_print_warning to handle skinny metadata extents Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 014/128] btrfs: fix use of uninit "ret" in end_extent_writepage() Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 015/128] Bluetooth: Fix check for connection encryption Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 016/128] Bluetooth: Fix SSP acceptor just-works confirmation without MITM Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 017/128] Bluetooth: Fix indicating discovery state when canceling inquiry Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 018/128] Bluetooth: Fix locking of hdev when calling into SMP code Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 019/128] Bluetooth: Allow change security level on ATT_CID in slave role Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 020/128] rt2x00: disable TKIP on USB Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 021/128] b43: fix frequency reported on G-PHY with /new/ firmware Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 022/128] rt2x00: fix rfkill regression on rt2500pci Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 023/128] tracing: Fix syscall_*regfunc() vs copy_process() race Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 024/128] blkcg: fix use-after-free in __blkg_release_rcu() by making blkcg_gq refcnt an atomic_t Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 025/128] rbd: handle parent_overlap on writes correctly Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 026/128] lz4: ensure length does not wrap Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 027/128] mm, pcp: allow restoring percpu_pagelist_fraction default Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 028/128] mm: fix crashes from mbind() merging vmas Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 029/128] [CIFS] fix mount failure with broken pathnames when smb3 mount with mapchars option Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 030/128] drm: fix NULL pointer access by wrong ioctl Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 031/128] net: allwinner: emac: Add missing free_irq Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 032/128] ALSA: usb-audio: Fix races at disconnection and PCM closing Luis Henriques
2014-07-24  9:44 ` Luis Henriques [this message]
2014-07-24  9:44 ` [PATCH 3.11 034/128] MIPS: MSC: Prevent out-of-bounds writes to MIPS SC ioremap'd region Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 035/128] target: Fix left-over se_lun->lun_sep pointer OOPs Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 036/128] iscsi-target: Explicily clear login response PDU in exception path Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 037/128] efi-pstore: Fix an overflow on 32-bit builds Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 038/128] lz4: fix another possible overrun Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 039/128] iscsi-target: Avoid rejecting incorrect ITT for Data-Out Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 040/128] powerpc: fix typo 'CONFIG_PPC_CPU' Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 041/128] powerpc: fix typo 'CONFIG_PMAC' Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 042/128] PCI: Fix incorrect vgaarb conditional in WARN_ON() Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 043/128] ptrace,x86: force IRET path after a ptrace_stop() Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 044/128] mei: me: fix hw ready reset flow Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 045/128] tracing: Try again for saved cmdline if failed due to locking Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 046/128] ring-buffer: Check if buffer exists before polling Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 047/128] Score: Implement the function csum_ipv6_magic Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 048/128] Score: The commit is for compiling successfully Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 049/128] Score: Modify the Makefile of Score, remove -mlong-calls for compiling Luis Henriques
2014-07-24  9:44 ` [PATCH 3.11 050/128] ext4: Fix buffer double free in ext4_alloc_branch() Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 051/128] ARM: OMAP2+: Fix parser-bug in platform muxing code Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 052/128] KVM: x86: Increase the number of fixed MTRR regs to 10 Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 053/128] KVM: x86: preserve the high 32-bits of the PAT register Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 054/128] usb: musb: ux500: don't propagate the OF node Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 055/128] usb: gadget: f_fs: fix NULL pointer dereference when there are no strings Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 056/128] iio: of_iio_channel_get_by_name() returns non-null pointers for error legs Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 057/128] irqchip: spear_shirq: Fix interrupt offset Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 058/128] USB: option: add device ID for SpeedUp SU9800 usb 3g modem Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 059/128] USB: ftdi_sio: fix null deref at port probe Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 060/128] usb: option: add/modify Olivetti Olicard modems Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 061/128] xhci: correct burst count field for isoc transfers on 1.0 xhci hosts Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 062/128] xhci: clear root port wake on bits if controller isn't wake-up capable Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 063/128] xhci: Fix runtime suspended xhci from blocking system suspend Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 064/128] ibmvscsi: Abort init sequence during error recovery Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 065/128] ibmvscsi: Add memory barriers for send / receive Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 066/128] virtio-scsi: avoid cancelling uninitialized work items Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 067/128] virtio-scsi: fix various bad behavior on aborted requests Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 068/128] ext4: Fix hole punching for files with indirect blocks Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 069/128] nfsd: fix rare symlink decoding bug Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 070/128] tools: ffs-test: fix header values endianess Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 071/128] drm/radeon/dpm: fix typo in vddci setup for eg/btc Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 072/128] drm/radeon/dpm: fix vddci setup typo on cayman Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 073/128] tracing: Remove ftrace_stop/start() from reading the trace file Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 074/128] usb: chipidea: udc: delete td from req's td list at ep_dequeue Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 075/128] drm/radeon/cik: fix typo in EOP packet Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 076/128] md: flush writes before starting a recovery Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 077/128] drm/vmwgfx: Fix incorrect write to read-only register v2: Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 078/128] mm: page_alloc: fix CMA area initialisation when pageblock > MAX_ORDER Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 079/128] /proc/stat: convert to single_open_size() Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 080/128] lz4: add overrun checks to lz4_uncompress_unknownoutputsize() Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 081/128] arm64: mm: Make icache synchronisation logic huge page aware Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 082/128] rtmutex: Detect changes in the pi lock chain Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 083/128] rtmutex: Plug slow unlock race Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 084/128] ARC: Implement ptrace(PTRACE_GET_THREAD_AREA) Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 085/128] mac80211: fix IBSS join by initializing last_scan_completed Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 086/128] [SCSI] Fix spurious request sense in error handling Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 087/128] ipvs: stop tot_stats estimator only under CONFIG_SYSCTL Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 088/128] netfilter: nf_nat: fix oops on netns removal Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 089/128] workqueue: fix dev_set_uevent_suppress() imbalance Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 090/128] cpuset,mempolicy: fix sleeping function called from invalid context Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 091/128] crypto: sha512_ssse3 - fix byte count to bit count conversion Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 092/128] thermal: hwmon: Make the check for critical temp valid consistent Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 093/128] hwmon: (amc6821) Fix permissions for temp2_input Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 094/128] hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 095/128] hwmon: (adm1021) Fix cache problem when writing temperature limits Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 096/128] ext4: fix unjournalled bg descriptor while initializing inode bitmap Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 097/128] ext4: clarify error count warning messages Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 098/128] ext4: disable synchronous transaction batching if max_batch_time==0 Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 099/128] intel_pstate: Set CPU number before accessing MSRs Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 100/128] USB: cp210x: add support for Corsair usb dongle Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 101/128] usb: option: Add ID for Telewell TW-LTE 4G v2 Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 102/128] ACPI / EC: Avoid race condition related to advance_transaction() Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 103/128] ACPI / EC: Add asynchronous command byte write support Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 104/128] ACPI / EC: Remove duplicated ec_wait_ibf0() waiter Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 105/128] ACPI / EC: Fix race condition in ec_transaction_completed() Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 106/128] ACPI / battery: Retry to get battery information if failed during probing Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 107/128] hwmon: (adm1031) Fix writes to limit registers Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 108/128] workqueue: zero cpumask of wq_numa_possible_cpumask on init Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 109/128] hwmon: (emc2103) Fix return value Luis Henriques
2014-07-24  9:45 ` [PATCH 3.11 110/128] hwmon: (emc2103) Clamp limits instead of bailing out Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 111/128] arm64: implement TASK_SIZE_OF Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 112/128] iio: ti_am335x_adc: Fix: Use same step id at FIFOs both ends Luis Henriques
2014-07-25 11:13   ` [PATCH] iio: ti_am335x_adc: Fix prerequisite for stepid patch Jan Kardell
2014-07-28 10:05     ` Luis Henriques
2014-08-08  8:24       ` Jonathan Cameron
2014-07-24  9:46 ` [PATCH 3.11 113/128] cpufreq: Makefile: fix compilation for davinci platform Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 114/128] Drivers: hv: vmbus: Fix a bug in the channel callback dispatch code Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 115/128] USB: ftdi_sio: Add extra PID Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 116/128] dm io: fix a race condition in the wake up code for sync_io Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 117/128] drm/radeon: fix typo in golden register setup on evergreen Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 118/128] drm/radeon/dpm: Reenabling SS on Cayman Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 119/128] powerpc/perf: Add PPMU_ARCH_207S define Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 120/128] powerpc/perf: Clear MMCR2 when enabling PMU Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 121/128] powerpc/perf: Never program book3s PMCs with values >= 0x80000000 Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 122/128] USB: serial: ftdi_sio: Add Infineon Triboard Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 123/128] clk: spear3xx: Use proper control register offset Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 124/128] x86, ioremap: Speed up check for RAM pages Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 125/128] rbd: use reference counts for image requests Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 126/128] Don't trigger congestion wait on dirty-but-not-writeout pages Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 127/128] hugetlb: fix copy_hugetlb_page_range() to handle migration/hwpoisoned entry Luis Henriques
2014-07-24  9:46 ` [PATCH 3.11 128/128] mm: hugetlb: fix copy_hugetlb_page_range() Luis Henriques

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=1406195177-8656-34-git-send-email-luis.henriques@canonical.com \
    --to=luis.henriques@canonical.com \
    --cc=alex.smith@imgtec.com \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®