28 Nov, 2016

1 commit

  • Fixes below warning with clang:

    In file included from ../arch/x86/tools/relocs_64.c:17:
    ../arch/x86/tools/relocs.c:977:6: warning: variable 'do_reloc' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

    Signed-off-by: Peter Foley
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20161126222229.673-1-pefoley2@pefoley.com
    Signed-off-by: Ingo Molnar

    Peter Foley
     

21 Jul, 2016

1 commit

  • Add support for Intel's AVX-512 instructions to the instruction decoder.

    AVX-512 instructions are documented in Intel Architecture Instruction
    Set Extensions Programming Reference (February 2016).

    AVX-512 instructions are identified by a EVEX prefix which, for the
    purpose of instruction decoding, can be treated as though it were a
    4-byte VEX prefix.

    Existing instructions which can now accept an EVEX prefix need not be
    further annotated in the op code map (x86-opcode-map.txt). In the case
    of new instructions, the op code map is updated accordingly.

    Also add associated Mask Instructions that are used to manipulate mask
    registers used in AVX-512 instructions.

    The 'perf tools' instruction decoder is updated in a subsequent patch.
    And a representative set of instructions is added to the perf tools new
    instructions test in a subsequent patch.

    Signed-off-by: Adrian Hunter
    Acked-by: Ingo Molnar
    Acked-by: Masami Hiramatsu
    Cc: Andy Lutomirski
    Cc: Dan Williams
    Cc: H. Peter Anvin
    Cc: Jiri Olsa
    Cc: Thomas Gleixner
    Cc: X86 ML
    Link: http://lkml.kernel.org/r/1469003437-32706-3-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

29 Apr, 2016

1 commit

  • Since 'run_size' is now calculated in misc.c, the old script and associated
    argument passing is no longer needed. This patch removes them, and renames
    'run_size' to the more descriptive 'kernel_total_size'.

    Signed-off-by: Yinghai Lu
    Signed-off-by: Baoquan He
    [ Rewrote the changelog, renamed 'run_size' to 'kernel_total_size' ]
    Signed-off-by: Kees Cook
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Andy Lutomirski
    Cc: Ard Biesheuvel
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Dave Young
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Triplett
    Cc: Junjie Mao
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Vivek Goyal
    Cc: lasse.collin@tukaani.org
    Link: http://lkml.kernel.org/r/1461888548-32439-6-git-send-email-keescook@chromium.org
    Signed-off-by: Ingo Molnar

    Yinghai Lu
     

27 Jan, 2015

1 commit

  • 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
    Reported-by: Rob Landley
    Acked-by: Rob Landley
    Cc: Anca Emanuel
    Cc: Fengguang Wu
    Cc: Junjie Mao
    Cc: Kees Cook
    Cc: Thomas Gleixner
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     

11 Dec, 2014

2 commits

  • 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

    Linus Torvalds
     
  • Pull x86 MPX support from Thomas Gleixner:
    "This enables support for x86 MPX.

    MPX is a new debug feature for bound checking in user space. It
    requires kernel support to handle the bound tables and decode the
    bound violating instruction in the trap handler"

    * 'x86-mpx-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    asm-generic: Remove asm-generic arch_bprm_mm_init()
    mm: Make arch_unmap()/bprm_mm_init() available to all architectures
    x86: Cleanly separate use of asm-generic/mm_hooks.h
    x86 mpx: Change return type of get_reg_offset()
    fs: Do not include mpx.h in exec.c
    x86, mpx: Add documentation on Intel MPX
    x86, mpx: Cleanup unused bound tables
    x86, mpx: On-demand kernel allocation of bounds tables
    x86, mpx: Decode MPX instruction to get bound violation information
    x86, mpx: Add MPX-specific mmap interface
    x86, mpx: Introduce VM_MPX to indicate that a VMA is MPX specific
    x86, mpx: Add MPX to disabled features
    ia64: Sync struct siginfo with general version
    mips: Sync struct siginfo with general version
    mpx: Extend siginfo structure to include bound violation information
    x86, mpx: Rename cfg_reg_u and status_reg
    x86: mpx: Give bndX registers actual names
    x86: Remove arbitrary instruction size limit in instruction decoder

    Linus Torvalds
     

19 Nov, 2014

