1. 06 3月, 2018 1 次提交
    • C
      s390/entry.S: fix spurious zeroing of r0 · d3f46896
      Christian Borntraeger 提交于
      when a system call is interrupted we might call the critical section
      cleanup handler that re-does some of the operations. When we are between
      .Lsysc_vtime and .Lsysc_do_svc we might also redo the saving of the
      problem state registers r0-r7:
      
      .Lcleanup_system_call:
      [...]
      0:      # update accounting time stamp
              mvc     __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
              # set up saved register r11
              lg      %r15,__LC_KERNEL_STACK
              la      %r9,STACK_FRAME_OVERHEAD(%r15)
              stg     %r9,24(%r11)            # r11 pt_regs pointer
              # fill pt_regs
              mvc     __PT_R8(64,%r9),__LC_SAVE_AREA_SYNC
      --->    stmg    %r0,%r7,__PT_R0(%r9)
      
      The problem is now, that we might have already zeroed out r0.
      The fix is to move the zeroing of r0 after sysc_do_svc.
      Reported-by: NFarhan Ali <alifm@linux.vnet.ibm.com>
      Fixes: 7041d281 ("s390: scrub registers on kernel entry and KVM exit")
      Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      d3f46896
  2. 22 2月, 2018 2 次提交
  3. 07 2月, 2018 1 次提交
    • M
      s390: introduce execute-trampolines for branches · f19fbd5e
      Martin Schwidefsky 提交于
      Add CONFIG_EXPOLINE to enable the use of the new -mindirect-branch= and
      -mfunction_return= compiler options to create a kernel fortified against
      the specte v2 attack.
      
      With CONFIG_EXPOLINE=y all indirect branches will be issued with an
      execute type instruction. For z10 or newer the EXRL instruction will
      be used, for older machines the EX instruction. The typical indirect
      call
      
      	basr	%r14,%r1
      
      is replaced with a PC relative call to a new thunk
      
      	brasl	%r14,__s390x_indirect_jump_r1
      
      The thunk contains the EXRL/EX instruction to the indirect branch
      
      __s390x_indirect_jump_r1:
      	exrl	0,0f
      	j	.
      0:	br	%r1
      
      The detour via the execute type instruction has a performance impact.
      To get rid of the detour the new kernel parameter "nospectre_v2" and
      "spectre_v2=[on,off,auto]" can be used. If the parameter is specified
      the kernel and module code will be patched at runtime.
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      f19fbd5e
  4. 05 2月, 2018 3 次提交
  5. 23 1月, 2018 1 次提交
  6. 20 11月, 2017 1 次提交
  7. 14 11月, 2017 2 次提交
    • M
      s390: remove all code using the access register mode · 0aaba41b
      Martin Schwidefsky 提交于
      The vdso code for the getcpu() and the clock_gettime() call use the access
      register mode to access the per-CPU vdso data page with the current code.
      
      An alternative to the complicated AR mode is to use the secondary space
      mode. This makes the vdso faster and quite a bit simpler. The downside is
      that the uaccess code has to be changed quite a bit.
      
      Which instructions are used depends on the machine and what kind of uaccess
      operation is requested. The instruction dictates which ASCE value needs
      to be loaded into %cr1 and %cr7.
      
      The different cases:
      
      * User copy with MVCOS for z10 and newer machines
        The MVCOS instruction can copy between the primary space (aka user) and
        the home space (aka kernel) directly. For set_fs(KERNEL_DS) the kernel
        ASCE is loaded into %cr1. For set_fs(USER_DS) the user space is already
        loaded in %cr1.
      
      * User copy with MVCP/MVCS for older machines
        To be able to execute the MVCP/MVCS instructions the kernel needs to
        switch to primary mode. The control register %cr1 has to be set to the
        kernel ASCE and %cr7 to either the kernel ASCE or the user ASCE dependent
        on set_fs(KERNEL_DS) vs set_fs(USER_DS).
      
      * Data access in the user address space for strnlen / futex
        To use "normal" instruction with data from the user address space the
        secondary space mode is used. The kernel needs to switch to primary mode,
        %cr1 has to contain the kernel ASCE and %cr7 either the user ASCE or the
        kernel ASCE, dependent on set_fs.
      
      To load a new value into %cr1 or %cr7 is an expensive operation, the kernel
      tries to be lazy about it. E.g. for multiple user copies in a row with
      MVCP/MVCS the replacement of the vdso ASCE in %cr7 with the user ASCE is
      done only once. On return to user space a CPU bit is checked that loads the
      vdso ASCE again.
      
      To enable and disable the data access via the secondary space two new
      functions are added, enable_sacf_uaccess and disable_sacf_uaccess. The fact
      that a context is in secondary space uaccess mode is stored in the
      mm_segment_t value for the task. The code of an interrupt may use set_fs
      as long as it returns to the previous state it got with get_fs with another
      call to set_fs. The code in finish_arch_post_lock_switch simply has to do a
      set_fs with the current mm_segment_t value for the task.
      
      For CPUs with MVCOS:
      
      CPU running in                        | %cr1 ASCE | %cr7 ASCE |
      --------------------------------------|-----------|-----------|
      user space                            |  user     |  vdso     |
      kernel, USER_DS, normal-mode          |  user     |  vdso     |
      kernel, USER_DS, normal-mode, lazy    |  user     |  user     |
      kernel, USER_DS, sacf-mode            |  kernel   |  user     |
      kernel, KERNEL_DS, normal-mode        |  kernel   |  vdso     |
      kernel, KERNEL_DS, normal-mode, lazy  |  kernel   |  kernel   |
      kernel, KERNEL_DS, sacf-mode          |  kernel   |  kernel   |
      
      For CPUs without MVCOS:
      
      CPU running in                        | %cr1 ASCE | %cr7 ASCE |
      --------------------------------------|-----------|-----------|
      user space                            |  user     |  vdso     |
      kernel, USER_DS, normal-mode          |  user     |  vdso     |
      kernel, USER_DS, normal-mode lazy     |  kernel   |  user     |
      kernel, USER_DS, sacf-mode            |  kernel   |  user     |
      kernel, KERNEL_DS, normal-mode        |  kernel   |  vdso     |
      kernel, KERNEL_DS, normal-mode, lazy  |  kernel   |  kernel   |
      kernel, KERNEL_DS, sacf-mode          |  kernel   |  kernel   |
      
      The lines with "lazy" refer to the state after a copy via the secondary
      space with a delayed reload of %cr1 and %cr7.
      
      There are three hardware address spaces that can cause a DAT exception,
      primary, secondary and home space. The exception can be related to
      four different fault types: user space fault, vdso fault, kernel fault,
      and the gmap faults.
      
      Dependent on the set_fs state and normal vs. sacf mode there are a number
      of fault combinations:
      
      1) user address space fault via the primary ASCE
      2) gmap address space fault via the primary ASCE
      3) kernel address space fault via the primary ASCE for machines with
         MVCOS and set_fs(KERNEL_DS)
      4) vdso address space faults via the secondary ASCE with an invalid
         address while running in secondary space in problem state
      5) user address space fault via the secondary ASCE for user-copy
         based on the secondary space mode, e.g. futex_ops or strnlen_user
      6) kernel address space fault via the secondary ASCE for user-copy
         with secondary space mode with set_fs(KERNEL_DS)
      7) kernel address space fault via the primary ASCE for user-copy
         with secondary space mode with set_fs(USER_DS) on machines without
         MVCOS.
      8) kernel address space fault via the home space ASCE
      
      Replace user_space_fault() with a new function get_fault_type() that
      can distinguish all four different fault types.
      
      With these changes the futex atomic ops from the kernel and the
      strnlen_user will get a little bit slower, as well as the old style
      uaccess with MVCP/MVCS. All user accesses based on MVCOS will be as
      fast as before. On the positive side, the user space vdso code is a
      lot faster and Linux ceases to use the complicated AR mode.
      Reviewed-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      0aaba41b
    • M
      s390/mm,kvm: improve detection of KVM guest faults · c771320e
      Martin Schwidefsky 提交于
      The identification of guest fault currently relies on the PF_VCPU flag.
      This is set in guest_entry_irqoff and cleared in guest_exit_irqoff.
      Both functions are called by __vcpu_run, the PF_VCPU flag is set for
      quite a lot of kernel code outside of the guest execution.
      
      Replace the PF_VCPU scheme with the PIF_GUEST_FAULT in the pt_regs and
      make the program check handler code in entry.S set the bit only for
      exception that occurred between the .Lsie_gmap and .Lsie_done labels.
      Reviewed-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      c771320e
  8. 02 11月, 2017 2 次提交
    • V
      s390/nmi: avoid using long-displacement facility · 2a2d7bef
      Vasily Gorbik 提交于
      __LC_MCESAD is currently 4528 /* offsetof(struct lowcore, mcesad) */
      that would require long-displacement facility for lg, which we don't
      have on z900.
      
      Fixes: 3037a52f ("s390/nmi: do register validation as early as possible")
      Signed-off-by: NVasily Gorbik <gor@linux.vnet.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      2a2d7bef
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      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 license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  9. 25 10月, 2017 1 次提交
    • M
      s390/kvm: fix detection of guest machine checks · 0a5e2ec2
      Martin Schwidefsky 提交于
      The new detection code for guest machine checks added a check based
      on %r11 to .Lcleanup_sie to distinguish between normal asynchronous
      interrupts and machine checks. But the funtion is called from the
      program check handler as well with an undefined value in %r11.
      
      The effect is that all program exceptions pointing to the SIE instruction
      will set the CIF_MCCK_GUEST bit. The bit stays set for the CPU until the
       next machine check comes in which will incorrectly be interpreted as a
      guest machine check.
      
      The simplest fix is to stop using .Lcleanup_sie in the program check
      handler and duplicate a few instructions.
      
      Fixes: c929500d ("s390/nmi: s390: New low level handling for machine check happening in guest")
      Cc: <stable@vger.kernel.org> # v4.13+
      Reviewed-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      0a5e2ec2
  10. 19 10月, 2017 1 次提交
    • M
      s390/nmi: do register validation as early as possible · 3037a52f
      Martin Schwidefsky 提交于
      The validation of the CPU registers in the machine check handler is
      currently split into two parts. The first part is done at the start
      of the low level mcck_int_handler function, this includes the CPU
      timer register and the general purpose registers.
      The second part is done a bit later in s390_do_machine_check for all
      the other registers, including the control registers, floating pointer
      control, vector or floating pointer registers, the access registers,
      the guarded storage registers, the TOD programmable registers and the
      clock comparator.
      
      This is working fine to far but in theory a future extensions could
      cause the C code to use registers that are not validated yet. A better
      approach is to validate all CPU registers in "safe" assembler code
      before any C function is called.
      Reviewed-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      3037a52f
  11. 27 6月, 2017 1 次提交
  12. 13 6月, 2017 2 次提交
    • M
      s390/fpu: export save_fpu_regs for all configs · f044f4c5
      Martin Schwidefsky 提交于
      The save_fpu_regs function is a general API that is supposed to be
      usable for modules as well. Remove the #ifdef that hides the symbol
      for CONFIG_KVM=n.
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      f044f4c5
    • M
      s390/kvm: avoid global config of vm.alloc_pgste=1 · 23fefe11
      Martin Schwidefsky 提交于
      The system control vm.alloc_pgste is used to control the size of the
      page tables, either 2K or 4K. The idea is that a KVM host sets the
      vm.alloc_pgste control to 1 which causes *all* new processes to run
      with 4K page tables. For a non-kvm system the control should stay off
      to save on memory used for page tables.
      
      Trouble is that distributions choose to set the control globally to
      be able to run KVM guests. This wastes memory on non-KVM systems.
      
      Introduce the PT_S390_PGSTE ELF segment type to "mark" the qemu
      executable with it. All executables with this (empty) segment in
      its ELF phdr array will be started with 4K page tables. Any executable
      without PT_S390_PGSTE will run with the default 2K page tables.
      
      This removes the need to set vm.alloc_pgste=1 for a KVM host and
      minimizes the waste of memory for page tables.
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      23fefe11
  13. 17 5月, 2017 1 次提交
  14. 03 5月, 2017 1 次提交
    • M
      s390/cputime: fix incorrect system time · 07a63cbe
      Martin Schwidefsky 提交于
      git commit c5328901 "[S390] entry[64].S improvements" removed
      the update of the exit_timer lowcore field from the critical section
      cleanup of the .Lsysc_restore/.Lsysc_done and .Lio_restore/.Lio_done
      blocks. If the PSW is updated by the critical section cleanup to point to
      user space again, the interrupt entry code will do a vtime calculation
      after the cleanup completed with an exit_timer value which has *not* been
      updated. Due to this incorrect system time deltas are calculated.
      
      If an interrupt occured with an old PSW between .Lsysc_restore/.Lsysc_done
      or .Lio_restore/.Lio_done update __LC_EXIT_TIMER with the system entry
      time of the interrupt.
      
      Cc: stable@vger.kernel.org # 3.3+
      Tested-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      07a63cbe
  15. 05 4月, 2017 2 次提交
    • M
      s390/cpumf: simplify detection of guest samples · df26c2e8
      Martin Schwidefsky 提交于
      There are three different code levels in regard to the identification
      of guest samples. They differ in the way the LPP instruction is used.
      
      1) Old kernels without the LPP instruction. The guest program parameter
         is always zero.
      2) Newer kernels load the process pid into the program parameter with LPP.
         The guest program parameter is non-zero if the guest executes in a
         process != idle.
      3) The latest kernels load ((1UL << 31) | pid) with LPP to make the value
         non-zero even for the idle task. The guest program parameter is non-zero
         if the guest is running.
      
      All kernels load the process pid to CR4 on context switch. The CPU sampling
      code uses the value in CR4 to decide between guest and host samples in case
      the guest program parameter is zero. The three cases:
      
      1) CR4==pid, gpp==0
      2) CR4==pid, gpp==pid
      3) CR4==pid, gpp==((1UL << 31) | pid)
      
      The load-control instruction to load the pid into CR4 is expensive and the
      goal is to remove it. To distinguish the host CR4 from the guest pid for
      the idle process the maximum value 0xffff for the PASN is used.
      This adds a fourth case for a guest OS with an updated kernel:
      
      4) CR4==0xffff, gpp=((1UL << 31) | pid)
      
      The host kernel will have CR4==0xffff and will use (gpp!=0 || CR4!==0xffff)
      to identify guest samples. This works nicely with all 4 cases, the only
      possible issue would be a guest with an old kernel (gpp==0) and a process
      pid of 0xffff. Well, don't do that..
      Suggested-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      df26c2e8
    • M
      s390: use 64-bit lctlg to load task pid to cr4 on context switch · cab36c26
      Martin Schwidefsky 提交于
      The 32-bit lctl instruction is quite a bit slower than the 64-bit
      counter part lctlg. Use the faster instruction.
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      cab36c26
  16. 22 3月, 2017 1 次提交
    • M
      s390: add a system call for guarded storage · 916cda1a
      Martin Schwidefsky 提交于
      This adds a new system call to enable the use of guarded storage for
      user space processes. The system call takes two arguments, a command
      and pointer to a guarded storage control block:
      
          s390_guarded_storage(int command, struct gs_cb *gs_cb);
      
      The second argument is relevant only for the GS_SET_BC_CB command.
      
      The commands in detail:
      
      0 - GS_ENABLE
          Enable the guarded storage facility for the current task. The
          initial content of the guarded storage control block will be
          all zeros. After the enablement the user space code can use
          load-guarded-storage-controls instruction (LGSC) to load an
          arbitrary control block. While a task is enabled the kernel
          will save and restore the current content of the guarded
          storage registers on context switch.
      1 - GS_DISABLE
          Disables the use of the guarded storage facility for the current
          task. The kernel will cease to save and restore the content of
          the guarded storage registers, the task specific content of
          these registers is lost.
      2 - GS_SET_BC_CB
          Set a broadcast guarded storage control block. This is called
          per thread and stores a specific guarded storage control block
          in the task struct of the current task. This control block will
          be used for the broadcast event GS_BROADCAST.
      3 - GS_CLEAR_BC_CB
          Clears the broadcast guarded storage control block. The guarded-
          storage control block is removed from the task struct that was
          established by GS_SET_BC_CB.
      4 - GS_BROADCAST
          Sends a broadcast to all thread siblings of the current task.
          Every sibling that has established a broadcast guarded storage
          control block will load this control block and will be enabled
          for guarded storage. The broadcast guarded storage control block
          is used up, a second broadcast without a refresh of the stored
          control block with GS_SET_BC_CB will not have any effect.
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      916cda1a
  17. 08 3月, 2017 1 次提交
    • M
      livepatch/s390: add TIF_PATCH_PENDING thread flag · 2f09ca60
      Miroslav Benes 提交于
      Update a task's patch state when returning from a system call or user
      space interrupt, or after handling a signal.
      
      This greatly increases the chances of a patch operation succeeding.  If
      a task is I/O bound, it can be patched when returning from a system
      call.  If a task is CPU bound, it can be patched when returning from an
      interrupt.  If a task is sleeping on a to-be-patched function, the user
      can send SIGSTOP and SIGCONT to force it to switch.
      
      Since there are two ways the syscall can be restarted on return from a
      signal handling process, it is important to clear the flag before
      do_signal() is called. Otherwise we could miss the migration if we used
      SIGSTOP/SIGCONT procedure or fake signal to migrate patching blocking
      tasks. If we place our hook to sysc_work label in entry before
      TIF_SIGPENDING is evaluated we kill two birds with one stone. The task
      is correctly migrated in all return paths from a syscall.
      Signed-off-by: NMiroslav Benes <mbenes@suse.cz>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      2f09ca60
  18. 01 3月, 2017 1 次提交
  19. 23 2月, 2017 2 次提交
  20. 20 2月, 2017 1 次提交
  21. 08 2月, 2017 1 次提交
    • M
      s390: add no-execute support · 57d7f939
      Martin Schwidefsky 提交于
      Bit 0x100 of a page table, segment table of region table entry
      can be used to disallow code execution for the virtual addresses
      associated with the entry.
      
      There is one tricky bit, the system call to return from a signal
      is part of the signal frame written to the user stack. With a
      non-executable stack this would stop working. To avoid breaking
      things the protection fault handler checks the opcode that caused
      the fault for 0x0a77 (sys_sigreturn) and 0x0aad (sys_rt_sigreturn)
      and injects a system call. This is preferable to the alternative
      solution with a stub function in the vdso because it works for
      vdso=off and statically linked binaries as well.
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      57d7f939
  22. 31 1月, 2017 1 次提交
    • M
      s390: store breaking event address only for program checks · 34525e1f
      Martin Schwidefsky 提交于
      The principles of operations specifies that the breaking event address
      is stored to the address 0x110 in the prefix page only for program checks.
      The last branch in user space is lost as soon as a branch in kernel space
      is executed after e.g. an svc. This makes it impossible to accurately
      maintain the breaking event address for a user space process.
      
      Simplify the code, just copy the current breaking event address from
      0x110 to the task structure for program checks from user space.
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      34525e1f
  23. 12 12月, 2016 1 次提交
  24. 07 12月, 2016 1 次提交
    • M
      s390: fix machine check panic stack switch · ce4dda3f
      Martin Schwidefsky 提交于
      For system damage machine checks or machine checks due to invalid PSW
      fields the system will be stopped. In order to get an oops message out
      before killing the system the machine check handler branches to
      .Lmcck_panic, switches to the panic stack and then does the usual
      machine check handling.
      
      The switch to the panic stack is incomplete, the stack pointer in %r15
      is replaced, but the pt_regs pointer in %r11 is not. The result is
      a program check which will kill the system in a slightly different way.
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      ce4dda3f
  25. 25 11月, 2016 1 次提交
  26. 23 11月, 2016 1 次提交
  27. 15 11月, 2016 1 次提交
  28. 11 11月, 2016 2 次提交
  29. 08 8月, 2016 1 次提交
  30. 04 7月, 2016 1 次提交
    • H
      s390: have unique symbol for __switch_to address · 46210c44
      Heiko Carstens 提交于
      After linking there are several symbols for the same address that the
      __switch_to symbol points to. E.g.:
      
      000000000089b9c0 T __kprobes_text_start
      000000000089b9c0 T __lock_text_end
      000000000089b9c0 T __lock_text_start
      000000000089b9c0 T __sched_text_end
      000000000089b9c0 T __switch_to
      
      When disassembling with "objdump -d" this results in a missing
      __switch_to function. It would be named __kprobes_text_start
      instead. To unconfuse objdump add a nop in front of the kprobes text
      section. That way __switch_to appears again.
      
      Obviously this solution is sort of a hack, since it also depends on
      link order if this works or not. However it is the best I can come up
      with for now.
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      46210c44
  31. 28 6月, 2016 1 次提交