1. 20 Mar, 2020 1 commit
  2. 16 Jan, 2020 1 commit
  3. 06 Feb, 2019 2 commits
  4. 27 Jun, 2018 1 commit
  5. 19 Mar, 2018 1 commit
    • Marc Zyngier's avatar
      arm64: alternatives: Add dynamic patching feature · dea5e2a4
      Marc Zyngier authored
      
      
      We've so far relied on a patching infrastructure that only gave us
      a single alternative, without any way to provide a range of potential
      replacement instructions. For a single feature, this is an all or
      nothing thing.
      
      It would be interesting to have a more flexible grained way of patching
      the kernel though, where we could dynamically tune the code that gets
      injected.
      
      In order to achive this, let's introduce a new form of dynamic patching,
      assiciating a callback to a patching site. This callback gets source and
      target locations of the patching request, as well as the number of
      instructions to be patched.
      
      Dynamic patching is declared with the new ALTERNATIVE_CB and alternative_cb
      directives:
      
      	asm volatile(ALTERNATIVE_CB("mov %0, #0\n", callback)
      		     : "r" (v));
      or
      	alternative_cb callback
      		mov	x0, #0
      	alternative_cb_end
      
      where callback is the C function computing the alternative.
      Reviewed-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
      Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      dea5e2a4
  6. 13 Jan, 2018 1 commit
  7. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard...
      b2441318
  8. 05 Nov, 2016 1 commit
  9. 11 Oct, 2016 1 commit
  10. 12 Sep, 2016 1 commit
    • Mark Rutland's avatar
      arm64: alternative: add auto-nop infrastructure · 792d4737
      Mark Rutland authored
      
      
      In some cases, one side of an alternative sequence is simply a number of
      NOPs used to balance the other side. Keeping track of this manually is
      tedious, and the presence of large chains of NOPs makes the code more
      painful to read than necessary.
      
      To ameliorate matters, this patch adds a new alternative_else_nop_endif,
      which automatically balances an alternative sequence with a trivial NOP
      sled.
      
      In many cases, we would like a NOP-sled in the default case, and
      instructions patched in in the presence of a feature. To enable the NOPs
      to be generated automatically for this case, this patch also adds a new
      alternative_if, and updates alternative_else and alternative_endif to
      work with either alternative_if or alternative_endif.
      
      Cc: Andre Przywara <andre.przywara@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dave Martin <dave.martin@arm.com>
      Cc: James Morse <james.morse@arm.com>
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      [will: use new nops macro to generate nop sequences]
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      792d4737
  11. 01 Jul, 2016 2 commits
  12. 24 Feb, 2016 1 commit
    • Ard Biesheuvel's avatar
      arm64: switch to relative exception tables · 6c94f27a
      Ard Biesheuvel authored
      
      
      Instead of using absolute addresses for both the exception location
      and the fixup, use offsets relative to the exception table entry values.
      Not only does this cut the size of the exception table in half, it is
      also a prerequisite for KASLR, since absolute exception table entries
      are subject to dynamic relocation, which is incompatible with the sorting
      of the exception table that occurs at build time.
      
      This patch also introduces the _ASM_EXTABLE preprocessor macro (which
      exists on x86 as well) and its _asm_extable assembly counterpart, as
      shorthands to emit exception table entries.
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      6c94f27a
  13. 18 Feb, 2016 1 commit
    • James Morse's avatar
      arm64: kernel: Add support for User Access Override · 57f4959b
      James Morse authored
      
      
      'User Access Override' is a new ARMv8.2 feature which allows the
      unprivileged load and store instructions to be overridden to behave in
      the normal way.
      
      This patch converts {get,put}_user() and friends to use ldtr*/sttr*
      instructions - so that they can only access EL0 memory, then enables
      UAO when fs==KERNEL_DS so that these functions can access kernel memory.
      
      This allows user space's read/write permissions to be checked against the
      page tables, instead of testing addr<USER_DS, then using the kernel's
      read/write permissions.
      Signed-off-by: default avatarJames Morse <james.morse@arm.com>
      [catalin.marinas@arm.com: move uao_thread_switch() above dsb()]
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      57f4959b
  14. 10 Dec, 2015 1 commit
    • Mark Rutland's avatar
      arm64: mm: fold alternatives into .init · 9aa4ec15
      Mark Rutland authored
      
      
      Currently we treat the alternatives separately from other data that's
      only used during initialisation, using separate .altinstructions and
      .altinstr_replacement linker sections. These are freed for general
      allocation separately from .init*. This is problematic as:
      
      * We do not remove execute permissions, as we do for .init, leaving the
        memory executable.
      
      * We pad between them, making the kernel Image bianry up to PAGE_SIZE
        bytes larger than necessary.
      
      This patch moves the two sections into the contiguous region used for
      .init*. This saves some memory, ensures that we remove execute
      permissions, and allows us to remove some code made redundant by this
      reorganisation.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Andre Przywara <andre.przywara@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Jeremy Linton <jeremy.linton@arm.com>
      Cc: Laura Abbott <labbott@fedoraproject.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      9aa4ec15
  15. 30 Jul, 2015 1 commit
    • Will Deacon's avatar
      arm64: alternative: put secondary CPUs into polling loop during patch · ef5e724b
      Will Deacon authored
      
      
      When patching the kernel text with alternatives, we may end up patching
      parts of the stop_machine state machine (e.g. atomic_dec_and_test in
      ack_state) and consequently corrupt the instruction stream of any
      secondary CPUs.
      
      This patch passes the cpu_online_mask to stop_machine, forcing all of
      the CPUs into our own callback which can place the secondary cores into
      a dumb (but safe!) polling loop whilst the patching is carried out.
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      ef5e724b
  16. 27 Jul, 2015 3 commits
  17. 05 Jun, 2015 2 commits
    • Marc Zyngier's avatar
      arm64: alternative: Work around .inst assembler bugs · eb7c11ee
      Marc Zyngier authored
      
      
      AArch64 toolchains suffer from the following bug:
      
      $ cat blah.S
      1:
      	.inst	0x01020304
      	.if ((. - 1b) != 4)
      		.error	"blah"
      	.endif
      $ aarch64-linux-gnu-gcc -c blah.S
      blah.S: Assembler messages:
      blah.S:3: Error: non-constant expression in ".if" statement
      
      which precludes the use of msr_s and co as part of alternatives.
      
      We workaround this issue by not directly testing the labels
      themselves, but by moving the current output pointer by a value
      that should always be zero. If this value is not null, then
      we will trigger a backward move, which is expclicitely forbidden.
      This triggers the error we're after:
      
        AS      arch/arm64/kvm/hyp.o
      arch/arm64/kvm/hyp.S: Assembler messages:
      arch/arm64/kvm/hyp.S:1377: Error: attempt to move .org backwards
      scripts/Makefile.build:294: recipe for target 'arch/arm64/kvm/hyp.o' failed
      make[1]: *** [arch/arm64/kvm/hyp.o] Error 1
      Makefile:946: recipe for target 'arch/arm64/kvm' failed
      
      Not pretty, but at least works on the current toolchains.
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      eb7c11ee
    • Marc Zyngier's avatar
      arm64: alternative: Merge alternative-asm.h into alternative.h · 8d883b23
      Marc Zyngier authored
      
      
      asm/alternative-asm.h and asm/alternative.h are extremely similar,
      and really deserve to live in the same file (as this makes further
      modufications a bit easier).
      
      Fold the content of alternative-asm.h into alternative.h, and
      update the few users.
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      8d883b23
  18. 04 Dec, 2014 1 commit
    • Andre Przywara's avatar
      arm64: add module support for alternatives fixups · 932ded4b
      Andre Przywara authored
      
      
      Currently the kernel patches all necessary instructions once at boot
      time, so modules are not covered by this.
      Change the apply_alternatives() function to take a beginning and an
      end pointer and introduce a new variant (apply_alternatives_all()) to
      cover the existing use case for the static kernel image section.
      Add a module_finalize() function to arm64 to check for an
      alternatives section in a module and patch only the instructions from
      that specific area.
      Since that module code is not touched before the module
      initialization has ended, we don't need to halt the machine before
      doing the patching in the module's code.
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      932ded4b
  19. 25 Nov, 2014 1 commit