23 May, 2016

1 commit

  • I'm looking at trying to possibly merge the 32-bit and 64-bit versions
    of the x86 uaccess.h implementation, but first this needs to be cleaned
    up.

    For example, the 32-bit version of "__copy_from_user_inatomic()" is
    mostly the special cases for the constant size, and it's actually almost
    never relevant. Most users aren't actually using a constant size
    anyway, and the few cases that do small constant copies are better off
    just using __get_user() instead.

    So get rid of the unnecessary complexity.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

06 Nov, 2015

2 commits

  • As far as I can tell, strncpy_from_unsafe never returns -EFAULT. ret is
    the result of a __copy_from_user_inatomic(), which is 0 for success and
    positive (in this case necessarily 1) for access error - it is never
    negative. So we were always returning the length of the, possibly
    truncated, destination string.

    Signed-off-by: Rasmus Villemoes
    Acked-by: Alexei Starovoitov
    Cc: Masami Hiramatsu
    Cc: Namhyung Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rasmus Villemoes
     
  • probe_kernel_address() is basically the same as the (later added)
    probe_kernel_read().

    The return value on EFAULT is a bit different: probe_kernel_address()
    returns number-of-bytes-not-copied whereas probe_kernel_read() returns
    -EFAULT. All callers have been checked, none cared.

    probe_kernel_read() can be overridden by the architecture whereas
    probe_kernel_address() cannot. parisc, blackfin and um do this, to insert
    additional checking. Hence this patch possibly fixes obscure bugs,
    although there are only two probe_kernel_address() callsites outside
    arch/.

    My first attempt involved removing probe_kernel_address() entirely and
    converting all callsites to use probe_kernel_read() directly, but that got
    tiresome.

    This patch shrinks mm/slab_common.o by 218 bytes. For a single
    probe_kernel_address() callsite.

    Cc: Steven Miao
    Cc: Jeff Dike
    Cc: Richard Weinberger
    Cc: "James E.J. Bottomley"
    Cc: Helge Deller
    Cc: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

01 Sep, 2015

1 commit

  • To fix build errors:
    kernel/built-in.o: In function `bpf_trace_printk':
    bpf_trace.c:(.text+0x11a254): undefined reference to `strncpy_from_unsafe'
    kernel/built-in.o: In function `fetch_memory_string':
    trace_kprobe.c:(.text+0x11acf8): undefined reference to `strncpy_from_unsafe'

    move strncpy_from_unsafe() next to probe_kernel_read/write()
    which use the same memory access style.

    Reported-by: Fengguang Wu
    Reported-by: Guenter Roeck
    Fixes: 1a6877b9c0c2 ("lib: introduce strncpy_from_unsafe()")
    Signed-off-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Alexei Starovoitov
     

31 Oct, 2011

1 commit


26 May, 2011

1 commit

  • The functions probe_kernel_write() and probe_kernel_read() do not modify
    the src pointer. Allow const pointers to be passed in without the need
    of a typecast.

    Acked-by: Mike Frysinger
    Acked-by: Heiko Carstens
    Acked-by: Martin Schwidefsky
    Signed-off-by: Steven Rostedt
    Link: http://lkml.kernel.org/r/1305824936.1465.4.camel@gandalf.stny.rr.com

    Steven Rostedt
     

28 Oct, 2010

1 commit


08 Jan, 2010

1 commit


12 Jun, 2009

1 commit

  • probe_kernel_write() gets used to write to the kernel address space.
    E.g. to patch the kernel (kgdb, ftrace, kprobes...). Some architectures
    however enable write protection for the kernel text section, so that
    writes to this region would fault.
    This patch allows to specify an architecture specific version of
    probe_kernel_write() which allows to handle and bypass write protection
    of the text segment.
    That way it is still possible to catch random writes to kernel text
    and explicitly allow writes via this interface.

    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Heiko Carstens
     

18 Apr, 2008

2 commits

  • Fix two regressions dealing with the kgdb core.

    1) kgdb_skipexception and kgdb_post_primary_code are optional
    functions that are only required on archs that need special exception
    fixups.

    2) The kernel address space scope must be set on any probe_kernel_*
    function or archs such as ARCH=arm will not allow access to the kernel
    memory space. As an example, it is required to allow the full kernel
    address space is when you the kernel debugger to inspect a system
    call.

    Signed-off-by: Jason Wessel
    Signed-off-by: Ingo Molnar

    Jason Wessel
     
  • add probe_kernel_read() and probe_kernel_write().

    Uninlined and restricted to kernel range memory only, as suggested
    by Linus.

    Signed-off-by: Ingo Molnar
    Reviewed-by: Thomas Gleixner

    Ingo Molnar