02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

22 Aug, 2017

1 commit


10 May, 2017

1 commit


02 May, 2017

1 commit

  • Pull uaccess unification updates from Al Viro:
    "This is the uaccess unification pile. It's _not_ the end of uaccess
    work, but the next batch of that will go into the next cycle. This one
    mostly takes copy_from_user() and friends out of arch/* and gets the
    zero-padding behaviour in sync for all architectures.

    Dealing with the nocache/writethrough mess is for the next cycle;
    fortunately, that's x86-only. Same for cleanups in iov_iter.c (I am
    sold on access_ok() in there, BTW; just not in this pile), same for
    reducing __copy_... callsites, strn*... stuff, etc. - there will be a
    pile about as large as this one in the next merge window.

    This one sat in -next for weeks. -3KLoC"

    * 'work.uaccess' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (96 commits)
    HAVE_ARCH_HARDENED_USERCOPY is unconditional now
    CONFIG_ARCH_HAS_RAW_COPY_USER is unconditional now
    m32r: switch to RAW_COPY_USER
    hexagon: switch to RAW_COPY_USER
    microblaze: switch to RAW_COPY_USER
    get rid of padding, switch to RAW_COPY_USER
    ia64: get rid of copy_in_user()
    ia64: sanitize __access_ok()
    ia64: get rid of 'segment' argument of __do_{get,put}_user()
    ia64: get rid of 'segment' argument of __{get,put}_user_check()
    ia64: add extable.h
    powerpc: get rid of zeroing, switch to RAW_COPY_USER
    esas2r: don't open-code memdup_user()
    alpha: fix stack smashing in old_adjtimex(2)
    don't open-code kernel_setsockopt()
    mips: switch to RAW_COPY_USER
    mips: get rid of tail-zeroing in primitives
    mips: make copy_from_user() zero tail explicitly
    mips: clean and reorder the forest of macros...
    mips: consolidate __invoke_... wrappers
    ...

    Linus Torvalds
     

15 Apr, 2017

1 commit

  • The patch 554bfeceb8a22d448cd986fc9efce25e833278a1 ("parisc: Fix access
    fault handling in pa_memcpy()") reimplements the pa_memcpy function.
    Unfortunatelly, it makes the kernel unbootable. The crash happens in the
    function ide_complete_cmd where memcpy is called with the same source
    and destination address.

    This patch fixes a few bugs in pa_memcpy:

    * When jumping to .Lcopy_loop_16 for the first time, don't skip the
    instruction "ldi 31,t0" (this bug made the kernel unbootable)
    * Use the COND macro when comparing length, so that the comparison is
    64-bit (a theoretical issue, in case the length is greater than
    0xffffffff)
    * Don't use the COND macro after the "extru" instruction (the PA-RISC
    specification says that the upper 32-bits of extru result are undefined,
    although they are set to zero in practice)
    * Fix exception addresses in .Lcopy16_fault and .Lcopy8_fault
    * Rename .Lcopy_loop_4 to .Lcopy_loop_8 (so that it is consistent with
    .Lcopy8_fault)

    Cc: # v4.9+
    Fixes: 554bfeceb8a2 ("parisc: Fix access fault handling in pa_memcpy()")
    Signed-off-by: Mikulas Patocka
    Signed-off-by: Helge Deller

    Mikulas Patocka
     

03 Apr, 2017

1 commit


02 Apr, 2017

1 commit


30 Mar, 2017

2 commits

  • 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
     
  • pa_memcpy() is the major memcpy implementation in the parisc kernel which is
    used to do any kind of userspace/kernel memory copies.

    Al Viro noticed various bugs in the implementation of pa_mempcy(), most notably
    that in case of faults it may report back to have copied more bytes than it
    actually did.

    Fixing those bugs is quite hard in the C-implementation, because the compiler
    is messing around with the registers and we are not guaranteed that specific
    variables are always in the same processor registers. This makes proper fault
    handling complicated.

    This patch implements pa_memcpy() in assembler. That way we have correct fault
    handling and adding a 64-bit copy routine was quite easy.

    Runtime tested with 32- and 64bit kernels.

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

    Helge Deller
     

29 Mar, 2017

1 commit


25 Dec, 2016

1 commit


07 Oct, 2016

1 commit


06 Oct, 2016

1 commit


02 Aug, 2016

1 commit


23 May, 2016

1 commit

  • Add a native implementation for the sched_clock() function which utilizes the
    processor-internal cycle counter (Control Register 16) as high-resolution time
    source.

    With this patch we now get much more fine-grained resolutions in various
    in-kernel time measurements (e.g. when viewing the function tracing logs), and
    probably a more accurate scheduling on SMP systems.

    There are a few specific implementation details in this patch:

    1. On a 32bit kernel we emulate the higher 32bits of the required 64-bit
    resolution of sched_clock() by increasing a per-cpu counter at every
    wrap-around of the 32bit cycle counter.

    2. In a SMP system, the cycle counters of the various CPUs are not syncronized
    (similiar to the TSC in a x86_64 system). To cope with this we define
    HAVE_UNSTABLE_SCHED_CLOCK and let the upper layers do the adjustment work.

    3. Since we need HAVE_UNSTABLE_SCHED_CLOCK, we need to provide a cmpxchg64()
    function even on a 32-bit kernel.

    4. A 64-bit SMP kernel which is started on a UP system will mark the
    sched_clock() implementation as "stable", which means that we don't expect any
    jumps in the returned counter. This is true because we then run only on one
    CPU.

    Signed-off-by: Helge Deller

    Helge Deller
     

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
     

14 Dec, 2014

1 commit


04 Apr, 2014

1 commit


20 Nov, 2013

2 commits


08 Nov, 2013

2 commits

  • Each CPU has it's own Control Register 16 (CR16) which is used as time source
    for the udelay() function. But since the CR16 registers across different CPUs
    are not synced, we need to recalculate the loop count if we get switched away
    to ensure that we really delay as much time as requested.

    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


10 Jul, 2013

1 commit

  • When running the LTP testsuite one may hit this kernel BUG() with the
    write06 testcase:

    kernel BUG at mm/filemap.c:2023!
    CPU: 1 PID: 8614 Comm: writev01 Not tainted 3.10.0-rc7-64bit-c3000+ #6
    IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000401e6e84 00000000401e6e88
    IIR: 03ffe01f ISR: 0000000010340000 IOR: 000001fbe0380820
    CPU: 1 CR30: 00000000bef80000 CR31: ffffffffffffffff
    ORIG_R28: 00000000bdc192c0
    IAOQ[0]: iov_iter_advance+0x3c/0xc0
    IAOQ[1]: iov_iter_advance+0x40/0xc0
    RP(r2): generic_file_buffered_write+0x204/0x3f0
    Backtrace:
    [] generic_file_buffered_write+0x204/0x3f0
    [] __generic_file_aio_write+0x244/0x448
    [] generic_file_aio_write+0x98/0x150
    [] do_sync_readv_writev+0xc0/0x130
    [] compat_do_readv_writev+0x12c/0x340
    [] compat_writev+0x68/0xa0
    [] compat_SyS_writev+0x98/0xf8

    Reason for this crash is a gcc miscompilation in the fault handlers of
    pa_memcpy() which return the fault address instead of the copied bytes.
    Since this seems to be a generic problem with gcc-4.7.x (and below), it's
    better to simplify the fault handlers in pa_memcpy to avoid this problem.

    Here is a simple reproducer for the problem:

    int main(int argc, char **argv)
    {
    int fd, nbytes;
    struct iovec wr_iovec[] = {
    { "TEST STRING ",32},
    { (char*)0x40005000,32} }; // random memory.
    fd = open(DATA_FILE, O_RDWR | O_CREAT, 0666);
    nbytes = writev(fd, wr_iovec, 2);
    printf("return value = %d, errno %d (%s)\n",
    nbytes, errno, strerror(errno));
    return 0;
    }

    In addition, John David Anglin wrote:
    There is no gcc PR as pa_memcpy is not legitimate C code. There is an
    implicit assumption that certain variables will contain correct values
    when an exception occurs and the code randomly jumps to one of the
    exception blocks. There is no guarantee of this. If a PR was filed, it
    would likely be marked as invalid.

    Signed-off-by: Helge Deller
    Signed-off-by: John David Anglin
    Cc: # 3.8+
    Signed-off-by: Helge Deller

    Helge Deller
     

26 Apr, 2013

1 commit

  • The Debian experimental linux source package (3.8.5-1) build fails
    with the following errors:
    ...
    MODPOST 2016 modules
    ERROR: "__ucmpdi2" [fs/btrfs/btrfs.ko] undefined!
    ERROR: "__ucmpdi2" [drivers/md/dm-verity.ko] undefined!

    The attached patch resolves this problem. It is based on the s390
    implementation of ucmpdi2.c.

    Signed-off-by: John David Anglin
    Cc: "James E.J. Bottomley"
    Signed-off-by: Helge Deller

    John David Anglin
     

03 Mar, 2013

1 commit


31 May, 2012

1 commit


29 Mar, 2012

1 commit


29 Nov, 2011

1 commit


01 Nov, 2011

1 commit


27 Jul, 2011

1 commit

  • This allows us to move duplicated code in
    (atomic_inc_not_zero() for now) to

    Signed-off-by: Arun Sharma
    Reviewed-by: Eric Dumazet
    Cc: Ingo Molnar
    Cc: David Miller
    Cc: Eric Dumazet
    Acked-by: Mike Frysinger
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arun Sharma
     

07 Mar, 2010

1 commit


05 Jan, 2010

1 commit


15 Dec, 2009

2 commits

  • Further name space cleanup. No functional change

    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra
    Acked-by: David S. Miller
    Acked-by: Ingo Molnar
    Cc: linux-arch@vger.kernel.org

    Thomas Gleixner
     
  • The raw_spin* namespace was taken by lockdep for the architecture
    specific implementations. raw_spin_* would be the ideal name space for
    the spinlocks which are not converted to sleeping locks in preempt-rt.

    Linus suggested to convert the raw_ to arch_ locks and cleanup the
    name space instead of using an artifical name like core_spin,
    atomic_spin or whatever

    No functional change.

    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra
    Acked-by: David S. Miller
    Acked-by: Ingo Molnar
    Cc: linux-arch@vger.kernel.org

    Thomas Gleixner
     

29 Oct, 2009

1 commit

  • Now that the return from alloc_percpu is compatible with the address
    of per-cpu vars, it makes sense to hand around the address of per-cpu
    variables. To make this sane, we remove the per_cpu__ prefix we used
    created to stop people accidentally using these vars directly.

    Now we have sparse, we can use that (next patch).

    tj: * Updated to convert stuff which were missed by or added after the
    original patch.

    * Kill per_cpu_var() macro.

    Signed-off-by: Rusty Russell
    Signed-off-by: Tejun Heo
    Reviewed-by: Christoph Lameter

    Rusty Russell
     

03 Jul, 2009

2 commits


06 Jan, 2009

1 commit

  • Make the following needlessly global code static:

    - iomap.c: struct iomap_ops[]
    - memcpy.c: pa_memcpy()

    Signed-off-by: Adrian Bunk
    Cc: Matthew Wilcox
    Cc: Grant Grundler
    Signed-off-by: Andrew Morton
    Signed-off-by: Kyle McMartin

    Adrian Bunk
     

13 Jun, 2008

1 commit