23 Sep, 2017

1 commit

  • Commit 24587380f61d ("parisc: Add MADV_HWPOISON and MADV_SOFT_OFFLINE") added
    the necessary constants to handle hardware-poisoning. Those were needed to
    support the page deallocation feature from firmware.

    But I completely missed to add the relevant fault handler code. This now
    showed up when I ran the madvise07 testcase from the Linux Test Project,
    which failed with a kernel BUG at arch/parisc/mm/fault.c:320.

    With this patch the parisc kernel now behaves like other platforms and
    gives the same kernel syslog warnings when poisoning pages.

    Signed-off-by: Helge Deller

    Helge Deller
     

03 Jul, 2017

1 commit

  • When a process runs out of stack the parisc kernel wrongly faults with SIGBUS
    instead of the expected SIGSEGV signal.

    This example shows how the kernel faults:
    do_page_fault() command='a.out' type=15 address=0xfaac2000 in libc-2.24.so[f8308000+16c000]
    trap #15: Data TLB miss fault, vm_start = 0xfa2c2000, vm_end = 0xfaac2000

    The vma->vm_end value is the first address which does not belong to the vma, so
    adjust the check to include vma->vm_end to the range for which to send the
    SIGSEGV signal.

    This patch unbreaks building the debian libsigsegv package.

    Cc: stable@vger.kernel.org
    Signed-off-by: Helge Deller

    Helge Deller
     

09 Jun, 2017

1 commit


10 May, 2017

1 commit


30 Mar, 2017

1 commit

  • Al Viro noticed that userspace accesses via get_user()/put_user() can be
    simplified a lot with regard to usage of the exception handling.

    This patch implements a fixup routine for get_user() and put_user() in such
    that the exception handler will automatically load -EFAULT into the register
    %r8 (the error value) in case on a fault on userspace. Additionally the fixup
    routine will zero the target register on fault in case of a get_user() call.
    The target register is extracted out of the faulting assembly instruction.

    This patch brings a few benefits over the old implementation:
    1. Exception handling gets much cleaner, easier and smaller in size.
    2. Helper functions like fixup_get_user_skip_1 (all of fixup.S) can be dropped.
    3. No need to hardcode %r9 as target register for get_user() any longer. This
    helps the compiler register allocator and thus creates less assembler
    statements.
    4. No dependency on the exception_data contents any longer.
    5. Nested faults will be handled cleanly.

    Reported-by: Al Viro
    Cc: # v4.9+
    Signed-off-by: Helge Deller

    Helge Deller
     

04 Mar, 2017

1 commit

  • Pull parisc fixes and cleanups from Helge Deller:
    "Nothing really important in this patchset: fix resource leaks in error
    paths, coding style cleanups and code removal"

    * 'parisc-4.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
    parisc: Remove flush_user_dcache_range and flush_user_icache_range
    parisc: fix a printk
    parisc: ccio-dma: Handle return NULL error from ioremap_nocache
    parisc: Define access_ok() as macro
    parisc: eisa: Fix resource leaks in error paths
    parisc: eisa: Remove coding style errors

    Linus Torvalds
     

02 Mar, 2017

1 commit


26 Feb, 2017

1 commit

  • We want to do a pr_cont() here and not a pr_warn().

    Fixes: b391667eb45a ("parisc: Report trap type as human readable string")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Helge Deller

    Dan Carpenter
     

03 Jan, 2017

1 commit


12 Oct, 2016

1 commit


08 Oct, 2016

1 commit

  • This file was only including module.h for exception table related
    functions. We've now separated that content out into its own file
    "extable.h" so now move over to that and avoid all the extra header
    content in module.h that we don't really need to compile this file.

    Cc: "James E.J. Bottomley"
    Cc: Helge Deller
    Cc: linux-parisc@vger.kernel.org
    Signed-off-by: Paul Gortmaker
    Signed-off-by: Helge Deller

    Paul Gortmaker
     

25 Sep, 2016

1 commit

  • When faulting on some trap, the kernel currently reports in dmesg:

    do_page_fault() command='perl' type=6 address=0xbe400403 in libcrypt-2.24.so[f9086000+9000]
    vm_start = 0x00922000, vm_end = 0x00aed000

    With this change the trap type additionally gets reported as human readable
    string which makes it simpler to recognize the type of problem:

    do_page_fault() command='perl' type=6 address=0xbe400403 in libcrypt-2.24.so[f9086000+9000]
    trap #6: Instruction TLB miss fault, vm_start = 0x00922000, vm_end = 0x00aed000

    Signed-off-by: Helge Deller

    Helge Deller
     

27 Jul, 2016

1 commit


09 Apr, 2016

