Go to file
Fangrui Song b3d0f1c3a6 x86/build: Treat R_386_PLT32 relocation as R_386_PC32
commit bb73d07148c405c293e576b40af37737faf23a6a upstream.

This is similar to commit

  b21ebf2fb4 ("x86: Treat R_X86_64_PLT32 as R_X86_64_PC32")

but for i386. As far as the kernel is concerned, R_386_PLT32 can be
treated the same as R_386_PC32.

R_386_PLT32/R_X86_64_PLT32 are PC-relative relocation types which
can only be used by branches. If the referenced symbol is defined
externally, a PLT will be used.

R_386_PC32/R_X86_64_PC32 are PC-relative relocation types which can be
used by address taking operations and branches. If the referenced symbol
is defined externally, a copy relocation/canonical PLT entry will be
created in the executable.

On x86-64, there is no PIC vs non-PIC PLT distinction and an
R_X86_64_PLT32 relocation is produced for both `call/jmp foo` and
`call/jmp foo@PLT` with newer (2018) GNU as/LLVM integrated assembler.
This avoids canonical PLT entries (st_shndx=0, st_value!=0).

On i386, there are 2 types of PLTs, PIC and non-PIC. Currently,
the GCC/GNU as convention is to use R_386_PC32 for non-PIC PLT and
R_386_PLT32 for PIC PLT. Copy relocations/canonical PLT entries
are possible ABI issues but GCC/GNU as will likely keep the status
quo because (1) the ABI is legacy (2) the change will drop a GNU
ld diagnostic for non-default visibility ifunc in shared objects.

clang-12 -fno-pic (since [1]) can emit R_386_PLT32 for compiler
generated function declarations, because preventing canonical PLT
entries is weighed over the rare ifunc diagnostic.

Further info for the more interested:

  https://github.com/ClangBuiltLinux/linux/issues/1210
  https://sourceware.org/bugzilla/show_bug.cgi?id=27169
  a084c0388e [1]

 [ bp: Massage commit message. ]

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Fangrui Song <maskray@google.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Link: https://lkml.kernel.org/r/20210127205600.1227437-1-maskray@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-07 12:34:04 +01:00
arch x86/build: Treat R_386_PLT32 relocation as R_386_PC32 2021-03-07 12:34:04 +01:00
block blk-settings: align max_sectors on "logical_block_size" boundary 2021-03-04 11:38:22 +01:00
certs certs: Fix blacklist flag type confusion 2021-03-04 11:37:59 +01:00
crypto crypto: michael_mic - fix broken misalignment handling 2021-03-04 11:38:31 +01:00
Documentation mm/vmscan: restore zone_reclaim_mode ABI 2021-03-04 11:38:38 +01:00
drivers drm/virtio: use kvmalloc for large allocations 2021-03-07 12:34:04 +01:00
fs gfs2: Recursive gfs2_quota_hold in gfs2_iomap_end 2021-03-04 11:38:44 +01:00
include net_sched: fix RTNL deadlock again caused by request_module() 2021-03-04 11:38:47 +01:00
init kgdb: fix to kill breakpoints on initmem after boot 2021-03-04 11:38:46 +01:00
ipc
kernel kgdb: fix to kill breakpoints on initmem after boot 2021-03-04 11:38:46 +01:00
lib udp: fix skb_copy_and_csum_datagram with odd segment sizes 2021-02-17 11:02:28 +01:00
LICENSES
mm mm, compaction: make fast_isolate_freepages() stay within zone 2021-03-04 11:38:38 +01:00
net net_sched: fix RTNL deadlock again caused by request_module() 2021-03-04 11:38:47 +01:00
samples watch_queue: Drop references to /dev/watch_queue 2021-03-04 11:37:59 +01:00
scripts scripts/recordmcount.pl: support big endian for ARCH sh 2021-02-26 10:13:02 +01:00
security KEYS: trusted: Reserve TPM for seal and unseal operations 2021-03-04 11:38:29 +01:00
sound ASoC: siu: Fix build error by a wrong const prefix 2021-03-04 11:38:28 +01:00
tools wireguard: selftests: test multiple parallel streams 2021-03-04 11:38:47 +01:00
usr
virt KVM: Use kvm_pfn_t for local PFN variable in hva_to_pfn_remapped() 2021-02-26 10:13:01 +01:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap mailmap: add two more addresses of Uwe Kleine-König 2020-12-06 10:19:07 -08:00
COPYING
CREDITS MAINTAINERS: Move Jason Cooper to CREDITS 2020-11-30 10:20:34 +01:00
Kbuild
Kconfig
MAINTAINERS Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-12-10 15:30:13 -08:00
Makefile Linux 5.10.20 2021-03-04 11:38:47 +01:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.