1 commit

  • 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
    Signed-off-by: Kees Cook
    Cc: Junjie Mao
    Link: http://lkml.kernel.org/r/20141118001604.GA25045@www.outflux.net
    Cc: stable@vger.kernel.org
    Signed-off-by: Thomas Gleixner

    Kees Cook
     

18 Nov, 2014

1 commit

  • The current x86 instruction decoder steps along through the
    instruction stream but always ensures that it never steps farther
    than the largest possible instruction size (MAX_INSN_SIZE).

    The MPX code is now going to be doing some decoding of userspace
    instructions. We copy those from userspace in to the kernel and
    they're obviously completely untrusted coming from userspace. In
    addition to the constraint that instructions can only be so long,
    we also have to be aware of how long the buffer is that came in
    from userspace. This _looks_ to be similar to what the perf and
    kprobes is doing, but it's unclear to me whether they are
    affected.

    The whole reason we need this is that it is perfectly valid to be
    executing an instruction within MAX_INSN_SIZE bytes of an
    unreadable page. We should be able to gracefully handle short
    reads in those cases.

    This adds support to the decoder to record how long the buffer
    being decoded is and to refuse to "validate" the instruction if
    we would have gone over the end of the buffer to decode it.

    The kprobes code probably needs to be looked at here a bit more
    carefully. This patch still respects the MAX_INSN_SIZE limit
    there but the kprobes code does look like it might be able to
    be a bit more strict than it currently is.

    Signed-off-by: Dave Hansen
    Acked-by: Jim Keniston
    Acked-by: Masami Hiramatsu
    Cc: x86@kernel.org
    Cc: Peter Zijlstra
    Cc: Paul Mackerras
    Cc: Arnaldo Carvalho de Melo
    Cc: Srikar Dronamraju
    Cc: Ananth N Mavinakayanahalli
    Cc: Anil S Keshavamurthy
    Cc: "David S. Miller"
    Link: http://lkml.kernel.org/r/20141114153957.E6B01535@viggo.jf.intel.com
    Signed-off-by: Thomas Gleixner

    Dave Hansen
     

05 Nov, 2014

1 commit


02 Nov, 2014

1 commit

  • 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 --+--------------------+
    Signed-off-by: Junjie Mao
    Signed-off-by: Kees Cook
    Cc: Josh Triplett
    Cc: Matt Fleming
    Cc: Ard Biesheuvel
    Cc: Vivek Goyal
    Cc: Andi Kleen
    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

    Junjie Mao
     

24 Sep, 2014

1 commit

  • 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
    Signed-off-by: Ben Hutchings
    Cc: 748577@bugs.debian.org
    Cc: Linus Torvalds
    Link: http://lkml.kernel.org/r/1411561812.3659.23.camel@decadent.org.uk
    Signed-off-by: Ingo Molnar

    Ben Hutchings
     

14 Apr, 2014

1 commit

  • 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'.
    Acked-by: Peter Foley
    Acked-by: Michal Marek
    Link: http://lkml.kernel.org/r/1397093742-11144-1-git-send-email-yamada.m@jp.panasonic.com
    Signed-off-by: Ingo Molnar

    Masahiro Yamada
     

19 Mar, 2014

1 commit

  • 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
    Signed-off-by: Stefani Seibold
    Link: http://lkml.kernel.org/r/1395094933-14252-2-git-send-email-stefani@seibold.net
    Signed-off-by: H. Peter Anvin

    Stefani Seibold
     

30 Jan, 2014

1 commit


22 Jan, 2014

1 commit

  • Improve the debuggability of relocations output. When trying to compare
    the output between different linkers, it's handy to be able to see the
    section names in output.

    Signed-off-by: Michael Davidson
    Link: http://lkml.kernel.org/r/20140121203223.GA12649@www.outflux.net
    Signed-off-by: Kees Cook
    Signed-off-by: H. Peter Anvin

    Michael Davidson
     

18 Oct, 2013

1 commit

  • The GNU linker tries to put __per_cpu_load into the percpu area,
    resulting in a lack of its relocation. Force this symbol to be
    relocated. Seen starting with GNU ld 2.23 and later.

    Reported-by: Ingo Molnar
    Signed-off-by: Kees Cook
    Cc: Michael Davidson
    Cc: Cong Ding
    Link: http://lkml.kernel.org/r/20131016064314.GA2739@www.outflux.net
    Signed-off-by: Ingo Molnar

    Kees Cook
     

