Skip to content
Snippets Groups Projects
  1. Mar 17, 2019
  2. Mar 06, 2019
  3. Mar 04, 2019
    • Linus Torvalds's avatar
      get rid of legacy 'get_ds()' function · 736706be
      Linus Torvalds authored
      
      Every in-kernel use of this function defined it to KERNEL_DS (either as
      an actual define, or as an inline function).  It's an entirely
      historical artifact, and long long long ago used to actually read the
      segment selector valueof '%ds' on x86.
      
      Which in the kernel is always KERNEL_DS.
      
      Inspired by a patch from Jann Horn that just did this for a very small
      subset of users (the ones in fs/), along with Al who suggested a script.
      I then just took it to the logical extreme and removed all the remaining
      gunk.
      
      Roughly scripted with
      
         git grep -l '(get_ds())' -- :^tools/ | xargs sed -i 's/(get_ds())/(KERNEL_DS)/'
         git grep -lw 'get_ds' -- :^tools/ | xargs sed -i '/^#define get_ds()/d'
      
      plus manual fixups to remove a few unusual usage patterns, the couple of
      inline function cases and to fix up a comment that had become stale.
      
      The 'get_ds()' function remains in an x86 kvm selftest, since in user
      space it actually does something relevant.
      
      Inspired-by: default avatarJann Horn <jannh@google.com>
      Inspired-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      736706be
  4. Feb 28, 2019
  5. Feb 22, 2019
  6. Feb 13, 2019
  7. Jan 25, 2019
  8. Jan 22, 2019
    • Logan Gunthorpe's avatar
      iomap: introduce io{read|write}64_{lo_hi|hi_lo} · 79bf0cbd
      Logan Gunthorpe authored
      
      In order to provide non-atomic functions for io{read|write}64 that will
      use readq and writeq when appropriate. We define a number of variants
      of these functions in the generic iomap that will do non-atomic
      operations on pio but atomic operations on mmio.
      
      These functions are only defined if readq and writeq are defined. If
      they are not, then the wrappers that always use non-atomic operations
      from include/linux/io-64-nonatomic*.h will be used.
      
      Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
      Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Suresh Warrier <warrier@linux.vnet.ibm.com>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      79bf0cbd
  9. Jan 04, 2019
    • Matthew Wilcox's avatar
      fls: change parameter to unsigned int · 3fc2579e
      Matthew Wilcox authored
      When testing in userspace, UBSAN pointed out that shifting into the sign
      bit is undefined behaviour.  It doesn't really make sense to ask for the
      highest set bit of a negative value, so just turn the argument type into
      an unsigned int.
      
      Some architectures (eg ppc) already had it declared as an unsigned int,
      so I don't expect too many problems.
      
      Link: http://lkml.kernel.org/r/20181105221117.31828-1-willy@infradead.org
      
      
      Signed-off-by: default avatarMatthew Wilcox <willy@infradead.org>
      Acked-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: <linux-arch@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3fc2579e
    • Linus Torvalds's avatar
      Remove 'type' argument from access_ok() function · 96d4f267
      Linus Torvalds authored
      
      Nobody has actually used the type (VERIFY_READ vs VERIFY_WRITE) argument
      of the user address range verification function since we got rid of the
      old racy i386-only code to walk page tables by hand.
      
      It existed because the original 80386 would not honor the write protect
      bit when in kernel mode, so you had to do COW by hand before doing any
      user access.  But we haven't supported that in a long time, and these
      days the 'type' argument is a purely historical artifact.
      
      A discussion about extending 'user_access_begin()' to do the range
      checking resulted this patch, because there is no way we're going to
      move the old VERIFY_xyz interface to that model.  And it's best done at
      the end of the merge window when I've done most of my merges, so let's
      just get this done once and for all.
      
      This patch was mostly done with a sed-script, with manual fix-ups for
      the cases that weren't of the trivial 'access_ok(VERIFY_xyz' form.
      
      There were a couple of notable cases:
      
       - csky still had the old "verify_area()" name as an alias.
      
       - the iter_iov code had magical hardcoded knowledge of the actual
         values of VERIFY_{READ,WRITE} (not that they mattered, since nothing
         really used it)
      
       - microblaze used the type argument for a debug printout
      
      but other than those oddities this should be a total no-op patch.
      
      I tried to fix up all architectures, did fairly extensive grepping for
      access_ok() uses, and the changes are trivial, but I may have missed
      something.  Any missed conversion should be trivially fixable, though.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      96d4f267
  10. Dec 28, 2018
  11. Dec 19, 2018
  12. Dec 14, 2018
  13. Dec 13, 2018
  14. Dec 05, 2018
  15. Dec 01, 2018
    • Masahiro Yamada's avatar
      kbuild: simplify dependency generation for CONFIG_TRIM_UNUSED_KSYMS · bbda5ec6
      Masahiro Yamada authored
      
      My main motivation of this commit is to clean up scripts/Kbuild.include
      and scripts/Makefile.build.
      
      Currently, CONFIG_TRIM_UNUSED_KSYMS works with a tricky gimmick;
      possibly exported symbols are detected by letting $(CPP) replace
      EXPORT_SYMBOL* with a special string '=== __KSYM_*===', which is
      post-processed by sed, and passed to fixdep. The extra preprocessing
      is costly, and hacking cmd_and_fixdep is ugly.
      
      I came up with a new way to find exported symbols; insert a dummy
      symbol __ksym_marker_* to each potentially exported symbol. Those
      dummy symbols are picked up by $(NM), post-processed by sed, then
      appended to .*.cmd files. I collected the post-process part to a
      new shell script scripts/gen_ksymdeps.sh for readability. The dummy
      symbols are put into the .discard.* section so that the linker
      script rips them off the final vmlinux or modules.
      
      A nice side-effect is building with CONFIG_TRIM_UNUSED_KSYMS will
      be much faster.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Reviewed-by: default avatarNicolas Pitre <nico@linaro.org>
      bbda5ec6
  16. Nov 02, 2018
  17. Nov 01, 2018
    • Mark Rutland's avatar
      locking/atomics: Switch to generated instrumentation · aa525d06
      Mark Rutland authored
      
      As a step towards ensuring the atomic* APIs are consistent, let's switch
      to wrappers generated by gen-atomic-instrumented.h, using the same table
      used to generate the fallbacks and atomic-long wrappers.
      
      These are checked in rather than generated with Kbuild, since:
      
      * This allows inspection of the atomics with git grep and ctags on a
        pristine tree, which Linus strongly prefers being able to do.
      
      * The fallbacks are not affected by machine details or configuration
        options, so it is not necessary to regenerate them to take these into
        account.
      
      * These are included by files required *very* early in the build process
        (e.g. for generating bounds.h), and we'd rather not complicate the
        top-level Kbuild file with dependencies.
      
      Generating the atomic headers means that the instrumented wrappers will
      remain in sync with the rest of the atomic APIs, and we gain all the
      ordering variants of each atomic without having to manually expanded
      them all.
      
      The KASAN checks are automatically generated based on the function
      parameters defined in atomics.tbl. Note that try_cmpxchg() now correctly
      treats 'old' as a parameter that may be written to, and not only read as
      the hand-written instrumentation assumed.
      
      Other than the change to try_cmpxchg(), existing code should not be
      affected by this patch. The patch introduces instrumentation for all
      optional atomics (and ordering variants), along with the ifdeffery this
      requires, enabling other architectures to make use of the instrumented
      atomics.
      
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: catalin.marinas@arm.com
      Cc: linuxdrivers@attotech.com
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Alexander Potapenko <glider@google.com>
      Link: http://lkml.kernel.org/r/20180904104830.2975-5-mark.rutland@arm.com
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      aa525d06
    • Mark Rutland's avatar
      locking/atomics: Switch to generated atomic-long · b5d47ef9
      Mark Rutland authored
      
      As a step towards ensuring the atomic* APIs are consistent, let's switch
      to wrappers generated by gen-atomic-long.h, using the same table that
      gen-atomic-fallbacks.h uses to fill in gaps in the atomic_* and
      atomic64_* APIs.
      
      These are checked in rather than generated with Kbuild, since:
      
      * This allows inspection of the atomics with git grep and ctags on a
        pristine tree, which Linus strongly prefers being able to do.
      
      * The fallbacks are not affected by machine details or configuration
        options, so it is not necessary to regenerate them to take these into
        account.
      
      * These are included by files required *very* early in the build process
        (e.g. for generating bounds.h), and we'd rather not complicate the
        top-level Kbuild file with dependencies.
      
      Other than *_INIT() and *_cond_read_acquire(), all API functions are
      implemented as static inline C functions, ensuring consistent type
      promotion and/or truncation without requiring explicit casts to be
      applied to parameters or return values.
      
      Since we typedef atomic_long_t to either atomic_t or atomic64_t, we know
      these types are equivalent, and don't require explicit casts between
      them. However, as the try_cmpxchg*() functions take a pointer for the
      'old' parameter, which may be an int or s64, an explicit cast is
      generated for this.
      
      There should be no functional change as a result of this patch (i.e.
      existing code should not be affected). However, this introduces a number
      of functions into the atomic_long_* API, bringing it into line with the
      atomic_* and atomic64_* APIs.
      
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: catalin.marinas@arm.com
      Cc: linuxdrivers@attotech.com
      Cc: dvyukov@google.com
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: aryabinin@virtuozzo.com
      Cc: glider@google.com
      Link: http://lkml.kernel.org/r/20180904104830.2975-4-mark.rutland@arm.com
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b5d47ef9
  18. Oct 31, 2018
  19. Oct 26, 2018
Loading