1. 10 8月, 2017 1 次提交
  2. 14 6月, 2017 3 次提交
  3. 12 6月, 2017 1 次提交
  4. 30 5月, 2017 1 次提交
    • N
      powerpc: Link warning for orphan sections · 83a092cf
      Nicholas Piggin 提交于
      Add --orphan-handling=warn to final link flags. This ensures we can
      handle all sections explicitly. This would have caught subtle breakage
      such as 7de3b27b at build-time.
      
      Also bring existing orphan sections into the fold:
      - .text.hot and .text.unlikely are compiler generated sections.
      - .sdata2, .dynsbss, .plt are used by PPC32
      - We previously did not specify DWARF_DEBUG or STABS_DEBUG
      - DWARF_DEBUG did not include all DWARF sections that can be emitted
      - A number of sections are unused and can be discarded.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      83a092cf
  5. 20 4月, 2017 1 次提交
    • L
      ACPI/IORT: Remove linker section for IORT entries probing · 316ca880
      Lorenzo Pieralisi 提交于
      The IORT linker section introduced by commit 34ceea27
      ("ACPI/IORT: Introduce linker section for IORT entries probing")
      was needed to make sure SMMU drivers are registered (and therefore
      probed) in the kernel before devices using the SMMU have a chance
      to probe in turn.
      
      Through the introduction of deferred IOMMU configuration the linker
      section based IORT probing infrastructure is not needed any longer, in
      that device/SMMU probe dependencies are managed through the probe
      deferral mechanism, making the IORT linker section infrastructure
      unused, so that it can be removed.
      
      Remove the unused IORT linker section probing infrastructure
      from the kernel to complete the ACPI IORT IOMMU configure probe
      deferral mechanism implementation.
      Tested-by: NHanjun Guo <hanjun.guo@linaro.org>
      Reviewed-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Cc: Sricharan R <sricharan@codeaurora.org>
      Signed-off-by: NJoerg Roedel <jroedel@suse.de>
      316ca880
  6. 08 4月, 2017 1 次提交
  7. 01 4月, 2017 1 次提交
  8. 30 3月, 2017 1 次提交
    • P
      debug: Add _ONCE() logic to report_bug() · 19d43626
      Peter Zijlstra 提交于
      Josh suggested moving the _ONCE logic inside the trap handler, using a
      bit in the bug_entry::flags field, avoiding the need for the extra
      variable.
      
      Sadly this only works for WARN_ON_ONCE(), since the others have
      printk() statements prior to triggering the trap.
      
      Still, this saves a fair amount of text and some data:
      
        text         data       filename
        10682460     4530992    defconfig-build/vmlinux.orig
        10665111     4530096    defconfig-build/vmlinux.patched
      Suggested-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      19d43626
  9. 28 3月, 2017 1 次提交
  10. 29 11月, 2016 2 次提交
    • L
      ACPI/IORT: Introduce linker section for IORT entries probing · 34ceea27
      Lorenzo Pieralisi 提交于
      Since commit e647b532 ("ACPI: Add early device probing
      infrastructure") the kernel has gained the infrastructure that allows
      adding linker script section entries to execute ACPI driver callbacks
      (ie probe routines) for all subsystems that register a table entry
      in the respective kernel section (eg clocksource, irqchip).
      
      Since ARM IOMMU devices data is described through IORT tables when
      booting with ACPI, the ARM IOMMU drivers must be made able to hook ACPI
      callback routines that are called to probe IORT entries and initialize
      the respective IOMMU devices.
      
      To avoid adding driver specific hooks into IORT table initialization
      code (breaking therefore code modularity - ie ACPI IORT code must be made
      aware of ARM SMMU drivers ACPI init callbacks), this patch adds code
      that allows ARM SMMU drivers to take advantage of the ACPI early probing
      infrastructure, so that they can add linker script section entries
      containing drivers callback to be executed on IORT tables detection.
      
      Since IORT nodes are differentiated by a type, the callback routines
      can easily parse the IORT table entries, check the IORT nodes and
      carry out some actions whenever the IORT node type associated with
      the driver specific callback is matched.
      Signed-off-by: NLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
      Reviewed-by: NHanjun Guo <hanjun.guo@linaro.org>
      Reviewed-by: NTomasz Nowicki <tn@semihalf.com>
      Tested-by: NHanjun Guo <hanjun.guo@linaro.org>
      Tested-by: NTomasz Nowicki <tn@semihalf.com>
      Cc: Tomasz Nowicki <tn@semihalf.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      34ceea27
    • N
      kbuild: keep data tables through dead code elimination · 4b89b7f7
      Nicholas Piggin 提交于
      When CONFIG_LD_DEAD_CODE_DATA_ELIMINATION is enabled we must ensure
      that we still keep various programatically-accessed tables.
      
      [npiggin: Fold Paul's patches into one, and add a few more tables.
       diff symbol tables of allyesconfig with/without -gc-sections shows up
       lost tables quite easily.]
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichal Marek <mmarek@suse.com>
      4b89b7f7
  11. 12 11月, 2016 1 次提交
  12. 08 10月, 2016 1 次提交
  13. 22 9月, 2016 1 次提交
  14. 09 9月, 2016 1 次提交
    • N
      kbuild: allow archs to select link dead code/data elimination · b67067f1
      Nicholas Piggin 提交于
      Introduce LD_DEAD_CODE_DATA_ELIMINATION option for architectures to
      select to build with -ffunction-sections, -fdata-sections, and link
      with --gc-sections. It requires some work (documented) to ensure all
      unreferenced entrypoints are live, and requires toolchain and build
      verification, so it is made a per-arch option for now.
      
      On a random powerpc64le build, this yelds a significant size saving,
      it boots and runs fine, but there is a lot I haven't tested as yet, so
      these savings may be reduced if there are bugs in the link.
      
          text      data        bss        dec   filename
      11169741   1180744    1923176	14273661   vmlinux
      10445269   1004127    1919707	13369103   vmlinux.dce
      
      ~700K text, ~170K data, 6% removed from kernel image size.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichal Marek <mmarek@suse.com>
      b67067f1
  15. 15 7月, 2016 1 次提交
    • D
      vmlinux.lds: account for destructor sections · e41f501d
      Dmitry Vyukov 提交于
      If CONFIG_KASAN is enabled and gcc is configured with
      --disable-initfini-array and/or gold linker is used, gcc emits
      .ctors/.dtors and .text.startup/.text.exit sections instead of
      .init_array/.fini_array.  .dtors section is not explicitly accounted in
      the linker script and messes vvar/percpu layout.
      
      We want:
        ffffffff822bfd80 D _edata
        ffffffff822c0000 D __vvar_beginning_hack
        ffffffff822c0000 A __vvar_page
        ffffffff822c0080 0000000000000098 D vsyscall_gtod_data
        ffffffff822c1000 A __init_begin
        ffffffff822c1000 D init_per_cpu__irq_stack_union
        ffffffff822c1000 A __per_cpu_load
        ffffffff822d3000 D init_per_cpu__gdt_page
      
      We got:
        ffffffff8279a600 D _edata
        ffffffff8279b000 A __vvar_page
        ffffffff8279c000 A __init_begin
        ffffffff8279c000 D init_per_cpu__irq_stack_union
        ffffffff8279c000 A __per_cpu_load
        ffffffff8279e000 D __vvar_beginning_hack
        ffffffff8279e080 0000000000000098 D vsyscall_gtod_data
        ffffffff827ae000 D init_per_cpu__gdt_page
      
      This happens because __vvar_page and .vvar get different addresses in
      arch/x86/kernel/vmlinux.lds.S:
      
      	. = ALIGN(PAGE_SIZE);
      	__vvar_page = .;
      
      	.vvar : AT(ADDR(.vvar) - LOAD_OFFSET) {
      		/* work around gold bug 13023 */
      		__vvar_beginning_hack = .;
      
      Discard .dtors/.fini_array/.text.exit, since we don't call dtors.
      Merge .text.startup into init text.
      
      Link: http://lkml.kernel.org/r/1467386363-120030-1-git-send-email-dvyukov@google.comSigned-off-by: NDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: NAndrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: <stable@vger.kernel.org>	[4.0+]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e41f501d
  16. 28 6月, 2016 2 次提交
  17. 21 6月, 2016 1 次提交
  18. 13 6月, 2016 1 次提交
  19. 13 4月, 2016 1 次提交
  20. 26 3月, 2016 1 次提交
  21. 22 2月, 2016 1 次提交
    • K
      arch: Introduce post-init read-only memory · c74ba8b3
      Kees Cook 提交于
      One of the easiest ways to protect the kernel from attack is to reduce
      the internal attack surface exposed when a "write" flaw is available. By
      making as much of the kernel read-only as possible, we reduce the
      attack surface.
      
      Many things are written to only during __init, and never changed
      again. These cannot be made "const" since the compiler will do the wrong
      thing (we do actually need to write to them). Instead, move these items
      into a memory region that will be made read-only during mark_rodata_ro()
      which happens after all kernel __init code has finished.
      
      This introduces __ro_after_init as a way to mark such memory, and adds
      some documentation about the existing __read_mostly marking.
      
      This improves the security of the Linux kernel by marking formerly
      read-write memory regions as read-only on a fully booted up system.
      
      Based on work by PaX Team and Brad Spengler.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brad Spengler <spender@grsecurity.net>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: David Brown <david.brown@linaro.org>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Emese Revfy <re.emese@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mathias Krause <minipli@googlemail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: PaX Team <pageexec@freemail.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: kernel-hardening@lists.openwall.com
      Cc: linux-arch <linux-arch@vger.kernel.org>
      Link: http://lkml.kernel.org/r/1455748879-21872-5-git-send-email-keescook@chromium.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      c74ba8b3
  22. 07 2月, 2016 1 次提交
    • P
      earlycon: Use common framework for earlycon declarations · 2eaa7909
      Peter Hurley 提交于
      Use a single common table of struct earlycon_id for both command line
      and devicetree. Re-define OF_EARLYCON_DECLARE() macro to instance a
      unique earlycon declaration (the declaration is only guaranteed to be
      unique within a compilation unit; separate compilation units must still
      use unique earlycon names).
      
      The semantics of OF_EARLYCON_DECLARE() is different; it declares an
      earlycon which can matched either on the command line or by devicetree.
      EARLYCON_DECLARE() is semantically unchanged; it declares an earlycon
      which is matched by command line only. Remove redundant instances of
      EARLYCON_DECLARE().
      
      This enables all earlycons to properly initialize struct console
      with the appropriate name and index, which improves diagnostics and
      enables direct earlycon-to-console handoff.
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2eaa7909
  23. 01 10月, 2015 3 次提交
  24. 20 8月, 2015 1 次提交
    • A
      kbuild: Fix .text.unlikely placement · 9bebe9e5
      Andi Kleen 提交于
      When building a kernel with .text.unlikely text the unlikely text for
      each translation unit was put next to the main .text code in the
      final vmlinux.
      
      The problem is that the linker doesn't allow more specific submatches
      of a section name in a different linker script statement after the
      main match.
      
      So we need to move them all into one line. With that change
      .text.unlikely is at the end of everything again.
      
      I also moved .text.hot into the same statement though, even though
      that's not strictly needed.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NMichal Marek <mmarek@suse.com>
      9bebe9e5
  25. 10 4月, 2015 1 次提交
  26. 08 4月, 2015 1 次提交
    • S
      tracing: Add TRACE_DEFINE_ENUM() macro to map enums to their values · 0c564a53
      Steven Rostedt (Red Hat) 提交于
      Several tracepoints use the helper functions __print_symbolic() or
      __print_flags() and pass in enums that do the mapping between the
      binary data stored and the value to print. This works well for reading
      the ASCII trace files, but when the data is read via userspace tools
      such as perf and trace-cmd, the conversion of the binary value to a
      human string format is lost if an enum is used, as userspace does not
      have access to what the ENUM is.
      
      For example, the tracepoint trace_tlb_flush() has:
      
       __print_symbolic(REC->reason,
          { TLB_FLUSH_ON_TASK_SWITCH, "flush on task switch" },
          { TLB_REMOTE_SHOOTDOWN, "remote shootdown" },
          { TLB_LOCAL_SHOOTDOWN, "local shootdown" },
          { TLB_LOCAL_MM_SHOOTDOWN, "local mm shootdown" })
      
      Which maps the enum values to the strings they represent. But perf and
      trace-cmd do no know what value TLB_LOCAL_MM_SHOOTDOWN is, and would
      not be able to map it.
      
      With TRACE_DEFINE_ENUM(), developers can place these in the event header
      files and ftrace will convert the enums to their values:
      
      By adding:
      
       TRACE_DEFINE_ENUM(TLB_FLUSH_ON_TASK_SWITCH);
       TRACE_DEFINE_ENUM(TLB_REMOTE_SHOOTDOWN);
       TRACE_DEFINE_ENUM(TLB_LOCAL_SHOOTDOWN);
       TRACE_DEFINE_ENUM(TLB_LOCAL_MM_SHOOTDOWN);
      
       $ cat /sys/kernel/debug/tracing/events/tlb/tlb_flush/format
      [...]
       __print_symbolic(REC->reason,
          { 0, "flush on task switch" },
          { 1, "remote shootdown" },
          { 2, "local shootdown" },
          { 3, "local mm shootdown" })
      
      The above is what userspace expects to see, and tools do not need to
      be modified to parse them.
      
      Link: http://lkml.kernel.org/r/20150403013802.220157513@goodmis.org
      
      Cc: Guilherme Cox <cox@computer.org>
      Cc: Tony Luck <tony.luck@gmail.com>
      Cc: Xie XiuQi <xiexiuqi@huawei.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Reviewed-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      0c564a53
  27. 30 3月, 2015 1 次提交
  28. 27 3月, 2015 1 次提交
    • P
      serial: earlycon: Enable earlycon without command line param · 470ca0de
      Peter Hurley 提交于
      Earlycon matching can only be triggered if 'earlycon=...' has been
      specified on the kernel command line. To workaround this limitation
      requires tight coupling between arches and specific serial drivers
      in order to start an earlycon. Devicetree avoids this limitation
      with a link table that contains the required data to match earlycons.
      
      Mirror this approach for earlycon match by name. Re-purpose
      EARLYCON_DECLARE to generate a table entry which associates name with
      setup() function. Re-purpose setup_earlycon() to scan this table for
      an earlycon match, which is registered if found.
      
      Declare one "earlycon" early_param, which calls setup_earlycon().
      
      This design allows setup_earlycon() to be called directly with a
      param string (as if 'earlycon=...' had been set on the command line).
      Re-registration (either directly or by early_param) is prevented.
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      470ca0de
  29. 24 3月, 2015 1 次提交
  30. 14 2月, 2015 1 次提交
    • A
      kernel: add support for .init_array.* constructors · 9ddf8252
      Andrey Ryabinin 提交于
      KASan uses constructors for initializing redzones for global variables.
      Globals instrumentation in GCC 4.9.2 produces constructors with priority
      (.init_array.00099)
      
      Currently kernel ignores such constructors.  Only constructors with
      default priority supported (.init_array)
      
      This patch adds support for constructors with priorities.  For kernel
      image we put pointers to constructors between __ctors_start/__ctors_end
      and do_ctors() will call them on start up.  For modules we merge
      .init_array.* sections into resulting .init_array.  Module code properly
      handles constructors in .init_array section.
      Signed-off-by: NAndrey Ryabinin <a.ryabinin@samsung.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Konstantin Serebryany <kcc@google.com>
      Cc: Dmitry Chernenkov <dmitryc@google.com>
      Signed-off-by: NAndrey Konovalov <adech.fo@gmail.com>
      Cc: Yuri Gribov <tetra2005@gmail.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Sasha Levin <sasha.levin@oracle.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9ddf8252
  31. 02 12月, 2014 1 次提交
    • W
      iommu: provide early initialisation hook for IOMMU drivers · 1cd076bf
      Will Deacon 提交于
      IOMMU drivers must be initialised before any of their upstream devices,
      otherwise the relevant iommu_ops won't be configured for the bus in
      question. To solve this, a number of IOMMU drivers use initcalls to
      initialise the driver before anything has a chance to be probed.
      
      Whilst this solves the immediate problem, it leaves the job of probing
      the IOMMU completely separate from the iommu_ops to configure the IOMMU,
      which are called on a per-bus basis and require the driver to figure out
      exactly which instance of the IOMMU is being requested. In particular,
      the add_device callback simply passes a struct device to the driver,
      which then has to parse firmware tables or probe buses to identify the
      relevant IOMMU instance.
      
      This patch takes the first step in addressing this problem by adding an
      early initialisation pass for IOMMU drivers, giving them the ability to
      store some per-instance data in their iommu_ops structure and store that
      in their of_node. This can later be used when parsing OF masters to
      identify the IOMMU instance in question.
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NJoerg Roedel <jroedel@suse.de>
      Acked-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Tested-by: NRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: NWill Deacon <will.deacon@arm.com>
      1cd076bf
  32. 03 10月, 2014 1 次提交
  33. 02 7月, 2014 1 次提交
    • Z
      core: fix typo in percpu read_mostly section · 330d2822
      Zhengyu He 提交于
      This fixes a typo that named the read_mostly section of percpu as
      readmostly. It works fine with SMP because the linker script specifies
      .data..percpu..readmostly. However, UP kernel builds don't have percpu
      sections defined and the non-percpu version of the section is called
      data..read_mostly, so .data..readmostly will float around and may break
      things unexpectedly.
      
      Looking at the original change that introduced data..percpu..readmostly
      (commit c957ef2c), it looks like this
      was the original intention.
      
      Tested: Built UP kernel and confirmed the sections got merged.
      
      - Before the patch:
      $ objdump -h vmlinux.o  | grep '\.data\.\.read.*mostly'
      38 .data..read_mostly 00004418  0000000000000000  0000000000000000  00431ac0  2**6
      50 .data..readmostly 00000014  0000000000000000  0000000000000000  00444000  2**3
      
      - After the patch:
      $ objdump -h vmlinux.o  | grep '\.data\.\.read.*mostly'
      38 .data..read_mostly 00004438  0000000000000000  0000000000000000  00431ac0  2**6
      Signed-off-by: NZhengyu He <hzy@google.com>
      Signed-off-by: NFilipe Brandenburger <filbranden@google.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      330d2822
  34. 20 6月, 2014 1 次提交