13 Oct, 2013

1 commit

  • The "gold" linker doesn't seem to put some additional per-cpu cases in
    the right place. Add these to the per-cpu check. Without this, the kASLR
    patch series fails to correctly apply relocations, and fails to boot.

    Signed-off-by: Michael Davidson
    Signed-off-by: Kees Cook
    Link: http://lkml.kernel.org/r/20131011013954.GA28902@www.outflux.net
    Signed-off-by: H. Peter Anvin

    Michael Davidson
     

04 Sep, 2013

1 commit

  • Pull x86/asm changes from Ingo Molnar:
    "Main changes:

    - Apply low level mutex optimization on x86-64, by Wedson Almeida
    Filho.

    - Change bitops to be naturally 'long', by H Peter Anvin.

    - Add TSX-NI opcodes support to the x86 (instrumentation) decoder, by
    Masami Hiramatsu.

    - Add clang compatibility adjustments/workarounds, by Jan-Simon
    Möller"

    * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86, doc: Update uaccess.h comment to reflect clang changes
    x86, asm: Fix a compilation issue with clang
    x86, asm: Extend definitions of _ASM_* with a raw format
    x86, insn: Add new opcodes as of June, 2013
    x86/ia32/asm: Remove unused argument in macro
    x86, bitops: Change bitops to be native operand size
    x86: Use asm-goto to implement mutex fast path on x86-64

    Linus Torvalds
     

06 Aug, 2013

1 commit

  • Add TSX-NI related instructions and new instructions to
    x86-opcode-map.txt according to the Intel(R) 64 and IA-32
    Architectures Software Developer's Manual Vol2C (June, 2013).
    This also includes below updates.
    - Fix a typo of MWAIT (the lack of (11B)).
    - Change NOP Ev to prefetchw Ev
    - Add CRC32 new prefix style (66&F2)
    - Add ADCX, ADOX, RDSEED, CLAC and STAC instructions

    Signed-off-by: Masami Hiramatsu
    Link: http://lkml.kernel.org/r/20130806073750.4049.12365.stgit@udc4-manage.rcp.hitachi.co.jp
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Signed-off-by: H. Peter Anvin

    Masami Hiramatsu
     

13 Jun, 2013

1 commit

  • The __vvar_page relocation should actually be listed in S_REL instead
    of S_ABS. Oddly, this didn't always cause things to break, presumably
    because there are no users for relocation information on 64 bits yet.

    [ hpa: Not for stable - new code in 3.10 ]

    Signed-off-by: Kees Cook
    Link: http://lkml.kernel.org/r/20130611185652.GA23674@www.outflux.net
    Reported-by: Michael Davidson
    Signed-off-by: H. Peter Anvin

    Kees Cook
     

17 Apr, 2013

5 commits

  • Refactor the relocs tool so that the same tool can handle 32- and
    64-bit ELF.

    Signed-off-by: H. Peter Anvin
    Cc: Kees Cook
    Link: http://lkml.kernel.org/r/1365797627-20874-5-git-send-email-keescook@chromium.org

    H. Peter Anvin
     
  • Since the ELF structures and access macros change size based on 32 vs
    64 bits, build a separate 32-bit relocs tool (for handling realmode
    and 32-bit relocations), and a 64-bit relocs tool (for handling 64-bit
    kernel relocations).

    Signed-off-by: Kees Cook
    Link: http://lkml.kernel.org/r/1365797627-20874-5-git-send-email-keescook@chromium.org
    Signed-off-by: H. Peter Anvin

    Kees Cook
     
  • This adds the ability to process relocations from the 64-bit kernel ELF,
    if built with ELF_BITS=64 defined. The special case for the percpu area is
    handled, along with some other symbols specific to the 64-bit kernel.

    Based on work by Neill Clift and Michael Davidson.

    Signed-off-by: Kees Cook
    Link: http://lkml.kernel.org/r/1365797627-20874-4-git-send-email-keescook@chromium.org
    Signed-off-by: H. Peter Anvin

    Kees Cook
     
  • Instead of counting and then processing relocations, do it in a single
    pass. This splits the processing logic into separate functions for
    realmode and 32-bit (and paves the way for 64-bit). Also extracts helper
    functions when emitting relocations.

    Based on work by Neill Clift and Michael Davidson.

    Signed-off-by: Kees Cook
    Link: http://lkml.kernel.org/r/1365797627-20874-3-git-send-email-keescook@chromium.org
    Signed-off-by: H. Peter Anvin

    Kees Cook
     
  • In preparation for making the reloc tool operate on 64-bit relocations,
    generalize the structure names for easy recompilation via #defines.

    Based on work by Neill Clift and Michael Davidson.

    Signed-off-by: Kees Cook
    Link: http://lkml.kernel.org/r/1365797627-20874-2-git-send-email-keescook@chromium.org
    Signed-off-by: H. Peter Anvin

    Kees Cook
     

