<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/boot/compressed/misc.c, branch linux-3.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2015-01-20T11:37:23Z</updated>
<entry>
<title>x86, boot: Skip relocs when load address unchanged</title>
<updated>2015-01-20T11:37:23Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2015-01-16T00:51:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f285f4a21c3253887caceed493089ece17579d59'/>
<id>urn:sha1:f285f4a21c3253887caceed493089ece17579d59</id>
<content type='text'>
On 64-bit, relocation is not required unless the load address gets
changed. Without this, relocations do unexpected things when the kernel
is above 4G.

Reported-by: Baoquan He &lt;bhe@redhat.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Tested-by: Thomas D. &lt;whissi@whissi.de&gt;
Cc: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Cc: Jan Beulich &lt;JBeulich@suse.com&gt;
Cc: Junjie Mao &lt;eternal.n08@gmail.com&gt;
Cc: Andi Kleen &lt;ak@linux.intel.com&gt;
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20150116005146.GA4212@www.outflux.net
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2014-12-10T20:10:24Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2014-12-10T20:10:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b6444bd0a18eb47343e16749ce80a6ebd521f124'/>
<id>urn:sha1:b6444bd0a18eb47343e16749ce80a6ebd521f124</id>
<content type='text'>
Pull x86 boot and percpu updates from Ingo Molnar:
 "This tree contains a bootable images documentation update plus three
  slightly misplaced x86/asm percpu changes/optimizations"

* 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86-64: Use RIP-relative addressing for most per-CPU accesses
  x86-64: Handle PC-relative relocations on per-CPU data
  x86: Convert a few more per-CPU items to read-mostly ones
  x86, boot: Document intermediates more clearly
</content>
</entry>
<entry>
<title>x86-64: Handle PC-relative relocations on per-CPU data</title>
<updated>2014-11-04T19:43:14Z</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=6d24c5f72dfb26e5fa7f02fa9266dfdbae41adba'/>
<id>urn:sha1:6d24c5f72dfb26e5fa7f02fa9266dfdbae41adba</id>
<content type='text'>
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;
</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>asmlinkage, x86: Add explicit __visible to arch/x86/*</title>
<updated>2014-05-05T23:07:44Z</updated>
<author>
<name>Andi Kleen</name>
</author>
<published>2014-05-01T22:44:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2605fc216fa492f9e7c488bdc7f687cd6dcc703b'/>
<id>urn:sha1:2605fc216fa492f9e7c488bdc7f687cd6dcc703b</id>
<content type='text'>
As requested by Linus add explicit __visible to the asmlinkage users.
This marks all functions visible to assembler.

Tree sweep for arch/x86/*

Signed-off-by: Andi Kleen &lt;ak@linux.intel.com&gt;
Link: http://lkml.kernel.org/r/1398984278-29319-3-git-send-email-andi@firstfloor.org
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>x86, boot: Move memset() definition in compressed/string.c</title>
<updated>2014-03-19T22:44:09Z</updated>
<author>
<name>Vivek Goyal</name>
</author>
<published>2014-03-18T19:26:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=04999550f93234bf05597a9b7d26e2bfe27ba883'/>
<id>urn:sha1:04999550f93234bf05597a9b7d26e2bfe27ba883</id>
<content type='text'>
Currently compressed/misc.c needs to link against memset(). I think one of
the reasons of this need is inclusion of various header files which define
static inline functions and use memset() inside these. For example,
include/linux/bitmap.h

I think trying to include "../string.h" and using builtin version of memset
does not work because by the time "#define memset" shows up, it is too
late. Some other header file has already used memset() and expects to
find a definition during link phase.

Currently we have a C definitoin of memset() in misc.c. Move it to
compressed/string.c so that others can use it if need be.

Signed-off-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Link: http://lkml.kernel.org/r/1395170800-11059-6-git-send-email-vgoyal@redhat.com
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>x86, boot: Move optimized memcpy() 32/64 bit versions to compressed/string.c</title>
<updated>2014-03-19T22:43:59Z</updated>
<author>
<name>Vivek Goyal</name>
</author>
<published>2014-03-18T19:26:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=820e8feca06ff744f60e5036c3178dde40b91afc'/>
<id>urn:sha1:820e8feca06ff744f60e5036c3178dde40b91afc</id>
<content type='text'>
Move optimized versions of memcpy to compressed/string.c This will allow
any other code to use these functions too if need be in future. Again
trying to put definition in a common place instead of hiding it in misc.c

Signed-off-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Link: http://lkml.kernel.org/r/1395170800-11059-4-git-send-email-vgoyal@redhat.com
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>x86, kaslr: Select random position from e820 maps</title>
<updated>2013-10-13T10:12:19Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2013-10-11T00:18:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=82fa9637a2ba285bcc7c5050c73010b2c1b3d803'/>
<id>urn:sha1:82fa9637a2ba285bcc7c5050c73010b2c1b3d803</id>
<content type='text'>
Counts available alignment positions across all e820 maps, and chooses
one randomly for the new kernel base address, making sure not to collide
with unsafe memory areas.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: http://lkml.kernel.org/r/1381450698-28710-5-git-send-email-keescook@chromium.org
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>x86, kaslr: Return location from decompress_kernel</title>
<updated>2013-10-13T10:12:07Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2013-10-11T00:18:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8ab3820fd5b2896d66da7bb2a906bc382e63e7bc'/>
<id>urn:sha1:8ab3820fd5b2896d66da7bb2a906bc382e63e7bc</id>
<content type='text'>
This allows decompress_kernel to return a new location for the kernel to
be relocated to. Additionally, enforces CONFIG_PHYSICAL_START as the
minimum relocation position when building with CONFIG_RELOCATABLE.

With CONFIG_RANDOMIZE_BASE set, the choose_kernel_location routine
will select a new location to decompress the kernel, though here it is
presently a no-op. The kernel command line option "nokaslr" is introduced
to bypass these routines.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: http://lkml.kernel.org/r/1381450698-28710-3-git-send-email-keescook@chromium.org
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>x86, relocs: Move ELF relocation handling to C</title>
<updated>2013-08-08T04:00:04Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2013-07-08T16:15:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a02150610776f66b40257624822a879311592bb2'/>
<id>urn:sha1:a02150610776f66b40257624822a879311592bb2</id>
<content type='text'>
Moves the relocation handling into C, after decompression. This requires
that the decompressed size is passed to the decompression routine as
well so that relocations can be found. Only kernels that need relocation
support will use the code (currently just x86_32), but this is laying
the ground work for 64-bit using it in support of KASLR.

Based on work by Neill Clift and Michael Davidson.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: http://lkml.kernel.org/r/20130708161517.GA4832@www.outflux.net
Acked-by: Zhang Yanfei &lt;zhangyanfei@cn.fujitsu.com&gt;
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
</feed>
