1. 25 Apr, 2018 30 commits
    • Eric W. Biederman's avatar
      signal/s390: Use force_sig_fault where appropriate · 9507a5d0
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: linux-s390@vger.kernel.org
      Acked-by: Martin Schwidefsky >schwidefsky@de.ibm.com>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      9507a5d0
    • Eric W. Biederman's avatar
      signal/riscv: Replace do_trap_siginfo with force_sig_fault · 7ff3a762
      Eric W. Biederman authored
      The function force_sig_fault is just the generic version of
      do_trap_siginfo with a (void __user *) instead of an unsigned long
      parameter for the address.
      
      So just use force_sig_fault to simplify the code.
      
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Albert Ou <albert@sifive.com>
      Cc: linux-riscv@lists.infradead.org
      Suggested-by: default avatarChristoph Hellwig <hch@infradead.org>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      7ff3a762
    • Eric W. Biederman's avatar
      signal/riscv: Use force_sig_fault where appropriate · 4d6a20b1
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Palmer Dabbelt <palmer@sifive.com>
      Cc: Albert Ou <albert@sifive.com>
      Cc: linux-riscv@lists.infradead.org
      Acked-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      4d6a20b1
    • Eric W. Biederman's avatar
      signal/parisc: Use force_sig_fault where appropriate · ccf75290
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: James Bottomley <jejb@parisc-linux.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: linux-parisc@vger.kernel.org
      Acked-by: Helge Deller <deller@gmx.de>   # parisc
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      ccf75290
    • Eric W. Biederman's avatar
      signal/parisc: Use force_sig_mceerr where appropriate · c2b0e0d3
      Eric W. Biederman authored
      In do_page_fault where an mceerr is generated stop and call force_sig_mceerr.
      Keeping the mcerr handling logic out of the force_sig_info call below.
      
      This ensures that only and always in the mcerr case is lsb interesting.
      
      This ensures setting set si_lsb in the future won't accidentally
      stomp another siginfo field in the non mcerr case.
      
      Cc: James Bottomley <jejb@parisc-linux.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: linux-parisc@vger.kernel.org
      Acked-by: Helge Deller <deller@gmx.de>   # parisc
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      c2b0e0d3
    • Eric W. Biederman's avatar
      signal/openrisc: Use force_sig_fault where appropriate · 75bfb9a1
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
      Cc: Stafford Horne <shorne@gmail.com>
      Cc: openrisc@lists.librecores.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      75bfb9a1
    • Eric W. Biederman's avatar
      signal/nios2: Use force_sig_fault where appropriate · c046e2c6
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: nios2-dev@lists.rocketboards.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      c046e2c6
    • Eric W. Biederman's avatar
      signal/nds32: Use force_sig_fault where appropriate · d808e918
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Acked-by: default avatarVincent Chen <deanbo422@gmail.com>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      d808e918
    • Eric W. Biederman's avatar
      signal/mips: Use force_sig_fault where appropriate · f43a54a0
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@linux-mips.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      f43a54a0
    • Eric W. Biederman's avatar
      signal/microblaze: Use force_sig_fault where appropriate · 6f467986
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Michal Simek <monstr@monstr.eu>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      6f467986
    • Eric W. Biederman's avatar
      signal/microblaze: Remove the commented out force_sig_info in do_page_fault · ceb91ed1
      Eric W. Biederman authored
      Remove the commented out call to force_sig_info right after a call to
      _exception in do_page_fault.  The function _exception does exactly the
      work the commented out code does so there is no reason for the
      commented out code.
      
      Cc: Michal Simek <monstr@monstr.eu>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      ceb91ed1
    • Eric W. Biederman's avatar
      signal/m68k: Use force_sig_fault where appropriate · 3c67075d
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: linux-m68k@lists.linux-m68k.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      3c67075d
    • Eric W. Biederman's avatar
      signal/hexagon: Use force_sig_fault as appropriate · 1a4bd979
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: linux-hexagon@vger.kernel.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      1a4bd979
    • Eric W. Biederman's avatar
      signal/c6x: Use force_sig_fault where appropriate · 559f9008
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Aurelien Jacquiot <jacquiot.aurelien@gmail.com>
      Cc: linux-c6x-dev@linux-c6x.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      559f9008
    • Eric W. Biederman's avatar
      signal/alpha: Use force_sig_fault where appropriate · e4d90ee3
      Eric W. Biederman authored
      Filling in struct siginfo before calling force_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper force_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls force_sig_info.
      
      In short about a 5 line reduction in code for every time force_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: linux-alpha@vger.kernel.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      e4d90ee3
    • Eric W. Biederman's avatar
      signal/alpha: Use send_sig_fault where appropriate · 5f50245b
      Eric W. Biederman authored
      Filling in struct siginfo before calling send_sig_info a tedious and
      error prone process, where once in a great while the wrong fields
      are filled out, and siginfo has been inconsistently cleared.
      
      Simplify this process by using the helper send_sig_fault.  Which
      takes as a parameters all of the information it needs, ensures
      all of the fiddly bits of filling in struct siginfo are done properly
      and then calls send_sig_info.
      
      In short about a 5 line reduction in code for every time send_sig_info
      is called, which makes the calling function clearer.
      
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: linux-alpha@vger.kernel.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      5f50245b
    • Eric W. Biederman's avatar
      signal/powerpc: Replace TRAP_FIXME with TRAP_UNK · e821fa42
      Eric W. Biederman authored
      Using an si_code of 0 that aliases with SI_USER is clearly the wrong
      thing todo, and causes problems in interesting ways.
      
      For use in unknown_exception the recently defined TRAP_UNK
      semantically is a perfect fit.  For use in RunModeException it looks
      like something more specific than TRAP_UNK could be used.  No one has
      bothered to find a better fit than the broken si_code of 0 in all of
      these years and I don't see an obvious better fit so TRAP_UNK is
      switching RunModeException to return TRAP_UNK is clearly an
      improvement.
      
      Recent history suggests no actually cares about crazy corner
      cases of the kernel behavior like this so I don't expect any
      regressions from changing this.  However if something does
      happen this change is easy to revert.
      
      Though I wonder if SIGKILL might not be a better fit.
      
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Kumar Gala <kumar.gala@freescale.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Fixes: 9bad068c ("[PATCH] ppc32: support for e500 and 85xx")
      Fixes: 0ed70f61 ("PPC32: Provide proper siginfo information on various exceptions.")
      History Tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.gitSigned-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      e821fa42
    • Eric W. Biederman's avatar
      signal/alpha: Replace TRAP_FIXME with TRAP_UNK · 535906c6
      Eric W. Biederman authored
      Using an si_code of 0 that aliases with SI_USER is clearly the wrong
      thing to do, and causes problems in interesting ways.
      
      For it really is not clear to me if using TRAP_UNK bugcheck or
      the default case of gentrap is really the best way to handle
      things.  There is certainly enough information that that a more
      specific si_code could potentially be used.  That said TRAP_UNK
      is definitely an improvement over 0 as it removes the ambiguiuty
      of what si_code of 0 with SIGTRAP means on alpha.
      
      Recent history suggests no actually cares about crazy corner cases of
      the kernel behavior like this so I don't expect any regressions from
      changing this.  However if something does happen this change is easy
      to revert.
      
      Cc: Helge Deller <deller@gmx.de>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: linux-alpha@vger.kernel.org
      Fixes: 0a635c7a ("Fill in siginfo_t.")
      History Tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.gitSigned-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      535906c6
    • Eric W. Biederman's avatar
      signal: Add TRAP_UNK si_code for undiagnosted trap exceptions · db78e6a0
      Eric W. Biederman authored
      Both powerpc and alpha have cases where they wronly set si_code to 0
      in combination with SIGTRAP and don't mean SI_USER.
      
      About half the time this is because the architecture can not report
      accurately what kind of trap exception triggered the trap exception.
      The other half the time it looks like no one has bothered to
      figure out an appropriate si_code.
      
      For the cases where the architecture does not have enough information
      or is too lazy to figure out exactly what kind of trap exception
      it is define TRAP_UNK.
      
      Cc: linux-api@vger.kernel.org
      Cc: linux-arch@vger.kernel.org
      Cc: linux-alpha@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      db78e6a0
    • Eric W. Biederman's avatar
      signal/unicore32: Use FPE_FLTUNK instead of 0 in ucf64_raise_sigfpe · d8f7f322
      Eric W. Biederman authored
      The si_code of 0 (aka SI_USER) has fields si_pid and si_uid not
      si_addr so it so only by luck would the appropriate fields by copied
      to userspace by copy_siginfo_to_user.
      
      This is just broken and wrong.
      
      Make it obvious what is happening by moving the si_code from a
      parameter of the one call to ucf64_raise_sigfpe to a constant value
      that info.si_code gets set to.
      
      Explicitly set the si_code to FPE_FLTUNK the newly reserved floating
      point si_code for an unknown floating point exception.
      
      It looks like there is a fair chance that this is a code path that has
      never been used in real life on unicore32.  The bad si_code and the
      print statement that calls it an unhandled exception.  So I really
      don't expect anyone will mind if this just gets fixed.
      
      In similar situations on more popular architectures the conclusion was
      just fix it.
      
      Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Fixes: d9bc1579 ("unicore32 additional architecture files: float point handling")
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      d8f7f322
    • Eric W. Biederman's avatar
      signal/powerpc: Replace FPE_FIXME with FPE_FLTUNK · aeb1c0f6
      Eric W. Biederman authored
      Using an si_code of 0 that aliases with SI_USER is clearly the
      wrong thing todo, and causes problems in interesting ways.
      
      The newly defined FPE_FLTUNK semantically appears to fit the
      bill so use it instead.
      
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Kumar Gala <kumar.gala@freescale.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc:  linuxppc-dev@lists.ozlabs.org
      Fixes: 9bad068c ("[PATCH] ppc32: support for e500 and 85xx")
      Fixes: 0ed70f61 ("PPC32: Provide proper siginfo information on various exceptions.")
      History Tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.gitSigned-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      aeb1c0f6
    • Eric W. Biederman's avatar
      signal/ia64: Replace FPE_FIXME with FPE_FLTUNK · 51dd709f
      Eric W. Biederman authored
      Using an si_code of 0 that aliases with SI_USER is clearly the wrong
      thing todo, and causes problems in interesting ways.
      
      The newly defined FPE_FLTUNK semantically appears to fit the bill so
      use it instead.
      
      Given recent experience in this area odds are it will not
      break anything.  Fixing it removes a hazard to kernel maintenance.
      
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: linux-ia64@vger.kernel.org
      Fixes: 987159266c45 ("Linux version 2.3.48")
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      51dd709f
    • Eric W. Biederman's avatar
      signal/alpha: Replace FPE_FIXME with FPE_FLTUNK · 4cc13e4f
      Eric W. Biederman authored
      Using an si_code of 0 that aliases with SI_USER is clearly the wrong
      thing todo, and causes problems in interesting ways.
      
      The newly defined FPE_FLTUNK semantically appears to fit the bill so
      use it instead.
      
      Given recent experience in this area odds are it will not break
      anything.  Fixing it removes a hazard to kernel maintenance.
      
      Cc: Helge Deller <deller@gmx.de>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: linux-alpha@vger.kernel.org
      History Tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
      Fixes: 0a635c7a ("Fill in siginfo_t.")
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      4cc13e4f
    • Eric W. Biederman's avatar
      signal: Remove ifdefs for BUS_MCEERR_AR and BUS_MCEERR_AO · 4181d225
      Eric W. Biederman authored
      With the recent architecture cleanups these si_codes are always
      defined so there is no need to test for them.
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      4181d225
    • Eric W. Biederman's avatar
      signal: Remove SEGV_BNDERR ifdefs · 3a11ab14
      Eric W. Biederman authored
      After the last round of cleanups to siginfo.h SEGV_BNDERR is defined
      on all architectures so testing to see if it is defined is unnecessary.
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      3a11ab14
    • Eric W. Biederman's avatar
      signal: Stop special casing TRAP_FIXME and FPE_FIXME in siginfo_layout · 0c362f96
      Eric W. Biederman authored
      After more experience with the cases where no one the si_code of 0
      is used both as a signal specific si_code, and as SI_USER it appears
      that no one cares about the signal specific si_code case and the
      good solution is to just fix the architectures by using
      a different si_code.
      
      In none of the conversations has anyone even suggested that
      anything depends on the signal specific redefinition of SI_USER.
      
      There are at least test cases that care when si_code as 0 does
      not work as si_user.
      
      So make things simple and keep the generic code from introducing
      problems by removing the special casing of TRAP_FIXME and FPE_FIXME.
      This will ensure the generic case of sending a signal with
      kill will always set SI_USER and work.
      
      The architecture specific, and signal specific overloads that
      set si_code to 0 will now have problems with signalfd and
      the 32bit compat versions of siginfo copying.   At least
      until they are fixed.
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      0c362f96
    • Eric W. Biederman's avatar
      signal: Reduce copy_siginfo_to_user to just copy_to_user · c999b933
      Eric W. Biederman authored
      Now that every instance of struct siginfo is now initialized it is no
      longer necessary to copy struct siginfo piece by piece to userspace
      but instead the entire structure can be copied.
      
      As well as making the code simpler and more efficient this means that
      copy_sinfo_to_user no longer cares which union member of struct
      siginfo is in use.
      
      In practice this means that all 32bit architectures that define
      FPE_FIXME will handle properly send SI_USER when kill(SIGFPE) is sent.
      While still performing their historic architectural brokenness when 0
      is used a floating pointer signal.  This matches the current behavior
      of 64bit architectures that define FPE_FIXME who get lucky and an
      overloaded SI_USER has continuted to work through copy_siginfo_to_user
      because the 8 byte si_addr occupies the same bytes in struct siginfo
      as the 4 byte si_pid and the 4 byte si_uid.
      
      Problematic architectures still need to fix their ABI so that signalfd
      and 32bit compat code will work properly.
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      c999b933
    • Eric W. Biederman's avatar
      signal: Ensure every siginfo we send has all bits initialized · 3eb0f519
      Eric W. Biederman authored
      Call clear_siginfo to ensure every stack allocated siginfo is properly
      initialized before being passed to the signal sending functions.
      
      Note: It is not safe to depend on C initializers to initialize struct
      siginfo on the stack because C is allowed to skip holes when
      initializing a structure.
      
      The initialization of struct siginfo in tracehook_report_syscall_exit
      was moved from the helper user_single_step_siginfo into
      tracehook_report_syscall_exit itself, to make it clear that the local
      variable siginfo gets fully initialized.
      
      In a few cases the scope of struct siginfo has been reduced to make it
      clear that siginfo siginfo is not used on other paths in the function
      in which it is declared.
      
      Instances of using memset to initialize siginfo have been replaced
      with calls clear_siginfo for clarity.
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      3eb0f519
    • Eric W. Biederman's avatar
      signal/nds32: Use force_sig(SIGILL) in do_revisn · f6ed1eca
      Eric W. Biederman authored
      As originally committed do_revisn would deliver a siginfo for SIGILL
      with an si_code composed of random stack contents.  That makes no
      sense and is not something userspace can depend on.  So simplify
      the code and just use "force_sig(SIG_ILL, current)" instead.
      
      Fixes: 2923f5ea ("nds32: Exception handling")
      Cc: Vincent Chen <vincentc@andestech.com>
      Cc: Greentime Hu <greentime@andestech.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      f6ed1eca
    • Eric W. Biederman's avatar
      signal/nds32: Use force_sig in unhandled_interruption and unhandled_exceptions · be5c2ff0
      Eric W. Biederman authored
      Neither unhandled_interrupt nor unhandled_exceptions fills in any of the
      siginfo fields whend sending SIGKILL.  Further because it is SIGKILL
      even if all of the fields were filled out appropriately it would be impossible
      for the process to read any of the siginfo fields.  So simplfy things and
      just use force_sig instead of force_sig_info.
      
      Fixes: 2923f5ea ("nds32: Exception handling")
      Cc: Vincent Chen <vincentc@andestech.com>
      Cc: Greentime Hu <greentime@andestech.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarVincent Chen <vincentc@andestech.com>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      be5c2ff0
  2. 19 Apr, 2018 2 commits
    • Eric W. Biederman's avatar
      signal/sh: Use force_sig_fault in hw_breakpoint_handler · 195bce73
      Eric W. Biederman authored
      The call chain is:
      breakpoint
        notify_die
          hw_breakpoint_exceptions_notify
            hw_breakpoint_handler
      
      So the signal number can only be SIGTRAP.
      
      In hw_breakpoint_handler rc is either NOTIFY_STOP or NOTIF_DONE
      both of which notifier_to_errno converts to 0.  So si_errno is 0.
      
      Historically si_addr was left unitialized in struct siginfo which is a
      bug.  There appears to be no consensus among the various architectures
      which value should be in si_addr.  So since no usable value has
      been returned up to this point return NULL in si_addr.
      
      Fixes: 4352fc1b ("sh: Abstracted SH-4A UBC support on hw-breakpoint core.")
      Fixes: 34d0b5af ("sh: Convert ptrace to hw_breakpoint API.")
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: linux-sh@vger.kernel.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      195bce73
    • Dmitry V. Levin's avatar
      sparc: fix compat siginfo ABI regression · 32772c9e
      Dmitry V. Levin authored
      Starting with commit v4.14-rc1~60^2^2~1, a SIGFPE signal sent via kill
      results to wrong values in si_pid and si_uid fields of compat siginfo_t.
      
      This happens due to FPE_FIXME being defined to 0 for sparc, and at the
      same time siginfo_layout() introduced by the same commit returns
      SIL_FAULT for SIGFPE if si_code == SI_USER and FPE_FIXME is defined to 0.
      
      Fix this regression by removing FPE_FIXME macro and changing all its users
      to assign FPE_FLTUNK to si_code instead of FPE_FIXME.
      
      Note that FPE_FLTUNK is a new macro introduced by commit
      266da65e.
      
      Tested with commit v4.16-11958-g16e205cf.
      
      This bug was found by strace test suite.
      
      In the discussion about FPE_FLTUNK on sparc David Miller said:
      > Eric, feel free to do something similar on Sparc.
      
      Link: https://github.com/strace/strace/issues/21
      Fixes: cc731525 ("signal: Remove kernel interal si_code magic")
      Fixes: 2.3.41
      Cc: David Miller <davem@davemloft.net>
      Cc: sparclinux@vger.kernel.org
      Conceptually-Acked-By: default avatarDavid Miller <davem@davemloft.net>
      Thanks-to: Anatoly Pugachev <matorola@gmail.com>
      Signed-off-by: default avatarDmitry V. Levin <ldv@altlinux.org>
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      32772c9e
  3. 17 Apr, 2018 1 commit
  4. 16 Apr, 2018 5 commits
    • Linus Torvalds's avatar
      Linux 4.17-rc1 · 60cc43fc
      Linus Torvalds authored
      60cc43fc
    • Linus Torvalds's avatar
      Merge tag 'for-4.17-part2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · e37563bb
      Linus Torvalds authored
      Pull more btrfs updates from David Sterba:
       "We have queued a few more fixes (error handling, log replay,
        softlockup) and the rest is SPDX updates that touche almost all files
        so the diffstat is long"
      
      * tag 'for-4.17-part2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: Only check first key for committed tree blocks
        btrfs: add SPDX header to Kconfig
        btrfs: replace GPL boilerplate by SPDX -- sources
        btrfs: replace GPL boilerplate by SPDX -- headers
        Btrfs: fix loss of prealloc extents past i_size after fsync log replay
        Btrfs: clean up resources during umount after trans is aborted
        btrfs: Fix possible softlock on single core machines
        Btrfs: bail out on error during replay_dir_deletes
        Btrfs: fix NULL pointer dereference in log_dir_items
      e37563bb
    • Linus Torvalds's avatar
      Merge tag '4.17-rc1SMB3-Fixes' of git://git.samba.org/sfrench/cifs-2.6 · 09c9b0ea
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "SMB3 fixes, a few for stable, and some important cleanup work from
        Ronnie of the smb3 transport code"
      
      * tag '4.17-rc1SMB3-Fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: change validate_buf to validate_iov
        cifs: remove rfc1002 hardcoded constants from cifs_discard_remaining_data()
        cifs: Change SMB2_open to return an iov for the error parameter
        cifs: add resp_buf_size to the mid_q_entry structure
        smb3.11: replace a 4 with server->vals->header_preamble_size
        cifs: replace a 4 with server->vals->header_preamble_size
        cifs: add pdu_size to the TCP_Server_Info structure
        SMB311: Improve checking of negotiate security contexts
        SMB3: Fix length checking of SMB3.11 negotiate request
        CIFS: add ONCE flag for cifs_dbg type
        cifs: Use ULL suffix for 64-bit constant
        SMB3: Log at least once if tree connect fails during reconnect
        cifs: smb2pdu: Fix potential NULL pointer dereference
      09c9b0ea
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · f0d98d85
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "This is a set of minor (and safe changes) that didn't make the initial
        pull request plus some bug fixes.
      
        The status handling code is actually a running regression from the
        previous merge window which had an incomplete fix (now reverted) and
        most of the remaining bug fixes are for problems older than the
        current merge window"
      
      [ Side note: this merge also takes the base kernel git repository to 6+
        million objects for the first time. Technically we hit it a couple of
        merges ago already if you count all the tag objects, but now it
        reaches 6M+ objects reachable from HEAD.
      
        I was joking around that that's when I should switch to 5.0, because
        3.0 happened at the 2M mark, and 4.0 happened at 4M objects. But
        probably not, even if numerology is about as good a reason as any.
      
                                                                    - Linus ]
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: devinfo: Add Microsoft iSCSI target to 1024 sector blacklist
        scsi: cxgb4i: silence overflow warning in t4_uld_rx_handler()
        scsi: dpt_i2o: Use after free in I2ORESETCMD ioctl
        scsi: core: Make scsi_result_to_blk_status() recognize CONDITION MET
        scsi: core: Rename __scsi_error_from_host_byte() into scsi_result_to_blk_status()
        Revert "scsi: core: return BLK_STS_OK for DID_OK in __scsi_error_from_host_byte()"
        scsi: aacraid: Insure command thread is not recursively stopped
        scsi: qla2xxx: Correct setting of SAM_STAT_CHECK_CONDITION
        scsi: qla2xxx: correctly shift host byte
        scsi: qla2xxx: Fix race condition between iocb timeout and initialisation
        scsi: qla2xxx: Avoid double completion of abort command
        scsi: qla2xxx: Fix small memory leak in qla2x00_probe_one on probe failure
        scsi: scsi_dh: Don't look for NULL devices handlers by name
        scsi: core: remove redundant assignment to shost->use_blk_mq
      f0d98d85
    • Linus Torvalds's avatar
      Merge tag 'kbuild-v4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild · ca71b3ba
      Linus Torvalds authored
      Pull more Kbuild updates from Masahiro Yamada:
      
       - pass HOSTLDFLAGS when compiling single .c host programs
      
       - build genksyms lexer and parser files instead of using shipped
         versions
      
       - rename *-asn1.[ch] to *.asn1.[ch] for suffix consistency
      
       - let the top .gitignore globally ignore artifacts generated by flex,
         bison, and asn1_compiler
      
       - let the top Makefile globally clean artifacts generated by flex,
         bison, and asn1_compiler
      
       - use safer .SECONDARY marker instead of .PRECIOUS to prevent
         intermediate files from being removed
      
       - support -fmacro-prefix-map option to make __FILE__ a relative path
      
       - fix # escaping to prepare for the future GNU Make release
      
       - clean up deb-pkg by using debian tools instead of handrolled
         source/changes generation
      
       - improve rpm-pkg portability by supporting kernel-install as a
         fallback of new-kernel-pkg
      
       - extend Kconfig listnewconfig target to provide more information
      
      * tag 'kbuild-v4.17-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kconfig: extend output of 'listnewconfig'
        kbuild: rpm-pkg: use kernel-install as a fallback for new-kernel-pkg
        Kbuild: fix # escaping in .cmd files for future Make
        kbuild: deb-pkg: split generating packaging and build
        kbuild: use -fmacro-prefix-map to make __FILE__ a relative path
        kbuild: mark $(targets) as .SECONDARY and remove .PRECIOUS markers
        kbuild: rename *-asn1.[ch] to *.asn1.[ch]
        kbuild: clean up *-asn1.[ch] patterns from top-level Makefile
        .gitignore: move *-asn1.[ch] patterns to the top-level .gitignore
        kbuild: add %.dtb.S and %.dtb to 'targets' automatically
        kbuild: add %.lex.c and %.tab.[ch] to 'targets' automatically
        genksyms: generate lexer and parser during build instead of shipping
        kbuild: clean up *.lex.c and *.tab.[ch] patterns from top-level Makefile
        .gitignore: move *.lex.c *.tab.[ch] patterns to the top-level .gitignore
        kbuild: use HOSTLDFLAGS for single .c executables
      ca71b3ba
  5. 15 Apr, 2018 2 commits
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9fb71c2f
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "A set of fixes and updates for x86:
      
         - Address a swiotlb regression which was caused by the recent DMA
           rework and made driver fail because dma_direct_supported() returned
           false
      
         - Fix a signedness bug in the APIC ID validation which caused invalid
           APIC IDs to be detected as valid thereby bloating the CPU possible
           space.
      
         - Fix inconsisten config dependcy/select magic for the MFD_CS5535
           driver.
      
         - Fix a corruption of the physical address space bits when encryption
           has reduced the address space and late cpuinfo updates overwrite
           the reduced bit information with the original value.
      
         - Dominiks syscall rework which consolidates the architecture
           specific syscall functions so all syscalls can be wrapped with the
           same macros. This allows to switch x86/64 to struct pt_regs based
           syscalls. Extend the clearing of user space controlled registers in
           the entry patch to the lower registers"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/apic: Fix signedness bug in APIC ID validity checks
        x86/cpu: Prevent cpuinfo_x86::x86_phys_bits adjustment corruption
        x86/olpc: Fix inconsistent MFD_CS5535 configuration
        swiotlb: Use dma_direct_supported() for swiotlb_ops
        syscalls/x86: Adapt syscall_wrapper.h to the new syscall stub naming convention
        syscalls/core, syscalls/x86: Rename struct pt_regs-based sys_*() to __x64_sys_*()
        syscalls/core, syscalls/x86: Clean up compat syscall stub naming convention
        syscalls/core, syscalls/x86: Clean up syscall stub naming convention
        syscalls/x86: Extend register clearing on syscall entry to lower registers
        syscalls/x86: Unconditionally enable 'struct pt_regs' based syscalls on x86_64
        syscalls/x86: Use 'struct pt_regs' based syscall calling for IA32_EMULATION and x32
        syscalls/core: Prepare CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y for compat syscalls
        syscalls/x86: Use 'struct pt_regs' based syscall calling convention for 64-bit syscalls
        syscalls/core: Introduce CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
        x86/syscalls: Don't pointlessly reload the system call number
        x86/mm: Fix documentation of module mapping range with 4-level paging
        x86/cpuid: Switch to 'static const' specifier
      9fb71c2f
    • Linus Torvalds's avatar
      Merge branch 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 6b0a02e8
      Linus Torvalds authored
      Pull x86 pti updates from Thomas Gleixner:
       "Another series of PTI related changes:
      
         - Remove the manual stack switch for user entries from the idtentry
           code. This debloats entry by 5k+ bytes of text.
      
         - Use the proper types for the asm/bootparam.h defines to prevent
           user space compile errors.
      
         - Use PAGE_GLOBAL for !PCID systems to gain back performance
      
         - Prevent setting of huge PUD/PMD entries when the entries are not
           leaf entries otherwise the entries to which the PUD/PMD points to
           and are populated get lost"
      
      * 'x86-pti-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/pgtable: Don't set huge PUD/PMD on non-leaf entries
        x86/pti: Leave kernel text global for !PCID
        x86/pti: Never implicitly clear _PAGE_GLOBAL for kernel image
        x86/pti: Enable global pages for shared areas
        x86/mm: Do not forbid _PAGE_RW before init for __ro_after_init
        x86/mm: Comment _PAGE_GLOBAL mystery
        x86/mm: Remove extra filtering in pageattr code
        x86/mm: Do not auto-massage page protections
        x86/espfix: Document use of _PAGE_GLOBAL
        x86/mm: Introduce "default" kernel PTE mask
        x86/mm: Undo double _PAGE_PSE clearing
        x86/mm: Factor out pageattr _PAGE_GLOBAL setting
        x86/entry/64: Drop idtentry's manual stack switch for user entries
        x86/uapi: Fix asm/bootparam.h userspace compilation errors
      6b0a02e8