<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/tools, branch linux-3.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-03-18T10:15:44Z</updated>
<entry>
<title>x86: Treat R_X86_64_PLT32 as R_X86_64_PC32</title>
<updated>2018-03-18T10:15:44Z</updated>
<author>
<name>H.J. Lu</name>
</author>
<published>2018-02-07T22:20:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=12d839211d080f6a9c370398c41a260365d34c62'/>
<id>urn:sha1:12d839211d080f6a9c370398c41a260365d34c62</id>
<content type='text'>
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 &lt;hjl.tools@gmail.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Matthias Kaehlcke &lt;mka@chromium.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>x86/tools: Fix gcc-7 warning in relocs.c</title>
<updated>2017-09-02T05:05:46Z</updated>
<author>
<name>Markus Trippelsdorf</name>
</author>
<published>2016-12-15T12:45:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b82e2aa8aaa7642bc5ca01e839b4e5881f067d05'/>
<id>urn:sha1:b82e2aa8aaa7642bc5ca01e839b4e5881f067d05</id>
<content type='text'>
commit 7ebb916782949621ff6819acf373a06902df7679 upstream.

gcc-7 warns:

In file included from arch/x86/tools/relocs_64.c:17:0:
arch/x86/tools/relocs.c: In function ‘process_64’:
arch/x86/tools/relocs.c:953:2: warning: argument 1 null where non-null expected [-Wnonnull]
  qsort(r-&gt;offset, r-&gt;count, sizeof(r-&gt;offset[0]), cmp_relocs);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/x86/tools/relocs.h:6:0,
                 from arch/x86/tools/relocs_64.c:1:
/usr/include/stdlib.h:741:13: note: in a call to function ‘qsort’ declared here
 extern void qsort

This happens because relocs16 is not used for ELF_BITS == 64,
so there is no point in trying to sort it.

Make the sort_relocs(&amp;relocs16) call 32bit only.

Signed-off-by: Markus Trippelsdorf &lt;markus@trippelsdorf.de&gt;
Link: http://lkml.kernel.org/r/20161215124513.GA289@x4
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>x86-64: Handle PC-relative relocations on per-CPU data</title>
<updated>2017-09-02T05:05:46Z</updated>
<author>
<name>Jan Beulich</name>
</author>
<published>2014-11-04T08:50:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=edb9d2d5e647e7a8521b0d35f8452deb02dfd138'/>
<id>urn:sha1:edb9d2d5e647e7a8521b0d35f8452deb02dfd138</id>
<content type='text'>
commit 6d24c5f72dfb26e5fa7f02fa9266dfdbae41adba upstream.

This is in preparation of using RIP-relative addressing in many of the
per-CPU accesses.

Signed-off-by: Jan Beulich &lt;jbeulich@suse.com&gt;
Link: http://lkml.kernel.org/r/5458A15A0200007800044A9A@mail.emea.novell.com
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>x86, build: replace Perl script with Shell script</title>
<updated>2015-02-06T06:36:00Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2015-01-26T20:58:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=179ac907a28e4d890314757f921880121642e3e5'/>
<id>urn:sha1:179ac907a28e4d890314757f921880121642e3e5</id>
<content type='text'>
commit d69911a68c865b152a067feaa45e98e6bb0f655b upstream.

Commit e6023367d779 ("x86, kaslr: Prevent .bss from overlaping initrd")
added Perl to the required build environment.  This reimplements in
shell the Perl script used to find the size of the kernel with bss and
brk added.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Reported-by: Rob Landley &lt;rob@landley.net&gt;
Acked-by: Rob Landley &lt;rob@landley.net&gt;
Cc: Anca Emanuel &lt;anca.emanuel@gmail.com&gt;
Cc: Fengguang Wu &lt;fengguang.wu@intel.com&gt;
Cc: Junjie Mao &lt;eternal.n08@gmail.com&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>x86, kaslr: Handle Gold linker for finding bss/brk</title>
<updated>2014-11-18T17:32:24Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2014-11-18T00:16:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=70b61e362187b5fccac206506d402f3424e3e749'/>
<id>urn:sha1:70b61e362187b5fccac206506d402f3424e3e749</id>
<content type='text'>
When building with the Gold linker, the .bss and .brk areas of vmlinux
are shown as consecutive instead of having the same file offset. Allow
for either state, as long as things add up correctly.

Fixes: e6023367d779 ("x86, kaslr: Prevent .bss from overlaping initrd")
Reported-by: Markus Trippelsdorf &lt;markus@trippelsdorf.de&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Junjie Mao &lt;eternal.n08@gmail.com&gt;
Link: http://lkml.kernel.org/r/20141118001604.GA25045@www.outflux.net
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>x86, kaslr: Prevent .bss from overlaping initrd</title>
<updated>2014-11-01T21:20:50Z</updated>
<author>
<name>Junjie Mao</name>
</author>
<published>2014-10-31T13:40:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e6023367d779060fddc9a52d1f474085b2b36298'/>
<id>urn:sha1:e6023367d779060fddc9a52d1f474085b2b36298</id>
<content type='text'>
When choosing a random address, the current implementation does not take into
account the reversed space for .bss and .brk sections. Thus the relocated kernel
may overlap other components in memory. Here is an example of the overlap from a
x86_64 kernel in qemu (the ranges of physical addresses are presented):

 Physical Address

    0x0fe00000                  --+--------------------+  &lt;-- randomized base
                               /  |  relocated kernel  |
                   vmlinux.bin    | (from vmlinux.bin) |
    0x1336d000    (an ELF file)   +--------------------+--
                               \  |                    |  \
    0x1376d870                  --+--------------------+   |
                                  |    relocs table    |   |
    0x13c1c2a8                    +--------------------+   .bss and .brk
                                  |                    |   |
    0x13ce6000                    +--------------------+   |
                                  |                    |  /
    0x13f77000                    |       initrd       |--
                                  |                    |
    0x13fef374                    +--------------------+