1 commit

  • Handling exceptions from modules never worked on parisc.
    It was just masked by the fact that exceptions from modules
    don't happen during normal use.

    When a module triggers an exception in get_user() we need to load the
    main kernel dp value before accessing the exception_data structure, and
    afterwards restore the original dp value of the module on exit.

    Noticed-by: Mikulas Patocka
    Signed-off-by: Helge Deller
    Cc: stable@vger.kernel.org

    Helge Deller
     

23 Mar, 2016

1 commit


08 Sep, 2015

1 commit


19 May, 2015

1 commit

  • Introduce faulthandler_disabled() and use it to check for irq context and
    disabled pagefaults (via pagefault_disable()) in the pagefault handlers.

    Please note that we keep the in_atomic() checks in place - to detect
    whether in irq context (in which case preemption is always properly
    disabled).

    In contrast, preempt_disable() should never be used to disable pagefaults.
    With !CONFIG_PREEMPT_COUNT, preempt_disable() doesn't modify the preempt
    counter, and therefore the result of in_atomic() differs.
    We validate that condition by using might_fault() checks when calling
    might_sleep().

    Therefore, add a comment to faulthandler_disabled(), describing why this
    is needed.

    faulthandler_disabled() and pagefault_disable() are defined in
    linux/uaccess.h, so let's properly add that include to all relevant files.

    This patch is based on a patch from Thomas Gleixner.

    Reviewed-and-tested-by: Thomas Gleixner
    Signed-off-by: David Hildenbrand
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: David.Laight@ACULAB.COM
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: airlied@linux.ie
    Cc: akpm@linux-foundation.org
    Cc: benh@kernel.crashing.org
    Cc: bigeasy@linutronix.de
    Cc: borntraeger@de.ibm.com
    Cc: daniel.vetter@intel.com
    Cc: heiko.carstens@de.ibm.com
    Cc: herbert@gondor.apana.org.au
    Cc: hocko@suse.cz
    Cc: hughd@google.com
    Cc: mst@redhat.com
    Cc: paulus@samba.org
    Cc: ralf@linux-mips.org
    Cc: schwidefsky@de.ibm.com
    Cc: yang.shi@windriver.com
    Link: http://lkml.kernel.org/r/1431359540-32227-7-git-send-email-dahi@linux.vnet.ibm.com
    Signed-off-by: Ingo Molnar

    David Hildenbrand
     

30 Jan, 2015

