28 Sep, 2016

1 commit


15 Sep, 2016

1 commit

  • Pull uaccess fixes from Al Viro:
    "Fixes for broken uaccess primitives - mostly lack of proper zeroing
    in copy_from_user()/get_user()/__get_user(), but for several
    architectures there's more (broken clear_user() on frv and
    strncpy_from_user() on hexagon)"

    * 'uaccess-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (28 commits)
    avr32: fix copy_from_user()
    microblaze: fix __get_user()
    microblaze: fix copy_from_user()
    m32r: fix __get_user()
    blackfin: fix copy_from_user()
    sparc32: fix copy_from_user()
    sh: fix copy_from_user()
    sh64: failing __get_user() should zero
    score: fix copy_from_user() and friends
    score: fix __get_user/get_user
    s390: get_user() should zero on failure
    ppc32: fix copy_from_user()
    parisc: fix copy_from_user()
    openrisc: fix copy_from_user()
    nios2: fix __get_user()
    nios2: copy_from_user() should zero the tail of destination
    mn10300: copy_from_user() should zero on access_ok() failure...
    mn10300: failing __get_user() and get_user() should zero
    mips: copy_from_user() must zero the destination on access_ok() failure
    ARC: uaccess: get_user to zero out dest in cause of fault
    ...

    Linus Torvalds
     

14 Sep, 2016

1 commit


10 Sep, 2016

1 commit


31 Aug, 2016

1 commit

  • There are three usercopy warnings which are currently being silenced for
    gcc 4.6 and newer:

    1) "copy_from_user() buffer size is too small" compile warning/error

    This is a static warning which happens when object size and copy size
    are both const, and copy size > object size. I didn't see any false
    positives for this one. So the function warning attribute seems to
    be working fine here.

    Note this scenario is always a bug and so I think it should be
    changed to *always* be an error, regardless of
    CONFIG_DEBUG_STRICT_USER_COPY_CHECKS.

    2) "copy_from_user() buffer size is not provably correct" compile warning

    This is another static warning which happens when I enable
    __compiletime_object_size() for new compilers (and
    CONFIG_DEBUG_STRICT_USER_COPY_CHECKS). It happens when object size
    is const, but copy size is *not*. In this case there's no way to
    compare the two at build time, so it gives the warning. (Note the
    warning is a byproduct of the fact that gcc has no way of knowing
    whether the overflow function will be called, so the call isn't dead
    code and the warning attribute is activated.)

    So this warning seems to only indicate "this is an unusual pattern,
    maybe you should check it out" rather than "this is a bug".

    I get 102(!) of these warnings with allyesconfig and the
    __compiletime_object_size() gcc check removed. I don't know if there
    are any real bugs hiding in there, but from looking at a small
    sample, I didn't see any. According to Kees, it does sometimes find
    real bugs. But the false positive rate seems high.

    3) "Buffer overflow detected" runtime warning

    This is a runtime warning where object size is const, and copy size >
    object size.

    All three warnings (both static and runtime) were completely disabled
    for gcc 4.6 with the following commit:

    2fb0815c9ee6 ("gcc4: disable __compiletime_object_size for GCC 4.6+")

    That commit mistakenly assumed that the false positives were caused by a
    gcc bug in __compiletime_object_size(). But in fact,
    __compiletime_object_size() seems to be working fine. The false
    positives were instead triggered by #2 above. (Though I don't have an
    explanation for why the warnings supposedly only started showing up in
    gcc 4.6.)

    So remove warning #2 to get rid of all the false positives, and re-enable
    warnings #1 and #3 by reverting the above commit.

    Furthermore, since #1 is a real bug which is detected at compile time,
    upgrade it to always be an error.

    Having done all that, CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is no longer
    needed.

    Signed-off-by: Josh Poimboeuf
    Cc: Kees Cook
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc: "H . Peter Anvin"
    Cc: Andy Lutomirski
    Cc: Steven Rostedt
    Cc: Brian Gerst
    Cc: Peter Zijlstra
    Cc: Frederic Weisbecker
    Cc: Byungchul Park
    Cc: Nilay Vaish
    Signed-off-by: Linus Torvalds

    Josh Poimboeuf
     

08 Nov, 2015

1 commit


02 Jan, 2014

1 commit


28 May, 2013

1 commit

  • The only reason uaccess routines might sleep
    is if they fault. Make this explicit.

    Signed-off-by: Michael S. Tsirkin
    Signed-off-by: Peter Zijlstra
    Cc: Linus Torvalds
    Cc: Andrew Morton
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1369577426-26721-1-git-send-email-mst@redhat.com
    Signed-off-by: Ingo Molnar

    Michael S. Tsirkin
     

11 Feb, 2013

2 commits


07 Oct, 2011

1 commit

  • The existing __strnlen_user macro simply resolved to strnlen. However, the
    count returned by strnlen_user should include the NULL byte. This patch
    fixes the __strnlen_user macro to include the NULL byte in the count.

    Signed-off-by: Mark Salter
    Acked-by: Arnd Bergmann

    Mark Salter
     

17 Mar, 2011

1 commit


19 Jun, 2009

2 commits

  • There's no reason that I can see to use the short __access_ok() form
    directly when the access_ok() is clearer in intent and for most people,
    expands to the same C code (i.e. always specify the first field -- access
    type). Not all no-mmu systems lack memory protection, so the read/write
    could feasibly be checked.

    Signed-off-by: Mike Frysinger
    Signed-off-by: Arnd Bergmann

    Mike Frysinger
     
  • The strnlen_user() function was missing a access_ok() check on the pointer
    given. We've had cases on Blackfin systems where test programs caused
    kernel crashes here because userspace passed up a NULL/-1 pointer and the
    kernel gladly attempted to run strlen() on it.

    Signed-off-by: Mike Frysinger
    Signed-off-by: Arnd Bergmann

    Mike Frysinger
     

12 Jun, 2009

2 commits

  • Based on discussions with Michal Simek and code
    from m68knommu and h8300, this version of uaccess.h
    should be usable by most architectures, by overriding
    some parts of it.

    Simple NOMMU architectures can use it out of
    the box, but a minimal __access_ok() should be
    added there as well.

    Cc: Michal Simek
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • The current asm-generic/page.h only contains the get_order
    function, and asm-generic/uaccess.h only implements
    unaligned accesses. This renames the file to getorder.h
    and uaccess-unaligned.h to make room for new page.h
    and uaccess.h file that will be usable by all simple
    (e.g. nommu) architectures.

    Signed-off-by: Remis Lima Baima
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

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