05 Feb, 2013

1 commit


28 Jan, 2013

1 commit


24 Jan, 2013

1 commit

  • The kernel build prints:

    Building modules, stage 2.
    TEST posttest
    MODPOST 3821 modules
    TEST posttest
    Success: decoded and checked 1000000 random instructions with 0
    errors (seed:0xaac4bc47) CC arch/x86/boot/a20.o
    CC arch/x86/boot/cmdline.o
    AS arch/x86/boot/copy.o
    HOSTCC arch/x86/boot/mkcpustr
    CC arch/x86/boot/cpucheck.o
    CC arch/x86/boot/early_serial_console.o

    which is irritating because you don't know what program is
    proudly pronouncing its success.

    So, as described in "console mode programming user interface
    guidelines version 101" which doesn't exist, change this program
    to identify the source of its messages.

    Signed-off-by: Andrew Morton
    Cc: "H. Peter Anvin"
    Cc: Masami Hiramatsu
    Signed-off-by: Ingo Molnar

    Andrew Morton
     

11 Dec, 2012

1 commit

  • The original version code causes following sparse warnings:
    arch/x86/lib/inat-tables.c:1080:25: warning: duplicate const
    arch/x86/lib/inat-tables.c:1095:25: warning: duplicate const
    arch/x86/lib/inat-tables.c:1118:25: warning: duplicate const

    for the variables inat_escape_tables, inat_group_tables, and inat_avx_tables
    in the code generated by gen-insn-attr-x86.awk.

    The author Masami Hiramutsu says here is to make both the value pointed by the
    pointers and the pointers itself read-only, so we move the "const" to be after
    the "*".

    Signed-off-by: Cong Ding
    Link: http://lkml.kernel.org/r/20121209082103.GA9181@gmail.com
    Acked-by: Masami Hiramatsu
    Signed-off-by: H. Peter Anvin

    Cong Ding
     

03 Oct, 2012

1 commit

  • Fix the x86 test_get_len tool to have the right include paths in the right
    order (it includes a non-exported kernel header directly), otherwise errors
    like the following occur:

    /data/fs/linux-2.6-hdr/include/linux/types.h:18:26: error: conflicting types for 'fd_set'
    /usr/include/sys/select.h:78:5: note: previous declaration of 'fd_set' was here

    and

    /data/fs/linux-2.6-hdr/include/linux/string.h:42:12: error: expected identifier or '(' before '__extension__'

    Signed-off-by: David Howells
    Acked-by: Arnd Bergmann
    Acked-by: Thomas Gleixner
    Acked-by: Paul E. McKenney
    Acked-by: Dave Jones

    David Howells
     

06 Jun, 2012

1 commit

  • Fix the x86 instruction decoder to decode bsr/bsf/jmpe with
    operand-size prefix (66h). This fixes the test case failure
    reported by Linus, attached below.

    bsf/bsr/jmpe have a special encoding. Opcode map in
    Intel Software Developers Manual vol2 says they have
    TZCNT/LZCNT variants if it has F3h prefix. However, there
    is no information if it has other 66h or F2h prefixes.
    Current instruction decoder supposes that those are
    bad instructions, but it actually accepts at least
    operand-size prefixes.

    H. Peter Anvin further explains:

    " TZCNT/LZCNT are F3 + BSF/BSR exactly because the F2 and
    F3 prefixes have historically been no-ops with most instructions.
    This allows software to unconditionally use the prefixed versions
    and get TZCNT/LZCNT on the processors that have them if they don't
    care about the difference. "

    This fixes errors reported by test_get_len:

    Warning: arch/x86/tools/test_get_len found difference at :ffffffff81036d87
    Warning: ffffffff81036de5: 66 0f bc c2 bsf %dx,%ax
    Warning: objdump says 4 bytes, but insn_get_length() says 3
    Warning: arch/x86/tools/test_get_len found difference at :ffffffff81036ea6
    Warning: ffffffff81036f04: 66 0f bd c2 bsr %dx,%ax
    Warning: objdump says 4 bytes, but insn_get_length() says 3
    Warning: decoded and checked 13298882 instructions with 2 warnings

    Reported-by: Linus Torvalds
    Reported-by: Pekka Enberg
    Signed-off-by: Masami Hiramatsu
    Cc: "H. Peter Anvin"
    Cc:
    Link: http://lkml.kernel.org/r/20120604150911.22338.43296.stgit@localhost.localdomain
    Signed-off-by: Ingo Molnar

    Masami Hiramatsu
     

30 May, 2012

1 commit

  • Pull x86 trampoline rework from H. Peter Anvin:
    "This code reworks all the "trampoline"/"realmode" code (various bits
    that need to live in the first megabyte of memory, most but not all of
    which runs in real mode at some point) in the kernel into a single
    object. The main reason for doing this is that it eliminates the last
    place in the kernel where we needed pages to be mapped RWX. This code
    separates all that code into proper R/RW/RX pages."

    Fix up conflicts in arch/x86/kernel/Makefile (mca removed next to reboot
    code), and arch/x86/kernel/reboot.c (reboot code moved around in one
    branch, modified in this one), and arch/x86/tools/relocs.c (mostly same
    code came in earlier due to working around the ld bugs just before the
    3.4 release).

    Also remove stale x86-relocs entry from scripts/.gitignore as per Peter
    Anvin.

    * commit '61f5446169046c217a5479517edac3a890c3bee7': (36 commits)
    x86, realmode: Move end signature into header.S
    x86, relocs: When printing an error, say relative or absolute
    x86, relocs: More relocations which may end up as absolute
    x86, relocs: Workaround for binutils 2.22.52.0.1 section bug
    xen-acpi-processor: Add missing #include
    acpi, bgrd: Add missing to drivers/acpi/bgrt.c
    x86, realmode: Change EFER to a single u64 field
    x86, realmode: Move kernel/realmode.c to realmode/init.c
    x86, realmode: Move not-common bits out of trampoline_common.S
    x86, realmode: Mask out EFER.LMA when saving trampoline EFER
    x86, realmode: Fix no cache bits test in reboot_32.S
    x86, realmode: Make sure all generated files are listed in targets
    x86, realmode: build fix: remove duplicate build
    x86, realmode: read cr4 and EFER from kernel for 64-bit trampoline
    x86, realmode: fixes compilation issue in tboot.c
    x86, realmode: move relocs from scripts/ to arch/x86/tools
    x86, realmode: header for trampoline code
    x86, realmode: flattened rm hierachy
    x86, realmode: don't copy real_mode_header
    x86, realmode: fix 64-bit wakeup sequence
    ...

    Linus Torvalds
     

24 May, 2012

2 commits

  • The symbol jiffies is created in the linker script as an alias to
    jiffies_64. Unfortunately this is done outside any section, and
    apparently GNU ld 2.21 doesn't carry the section with it, so we end up
    with an absolute symbol and therefore a broken kernel.

    Add jiffies and jiffies_64 to the whitelist.

    The most disturbing bit with this discovery is that it shows that we
    have had multiple linker bugs in this area crossing multiple
    generations, and have been silently building bad kernels for some time.

    Link: http://lkml.kernel.org/r/20120524171604.0d98284f3affc643e9714470@canb.auug.org.au
    Reported-by: Stephen Rothwell
    Signed-off-by: H. Peter Anvin
    Cc: v3.4

    H. Peter Anvin
     
  • As noted in checkin:

    a3e854d95 x86, relocs: Workaround for binutils 2.22.52.0.1 section bug

    ld version 2.22.52.0.[12] can incorrectly promote relative symbols to
    absolute, if the output section they appear in is otherwise empty.

    Since checkin:

    6520fe55 x86, realmode: 16-bit real-mode code support for relocs tool

    we actually check for this and error out rather than silently creating
    a kernel which will malfunction if relocated.

    Ingo found a configuration in which __start_builtin_fw triggered the
    warning.

    Go through the linker script sources and look for more symbols that
    could plausibly get bogusly promoted to absolute, and add them to the
    whitelist.

    In general, if the following error triggers:

    Invalid absolute R_386_32 relocation:

    ... then we should verify that is really meant to be
    relocated, and add it and any related symbols manually to the S_REL
    regexp.

    Please note that 6520fe55 does not introduce the error, only the check
    for the error -- without 6520fe55 this version of ld will simply
    produce a corrupt kernel if CONFIG_RELOCATABLE is set on x86-32.

    Reported-by: Ingo Molnar
    Signed-off-by: H. Peter Anvin
    Cc: v3.4

    H. Peter Anvin
     

