1. 25 Apr, 2018 35 commits
    • Eric W. Biederman's avatar
      signal/xtensa: Consistenly use SIGBUS in do_unaligned_user · 7de712cc
      Eric W. Biederman authored
      While working on changing this code to use force_sig_fault I
      discovered that do_unaliged_user is sets si_signo to SIGBUS and passes
      SIGSEGV to force_sig_info.  Which is just b0rked.
      
      The code is reporting a SIGBUS error so replace the SIGSEGV with SIGBUS.
      
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: linux-xtensa@linux-xtensa.org
      Cc: stable@vger.kernel.org
      Acked-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
      Fixes: 5a0015d6 ("[PATCH] xtensa: Architecture support for Tensilica Xtensa Part 3")
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      7de712cc
    • Eric W. Biederman's avatar
      signal/um: Use force_sig_fault where appropriate · bc08c078
      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: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: user-mode-linux-devel@lists.sourceforge.net
      Cc: linux-um@lists.infradead.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      bc08c078
    • Eric W. Biederman's avatar
      signal/sparc: Use force_sig_fault where appropriate · d1f5bef6
      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: David Miller <davem@davemloft.net>
      Cc: sparclinux@vger.kernel.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      d1f5bef6
    • Eric W. Biederman's avatar
      signal/sparc: Use send_sig_fault where appropriate · 0e3d9f1e
      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: David Miller <davem@davemloft.net>
      Cc: sparclinux@vger.kernel.org
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      0e3d9f1e
    • Eric W. Biederman's avatar
      signal/sh: Use force_sig_fault where appropriate · c65626c0
      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: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Rich Felker <dalias@libc.org>
      Cc: linux-sh@vger.kernel.org
      Acked-by: default avatarRich Felker <dalias@libc.org>
      Signed-off-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      c65626c0
    • 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 2 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