1 commit

  • The core VM already knows about VM_FAULT_SIGBUS, but cannot return a
    "you should SIGSEGV" error, because the SIGSEGV case was generally
    handled by the caller - usually the architecture fault handler.

    That results in lots of duplication - all the architecture fault
    handlers end up doing very similar "look up vma, check permissions, do
    retries etc" - but it generally works. However, there are cases where
    the VM actually wants to SIGSEGV, and applications _expect_ SIGSEGV.

    In particular, when accessing the stack guard page, libsigsegv expects a
    SIGSEGV. And it usually got one, because the stack growth is handled by
    that duplicated architecture fault handler.

    However, when the generic VM layer started propagating the error return
    from the stack expansion in commit fee7e49d4514 ("mm: propagate error
    from stack expansion even for guard page"), that now exposed the
    existing VM_FAULT_SIGBUS result to user space. And user space really
    expected SIGSEGV, not SIGBUS.

    To fix that case, we need to add a VM_FAULT_SIGSEGV, and teach all those
    duplicate architecture fault handlers about it. They all already have
    the code to handle SIGSEGV, so it's about just tying that new return
    value to the existing code, but it's all a bit annoying.

    This is the mindless minimal patch to do this. A more extensive patch
    would be to try to gather up the mostly shared fault handling logic into
    one generic helper routine, and long-term we really should do that
    cleanup.

    Just from this patch, you can generally see that most architectures just
    copied (directly or indirectly) the old x86 way of doing things, but in
    the meantime that original x86 model has been improved to hold the VM
    semaphore for shorter times etc and to handle VM_FAULT_RETRY and other
    "newer" things, so it would be a good idea to bring all those
    improvements to the generic case and teach other architectures about
    them too.

    Reported-and-tested-by: Takashi Iwai
    Tested-by: Jan Engelhardt
    Acked-by: Heiko Carstens # "s390 still compiles and boots"
    Cc: linux-arch@vger.kernel.org
    Cc: stable@vger.kernel.org
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

20 May, 2014

1 commit

  • Pull parisc fixes from Helge Deller:
    "There are two patches in here:

    The first patch greatly improves latency and corrects the memory
    ordering in our light-weight atomic locking syscall.

    The second patch ratelimits printing of userspace segfaults in the
    same way as it's done on other platforms. This fixes a possible DOS
    on parisc since it prevents the syslog to grow too fast. For example,
    when the debian acl2 package was built on our debian buildd servers,
    this package produced lots of gigabytes in syslog in very short time
    and thus filled our harddisks, which then turned the server nearly
    completely unaccessible and unresponsive"

    * 'parisc-3.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
    parisc: Improve LWS-CAS performance
    parisc: ratelimit userspace segfault printing

    Linus Torvalds
     

16 May, 2014

1 commit

  • Ratelimit printing of userspace segfaults and make it runtime
    configurable via the /proc/sys/debug/exception-trace variable. This
    should resolve syslog from growing way too fast and thus prevents
    possible system service attacks.

    Signed-off-by: Helge Deller
    Cc: stable@vger.kernel.org # 3.13+

    Helge Deller
     

04 Apr, 2014

1 commit


20 Nov, 2013

1 commit


08 Nov, 2013

2 commits

  • Clean up code to send correct signal on invalid memory accesses:
    Send SIGBUS instead of SIGSEGV for memory accesses outside of mmap'ed
    areas

    This fixes the mmap13 testcase from the Linux Test Project.

    Signed-off-by: Helge Deller

    Helge Deller
     
  • Provide a macro ASM_EXCEPTIONTABLE_ENTRY() to create exception table
    entries and convert all open-coded places to use that macro.

    This patch is a first step toward creating a exception table which only
    holds 32bit pointers even on a 64bit kernel. That way in my own kernel
    I was able to reduce the in-kernel exception table from 44kB to 22kB.

    Signed-off-by: Helge Deller

    Helge Deller
     

13 Oct, 2013

1 commit


01 Oct, 2013

1 commit

  • The FAULT_FLAG_WRITE flag has been set based on uninitialized variable.

    Fixes a regression added by commit 759496ba6407 ("arch: mm: pass
    userspace fault flag to generic fault handler")

    Signed-off-by: Felipe Pena
    Cc: Johannes Weiner
    Cc: Michal Hocko
    Cc: "James E.J. Bottomley"
    Cc: Helge Deller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Felipe Pena
     

13 Sep, 2013

1 commit

  • Unlike global OOM handling, memory cgroup code will invoke the OOM killer
    in any OOM situation because it has no way of telling faults occuring in
    kernel context - which could be handled more gracefully - from
    user-triggered faults.

    Pass a flag that identifies faults originating in user space from the
    architecture-specific fault handlers to generic code so that memcg OOM
    handling can be improved.

    Signed-off-by: Johannes Weiner
    Reviewed-by: Michal Hocko
    Cc: David Rientjes
    Cc: KAMEZAWA Hiroyuki
    Cc: azurIt
    Cc: KOSAKI Motohiro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Johannes Weiner
     

21 Feb, 2013

1 commit

  • Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
    (mm: retry page fault when blocking on disk transfer) and
    commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
    (x86,mm: make pagefault killable)

    The above commits introduced changes into the x86 pagefault handler
    for making the page fault handler retryable as well as killable.

    These changes reduce the mmap_sem hold time, which is crucial
    during OOM killer invocation.

    Port these changes to parisc.

    Signed-off-by: Kautuk Consul
    Signed-off-by: Helge Deller

    Kautuk Consul
     

30 May, 2010

1 commit

  • As explained in commit 1c0fe6e3bd, we want to call the architecture independent
    oom killer when getting an unexplained OOM from handle_mm_fault, rather than
    simply killing current.

    Cc: linux-parisc@vger.kernel.org
    Cc: linux-arch@vger.kernel.org
    Signed-off-by: Nick Piggin
    Acked-by: David Rientjes
    Signed-off-by: Kyle McMartin

    Nick Piggin
     

03 Jul, 2009

1 commit


22 Jun, 2009

1 commit

  • This allows the callers to now pass down the full set of FAULT_FLAG_xyz
    flags to handle_mm_fault(). All callers have been (mechanically)
    converted to the new calling convention, there's almost certainly room
    for architectures to clean up their code and then add FAULT_FLAG_RETRY
    when that support is added.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

06 Jan, 2009

1 commit

  • On Wed, Dec 17, 2008 at 11:46:05PM +0100, Helge Deller wrote:
    >

    Honestly, I can't decide whether to apply this. It really should never
    happen in the kernel, since the kernel can guarantee it won't get the
    access rights failure (highest privilege level, and can set %sr and
    %protid to whatever it wants.)

    It really genuinely is a bug that probably should panic the kernel. The
    only precedent I can easily see is x86 fixing up a bad iret with a
    general protection fault, which is more or less analogous to code 27
    here.

    On the other hand, taking the exception on a userspace access really
    isn't all that critical, and there's fundamentally little reason for the
    kernel not to SIGSEGV the process, and continue...

    Argh.

    (btw, I've instrumented my do_sys_poll with a pile of assertions that
    %cr8 << 1 == %sr3 == current->mm.context... let's see if where we're
    getting corrupted is deterministic, though, I would guess that it won't
    be.)

    Signed-off-by: Kyle McMartin

    Kyle McMartin
     

20 Oct, 2007

1 commit

  • One of the easiest things to isolate is the pid printed in kernel log.
    There was a patch, that made this for arch-independent code, this one makes
    so for arch/xxx files.

    It took some time to cross-compile it, but hopefully these are all the
    printks in arch code.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Pavel Emelyanov
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

17 Oct, 2007

1 commit

  • We have had complaints where a threaded application is left in a bad state
    after one of it's threads is killed when we hit a VM: out_of_memory
    condition.

    Killing just one of the process threads can leave the application in a bad
    state, whereas killing the entire process group would allow for the
    application to restart, or be otherwise handled, and makes it very obvious
    that something has gone wrong.

    This change allows the entire process group to be taken down, rather
    than just the one thread.

    Signed-off-by: Will Schmidt
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Russell King
    Cc: Ian Molton
    Cc: Haavard Skinnemoen
    Cc: Mikael Starvik
    Cc: David Howells
    Cc: Andi Kleen
    Cc: "Luck, Tony"
    Cc: Hirokazu Takata
    Cc: Geert Uytterhoeven
    Cc: Roman Zippel
    Cc: Ralf Baechle
    Cc: Kyle McMartin
    Cc: Matthew Wilcox
    Cc: Paul Mackerras
    Cc: Benjamin Herrenschmidt
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Cc: Paul Mundt
    Cc: Kazumoto Kojima
    Cc: Richard Curnow
    Cc: William Lee Irwin III
    Cc: "David S. Miller"
    Cc: Chris Zankel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Will Schmidt
     

20 Jul, 2007

1 commit

  • This patch completes Linus's wish that the fault return codes be made into
    bit flags, which I agree makes everything nicer. This requires requires
    all handle_mm_fault callers to be modified (possibly the modifications
    should go further and do things like fault accounting in handle_mm_fault --
    however that would be for another patch).

    [akpm@linux-foundation.org: fix alpha build]
    [akpm@linux-foundation.org: fix s390 build]
    [akpm@linux-foundation.org: fix sparc build]
    [akpm@linux-foundation.org: fix sparc64 build]
    [akpm@linux-foundation.org: fix ia64 build]
    Signed-off-by: Nick Piggin
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Russell King
    Cc: Ian Molton
    Cc: Bryan Wu
    Cc: Mikael Starvik
    Cc: David Howells
    Cc: Yoshinori Sato
    Cc: "Luck, Tony"
    Cc: Hirokazu Takata
    Cc: Geert Uytterhoeven
    Cc: Roman Zippel
    Cc: Greg Ungerer
    Cc: Matthew Wilcox
    Cc: Paul Mackerras
    Cc: Benjamin Herrenschmidt
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Cc: Paul Mundt
    Cc: Kazumoto Kojima
    Cc: Richard Curnow
    Cc: William Lee Irwin III
    Cc: "David S. Miller"
    Cc: Jeff Dike
    Cc: Paolo 'Blaisorblade' Giarrusso
    Cc: Miles Bader
    Cc: Chris Zankel
    Acked-by: Kyle McMartin
    Acked-by: Haavard Skinnemoen
    Acked-by: Ralf Baechle
    Acked-by: Andi Kleen
    Signed-off-by: Andrew Morton
    [ Still apparently needs some ARM and PPC loving - Linus ]
    Signed-off-by: Linus Torvalds

    Nick Piggin
     

17 Feb, 2007

1 commit


08 Dec, 2006

1 commit

  • In light of the recent pagefault and filemap_copy_from_user work I've gone
    through all the arch pagefault handlers to make sure the inc_preempt_count()
    'feature' works as expected.

    Several sections of code (including the new filemap_copy_from_user) rely on
    the fact that faults do not take locks under increased preempt count.

    arch/x86_64 - good
    arch/powerpc - good
    arch/cris - fixed
    arch/i386 - good
    arch/parisc - fixed
    arch/sh - good
    arch/sparc - good
    arch/s390 - good
    arch/m68k - fixed
    arch/ppc - good
    arch/alpha - fixed
    arch/mips - good
    arch/sparc64 - good
    arch/ia64 - good
    arch/arm - fixed
    arch/um - good
    arch/avr32 - good
    arch/h8300 - NA
    arch/m32r - good
    arch/v850 - good
    arch/frv - fixed
    arch/m68knommu - NA
    arch/arm26 - fixed
    arch/sh64 - fixed
    arch/xtensa - good

    Signed-off-by: Peter Zijlstra
    Acked-by: Nick Piggin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     

22 Apr, 2006

1 commit


04 Aug, 2005

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds