From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, "H.J. Lu" <hjl.tools@gmail.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Matthias Kaehlcke <mka@chromium.org>
Subject: [PATCH 4.14 003/109] x86: Treat R_X86_64_PLT32 as R_X86_64_PC32
Date: Fri, 16 Mar 2018 16:22:32 +0100 [thread overview]
Message-ID: <20180316152330.027580286@linuxfoundation.org> (raw)
In-Reply-To: <20180316152329.844663293@linuxfoundation.org>
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: H.J. Lu <hjl.tools@gmail.com>
commit b21ebf2fb4cde1618915a97cc773e287ff49173e upstream.
On i386, there are 2 types of PLTs, PIC and non-PIC. PIE and shared
objects must use PIC PLT. To use PIC PLT, you need to load
_GLOBAL_OFFSET_TABLE_ into EBX first. There is no need for that on
x86-64 since x86-64 uses PC-relative PLT.
On x86-64, for 32-bit PC-relative branches, we can generate PLT32
relocation, instead of PC32 relocation, which can also be used as
a marker for 32-bit PC-relative branches. Linker can always reduce
PLT32 relocation to PC32 if function is defined locally. Local
functions should use PC32 relocation. As far as Linux kernel is
concerned, R_X86_64_PLT32 can be treated the same as R_X86_64_PC32
since Linux kernel doesn't use PLT.
R_X86_64_PLT32 for 32-bit PC-relative branches has been enabled in
binutils master branch which will become binutils 2.31.
[ hjl is working on having better documentation on this all, but a few
more notes from him:
"PLT32 relocation is used as marker for PC-relative branches. Because
of EBX, it looks odd to generate PLT32 relocation on i386 when EBX
doesn't have GOT.
As for symbol resolution, PLT32 and PC32 relocations are almost
interchangeable. But when linker sees PLT32 relocation against a
protected symbol, it can resolved locally at link-time since it is
used on a branch instruction. Linker can't do that for PC32
relocation"
but for the kernel use, the two are basically the same, and this
commit gets things building and working with the current binutils
master - Linus ]
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/x86/kernel/machine_kexec_64.c | 1 +
arch/x86/kernel/module.c | 1 +
arch/x86/tools/relocs.c | 3 +++
3 files changed, 5 insertions(+)
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -542,6 +542,7 @@ int arch_kexec_apply_relocations_add(con
goto overflow;
break;
case R_X86_64_PC32:
+ case R_X86_64_PLT32:
value -= (u64)address;
*(u32 *)location = value;
break;
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
@@ -191,6 +191,7 @@ int apply_relocate_add(Elf64_Shdr *sechd
goto overflow;
break;
case R_X86_64_PC32:
+ case R_X86_64_PLT32:
if (*(u32 *)loc != 0)
goto invalid_relocation;
val -= (u64)loc;
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
@@ -770,9 +770,12 @@ static int do_reloc64(struct section *se
break;
case R_X86_64_PC32:
+ case R_X86_64_PLT32:
/*
* PC relative relocations don't need to be adjusted unless
* referencing a percpu symbol.
+ *
+ * NB: R_X86_64_PLT32 can be treated as R_X86_64_PC32.
*/
if (is_percpu_sym(sym, symname))
add_reloc(&relocs32neg, offset);
next prev parent reply other threads:[~2018-03-16 15:34 UTC|newest]
Thread overview: 132+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-16 15:22 [PATCH 4.14 000/109] 4.14.28-stable review Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 001/109] [PATCH] net: phy: fix resume handling Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 002/109] net: phy: Restore phy_resume() locking assumption Greg Kroah-Hartman
2018-03-16 15:22 ` Greg Kroah-Hartman [this message]
2018-03-16 15:22 ` [PATCH 4.14 004/109] ASoC: sun4i-i2s: Fix RX slot number of SUN8I Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 005/109] ASoC: sgtl5000: Fix suspend/resume Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 006/109] ASoC: wm_adsp: For TLV controls only register TLV get/set Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 007/109] ASoC: rt5651: Fix regcache sync errors on resume Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 008/109] usb: host: xhci-rcar: add support for r8a77965 Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 009/109] xhci: Fix front USB ports on ASUS PRIME B350M-A Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 010/109] xhci: fix endpoint context tracer output Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 011/109] serial: sh-sci: prevent lockup on full TTY buffers Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 012/109] tty/serial: atmel: add new version check for usart Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 013/109] uas: fix comparison for error code Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 014/109] staging: comedi: fix comedi_nsamples_left Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 015/109] staging: android: ashmem: Fix lockdep issue during llseek Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 016/109] USB: storage: Add JMicron bridge 152d:2567 to unusual_devs.h Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 017/109] usbip: vudc: fix null pointer dereference on udc->lock Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 018/109] usb: quirks: add control message delay for 1b1c:1b20 Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 019/109] usb: usbmon: Read text within supplied buffer size Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 020/109] usb: gadget: f_fs: Fix use-after-free in ffs_fs_kill_sb() Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 021/109] usb: dwc3: Fix lock-up on ID change during system suspend/resume Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 022/109] serial: 8250_pci: Add Brainboxes UC-260 4 port serial device Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 023/109] serial: core: mark port as initialized in autoconfig Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 024/109] earlycon: add reg-offset to physical address before mapping Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 025/109] dm mpath: fix passing integrity data Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 026/109] [PATCH] Revert "btrfs: use proper endianness accessors for super_copy" Greg Kroah-Hartman
2018-03-16 15:22 ` [PATCH 4.14 030/109] HID: multitouch: Only look at non touch fields in first packet of a frame Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 031/109] HID: elo: clear BTN_LEFT mapping Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 032/109] iwlwifi: mvm: rs: dont override the rate history in the search cycle Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 033/109] ARM: dts: koelsch: Move cec_clock to root node Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 034/109] clk: meson: gxbb: fix wrong clock for SARADC/SANA Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 035/109] ARM: dts: exynos: Correct Trats2 panel reset line Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 036/109] drm/amdgpu: fix get_max_engine_clock_in_mhz Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 037/109] staging: rtl8822be: fix missing null check on dev_alloc_skb return Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 038/109] typec: tcpm: fusb302: Resolve out of order messaging events Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 040/109] sched: Stop switched_to_rt() from sending IPIs to offline CPUs Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 041/109] sched: Stop resched_cpu() " Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 042/109] crypto: ecc - Fix NULL pointer deref. on no default_rng Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 043/109] crypto: cavium - fix memory leak on info Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 044/109] test_firmware: fix setting old custom fw path back on exit Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 045/109] net: ieee802154: adf7242: Fix bug if defined DEBUG Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 046/109] rtc: brcmstb-waketimer: fix error handling in brcmstb_waketmr_probe() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 047/109] net: xfrm: allow clearing socket xfrm policies Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 048/109] mtd: nand: fix interpretation of NAND_CMD_NONE in nand_command[_lp]() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 049/109] net: thunderx: Set max queue count taking XDP_TX into account Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 050/109] ARM: dts: am335x-pepper: Fix the audio CODECs reset pin Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 051/109] ARM: dts: omap3-n900: " Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 052/109] mtd: nand: ifc: update bufnum mask for ver >= 2.0.0 Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 053/109] userns: Dont fail follow_automount based on s_user_ns Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 054/109] xfrm: Fix xfrm_replay_overflow_offload_esn Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 055/109] leds: pm8058: Silence pointer to integer size warning Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 056/109] clk: ti: clkctrl: add support for retrying failed init Greg Kroah-Hartman
2018-03-19 3:44 ` Dan Rue
2018-03-19 6:57 ` Tero Kristo
2018-03-19 7:24 ` Greg Kroah-Hartman
2018-03-19 16:42 ` Sasha Levin
2018-03-16 15:23 ` [PATCH 4.14 057/109] power: supply: ab8500_charger: Fix an error handling path Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 058/109] power: supply: ab8500_charger: Bail out in case of error in ab8500_charger_init_hw_registers() Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 059/109] drm/etnaviv: make THERMAL selectable Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 061/109] iio: health: max30102: Add power enable parameter to get_temp function Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 062/109] ath10k: update tdls teardown state to target Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 063/109] cpufreq: Fix governor module removal race Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 064/109] dmaengine: bcm2835-dma: Use vchan_terminate_vdesc() instead of desc_free Greg Kroah-Hartman
2018-03-16 18:46 ` Dan Rue
2018-03-17 14:32 ` Vinod Koul
2018-03-18 10:24 ` Greg Kroah-Hartman
2018-03-18 10:44 ` Greg Kroah-Hartman
2018-03-19 3:08 ` Vinod Koul
2018-03-19 7:14 ` Peter Ujfalusi
2018-03-19 7:23 ` Vinod Koul
2018-03-20 4:46 ` Vinod Koul
2018-03-16 15:23 ` [PATCH 4.14 065/109] dmaengine: amba-pl08x: " Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 067/109] scsi: ses: dont ask for diagnostic pages repeatedly during probe Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 068/109] pwm: stmpe: Fix wrong register offset for hwpwm=2 case Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 069/109] drm/sun4i: Fix format mask in DE2 driver Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 070/109] pinctrl: sh-pfc: r8a7791: Add can_clk function Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 071/109] pinctrl: sh-pfc: r8a7795-es1: Fix MOD_SEL1 bit[25:24] to 0x3 when using STP_ISEN_1_D Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 072/109] perf annotate: Fix unnecessary memory allocation for s390x Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 073/109] perf annotate: Fix objdump comment parsing for Intel mov dissassembly Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 074/109] iwlwifi: mvm: avoid dumping assert log when device is stopped Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 075/109] drm/amdgpu:fix virtual dce bug Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 076/109] clk: qcom: msm8916: fix mnd_width for codec_digcodec Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 077/109] mwifiex: cfg80211: do not change virtual interface during scan processing Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 078/109] ath10k: fix invalid STS_CAP_OFFSET_MASK Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 080/109] spi: sun6i: disable/unprepare clocks on remove Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 081/109] bnxt_en: Dont print "Link speed -1 no longer supported" messages Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 082/109] scsi: core: scsi_get_device_flags_keyed(): Always return device flags Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 083/109] scsi: devinfo: apply to HP XP the same flags as Hitachi VSP Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 084/109] scsi: dh: add new rdac devices Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 085/109] media: vsp1: Prevent suspending and resuming DRM pipelines Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 086/109] dm raid: fix raid set size revalidation Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 087/109] media: cpia2: Fix a couple off by one bugs Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 088/109] media: davinci: vpif_capture: add NULL check on devm_kzalloc return value Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 089/109] virtio_net: Disable interrupts if napi_complete_done rescheduled napi Greg Kroah-Hartman
2018-03-16 15:23 ` [PATCH 4.14 090/109] net: sched: drop qdisc_reset from dev_graft_qdisc Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 091/109] veth: set peer GSO values Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 092/109] drm/amdkfd: Fix memory leaks in kfd topology Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 093/109] powerpc/modules: Dont try to restore r2 after a sibling call Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 094/109] powerpc/64: Dont trace irqs-off at interrupt return to soft-disabled context Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 095/109] arm64: dts: renesas: salvator-common: Add EthernetAVB PHY reset Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 096/109] agp/intel: Flush all chipset writes after updating the GGTT Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 097/109] mac80211_hwsim: enforce PS_MANUAL_POLL to be set after PS_ENABLED Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 098/109] mac80211: remove BUG() when interface type is invalid Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 100/109] ASoC: nuc900: Fix a loop timeout test Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 101/109] mmc: mmc_test: Ensure command queue is disabled for testing Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 102/109] Fix misannotated out-of-line _copy_to_user() Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 103/109] ipvlan: add L2 check for packets arriving via virtual devices Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 104/109] rcutorture/configinit: Fix build directory error message Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 105/109] locking/locktorture: Fix num reader/writer corner cases Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 106/109] ima: relax requiring a file signature for new files with zero length Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 107/109] IB/mlx5: revisit -Wmaybe-uninitialized warning Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 108/109] dmaengine: qcom_hidma: check pending interrupts Greg Kroah-Hartman
2018-03-16 15:24 ` [PATCH 4.14 109/109] drm/i915/glk: Disable Guc and HuC on GLK Greg Kroah-Hartman
2018-03-16 19:40 ` [PATCH 4.14 000/109] 4.14.28-stable review Naresh Kamboju
2018-03-18 10:26 ` Greg Kroah-Hartman
2018-03-17 14:46 ` Guenter Roeck
2018-03-18 10:25 ` Greg Kroah-Hartman
2018-03-18 10:24 ` Greg Kroah-Hartman
2018-03-18 11:14 ` Greg Kroah-Hartman
2018-03-18 22:39 ` Guenter Roeck
2018-03-19 7:39 ` Greg Kroah-Hartman
2018-03-19 8:19 ` Dan Rue
2018-03-19 18:13 ` Kash Pande
2018-03-19 18:20 ` Guenter Roeck
2018-03-26 17:54 ` Kash Pande
2018-03-27 6:28 ` Greg Kroah-Hartman
2018-03-27 6:37 ` Guenter Roeck
2018-03-27 7:28 ` Greg Kroah-Hartman
2018-03-27 8:33 ` Thomas Backlund
2018-03-27 8:45 ` Greg Kroah-Hartman
2018-03-27 10:23 ` Guenter Roeck
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=20180316152330.027580286@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=hjl.tools@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mka@chromium.org \
--cc=stable@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).