19 May, 2012

4 commits

  • When the relocs tool throws an error, let the error message say if it
    is an absolute or relative symbol. This should make it a lot more
    clear what action the programmer needs to take and should help us find
    the reason if additional symbol bugs show up.

    Signed-off-by: H. Peter Anvin
    Cc:

    H. Peter Anvin
     
  • GNU ld 2.22.52.0.1 has a bug that it blindly changes symbols from
    section-relative to absolute if they are in a section of zero length.
    This turns the symbols __init_begin and __init_end into absolute
    symbols. Let the relocs program know that those should be treated as
    relative symbols.

    Reported-by: Ingo Molnar
    Signed-off-by: H. Peter Anvin
    Cc: H.J. Lu
    Cc:
    Cc: Jarkko Sakkinen

    H. Peter Anvin
     
  • A new option is added to the relocs tool called '--realmode'.
    This option causes the generation of 16-bit segment relocations
    and 32-bit linear relocations for the real-mode code. When
    the real-mode code is moved to the low-memory during kernel
    initialization, these relocation entries can be used to
    relocate the code properly.

    In the assembly code 16-bit segment relocations must be relative
    to the 'real_mode_seg' absolute symbol. Linear relocations must be
    relative to a symbol prefixed with 'pa_'.

    16-bit segment relocation is used to load cs:ip in 16-bit code.
    Linear relocations are used in the 32-bit code for relocatable
    data references. They are declared in the linker script of the
    real-mode code.

    The relocs tool is moved to arch/x86/tools/relocs.c, and added new
    target archscripts that can be used to build scripts needed building
    an architecture. be compiled before building the arch/x86 tree.

    [ hpa: accelerating this because it detects invalid absolute
    relocations, a serious bug in binutils 2.22.52.0.x which currently
    produces bad kernels. ]

    Signed-off-by: H. Peter Anvin
    Link: http://lkml.kernel.org/r/1336501366-28617-2-git-send-email-jarkko.sakkinen@intel.com
    Signed-off-by: Jarkko Sakkinen
    Signed-off-by: H. Peter Anvin
    Cc:

    H. Peter Anvin
     
  • When the relocs tool throws an error, let the error message say if it
    is an absolute or relative symbol. This should make it a lot more
    clear what action the programmer needs to take.

    Signed-off-by: H. Peter Anvin

    H. Peter Anvin
     

18 May, 2012

2 commits

  • GNU ld 2.22.52.0.1 has a bug that it blindly changes symbols from
    section-relative to absolute if they are in a section of zero length.
    This turns the symbols __init_begin and __init_end into absolute
    symbols. Let the relocs program know that those should be treated as
    relative symbols.

    This bug is exposed by checkin

    433de739bbc2 x86, realmode: 16-bit real-mode code support for relocs tool

    only in the sense that that checkin changes the relocs tool to report
    an error instead of silently generating a kernel which is broken if
    relocated.

    Reported-by: Ingo Molnar
    Signed-off-by: H. Peter Anvin
    Cc: H.J. Lu
    Cc: Jarkko Sakkinen

    H. Peter Anvin
     
  • GNU ld 2.22.52.0.1 has a bug that it blindly changes symbols from
    section-relative to absolute if they are in a section of zero length.
    This turns the symbols __init_begin and __init_end into absolute
    symbols. Let the relocs program know that those should be treated as
    relative symbols.

    Reported-by: Ingo Molnar
    Signed-off-by: H. Peter Anvin
    Cc: H.J. Lu

    H. Peter Anvin