The initrd image will then be overwritten by the memset during early
initialization:

[    1.655204] Unpacking initramfs...
[    1.662831] Initramfs unpacking failed: junk in compressed archive

This patch prevents the above situation by requiring a larger space when looking
for a random kernel base, so that existing logic can effectively avoids the
overlap.

[kees: switched to perl to avoid hex translation pain in mawk vs gawk]
[kees: calculated overlap without relocs table]

Fixes: 82fa9637a2 ("x86, kaslr: Select random position from e820 maps")
Reported-by: Fengguang Wu &lt;fengguang.wu@intel.com&gt;
Signed-off-by: Junjie Mao &lt;eternal.n08@gmail.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Josh Triplett &lt;josh@joshtriplett.org&gt;
Cc: Matt Fleming &lt;matt.fleming@intel.com&gt;
Cc: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Cc: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Cc: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/1414762838-13067-1-git-send-email-eternal.n08@gmail.com
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>x86/relocs: Make per_cpu_load_addr static</title>
<updated>2014-09-24T13:17:47Z</updated>
<author>
<name>Ben Hutchings</name>
</author>
<published>2014-09-24T12:30:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eeeda4cd06e828b331b15741a204ff9f5874d28d'/>
<id>urn:sha1:eeeda4cd06e828b331b15741a204ff9f5874d28d</id>
<content type='text'>
per_cpu_load_addr is only used for 64-bit relocations, but is
declared in both configurations of relocs.c - with different
types.  This has undefined behaviour in general.  GNU ld is
documented to use the larger size in this case, but other tools
may differ and some warn about this.

References: https://bugs.debian.org/748577
Reported-by: Michael Tautschnig &lt;mt@debian.org&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Cc: 748577@bugs.debian.org
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Link: http://lkml.kernel.org/r/1411561812.3659.23.camel@decadent.org.uk
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>x86/build: Supress "Nothing to be done for ..." messages</title>
<updated>2014-04-14T09:44:36Z</updated>
<author>
<name>Masahiro Yamada</name>
</author>
<published>2014-04-10T01:35:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e6bcd1a8974fab74e9fd679fb64462b2a8deff41'/>
<id>urn:sha1:e6bcd1a8974fab74e9fd679fb64462b2a8deff41</id>
<content type='text'>
When we build an already built kernel again, arch/x86/syscalls/Makefile
and arch/x86/tools/Makefile emits "Nothing to be done for ..."
messages.

Here is the command log:

  $ make defconfig
     [ snip ]
  $ make
     [ snip ]
  $ make
  make[1]: Nothing to be done for `all'.            &lt;-----
  make[1]: Nothing to be done for `relocs'.         &lt;-----
    CHK     include/config/kernel.release
    CHK     include/generated/uapi/linux/version.h

Besides not emitting those, "all" and "relocs" should be added to PHONY as well.

Signed-off-by: Masahiro Yamada &lt;yamada.m@jp.panasonic.com&gt;
Acked-by: Peter Foley &lt;pefoley2@pefoley.com&gt;
Acked-by: Michal Marek &lt;mmarek@suse.cz&gt;
Link: http://lkml.kernel.org/r/1397093742-11144-1-git-send-email-yamada.m@jp.panasonic.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>x86, vdso: Make vsyscall_gtod_data handling x86 generic</title>
<updated>2014-03-18T19:51:52Z</updated>
<author>
<name>Stefani Seibold</name>
</author>
<published>2014-03-17T22:22:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d2312e3379d581d2c3603357a0181046448e1de3'/>
<id>urn:sha1:d2312e3379d581d2c3603357a0181046448e1de3</id>
<content type='text'>
This patch move the vsyscall_gtod_data handling out of vsyscall_64.c
into an additonal file vsyscall_gtod.c to make the functionality
available for x86 32 bit kernel.

It also adds a new vsyscall_32.c which setup the VVAR page.

Reviewed-by: Andy Lutomirski &lt;luto@amacapital.net&gt;
Signed-off-by: Stefani Seibold &lt;stefani@seibold.net&gt;
Link: http://lkml.kernel.org/r/1395094933-14252-2-git-send-email-stefani@seibold.net
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>Merge commit 'f4bcd8ccddb02833340652e9f46f5127828eb79d' into x86/build</title>
<updated>2014-01-29T17:07:00Z</updated>
<author>
<name>H. Peter Anvin</name>
</author>
<published>2014-01-29T17:07:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4064e0ea3c0e9427e6c22392c4b69b4bfa1b7125'/>
<id>urn:sha1:4064e0ea3c0e9427e6c22392c4b69b4bfa1b7125</id>
<content type='text'>
Bring in upstream merge of x86/kaslr for future patches.

Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
</feed>
