17 Mar, 2019

1 commit

  • Currently, every arch/*/include/uapi/asm/Kbuild explicitly includes
    the common Kbuild.asm file. Factor out the duplicated include directives
    to scripts/Makefile.asm-generic so that no architecture would opt out
    of the mandatory-y mechanism.

    um is not forced to include mandatory-y since it is a very exceptional
    case which does not support UAPI.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

13 Mar, 2019

5 commits

  • As all the memblock allocation functions return NULL in case of error
    rather than panic(), the duplicates with _nopanic suffix can be removed.

    Link: http://lkml.kernel.org/r/1548057848-15136-22-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Acked-by: Greg Kroah-Hartman
    Reviewed-by: Petr Mladek [printk]
    Cc: Catalin Marinas
    Cc: Christophe Leroy
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Dennis Zhou
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Guo Ren [c-sky]
    Cc: Heiko Carstens
    Cc: Juergen Gross [Xen]
    Cc: Mark Salter
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Paul Burton
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Rob Herring
    Cc: Rob Herring
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • Add check for the return value of memblock_alloc*() functions and call
    panic() in case of error. The panic message repeats the one used by
    panicing memblock allocators with adjustment of parameters to include
    only relevant ones.

    The replacement was mostly automated with semantic patches like the one
    below with manual massaging of format strings.

    @@
    expression ptr, size, align;
    @@
    ptr = memblock_alloc(size, align);
    + if (!ptr)
    + panic("%s: Failed to allocate %lu bytes align=0x%lx\n", __func__, size, align);

    [anders.roxell@linaro.org: use '%pa' with 'phys_addr_t' type]
    Link: http://lkml.kernel.org/r/20190131161046.21886-1-anders.roxell@linaro.org
    [rppt@linux.ibm.com: fix format strings for panics after memblock_alloc]
    Link: http://lkml.kernel.org/r/1548950940-15145-1-git-send-email-rppt@linux.ibm.com
    [rppt@linux.ibm.com: don't panic if the allocation in sparse_buffer_init fails]
    Link: http://lkml.kernel.org/r/20190131074018.GD28876@rapoport-lnx
    [akpm@linux-foundation.org: fix xtensa printk warning]
    Link: http://lkml.kernel.org/r/1548057848-15136-20-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Signed-off-by: Anders Roxell
    Reviewed-by: Guo Ren [c-sky]
    Acked-by: Paul Burton [MIPS]
    Acked-by: Heiko Carstens [s390]
    Reviewed-by: Juergen Gross [Xen]
    Reviewed-by: Geert Uytterhoeven [m68k]
    Acked-by: Max Filippov [xtensa]
    Cc: Catalin Marinas
    Cc: Christophe Leroy
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Dennis Zhou
    Cc: Greentime Hu
    Cc: Greg Kroah-Hartman
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Mark Salter
    Cc: Matt Turner
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Petr Mladek
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Rob Herring
    Cc: Rob Herring
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • The __memblock_alloc_base() function tries to allocate a memory up to
    the limit specified by its max_addr parameter. Depending on the value
    of this parameter, the __memblock_alloc_base() can is replaced with the
    appropriate memblock_phys_alloc*() variant.

    Link: http://lkml.kernel.org/r/1548057848-15136-9-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Acked-by: Rob Herring
    Cc: Catalin Marinas
    Cc: Christophe Leroy
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Dennis Zhou
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Kroah-Hartman
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Guo Ren [c-sky]
    Cc: Heiko Carstens
    Cc: Juergen Gross [Xen]
    Cc: Mark Salter
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Paul Burton
    Cc: Petr Mladek
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Rob Herring
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • Make the memblock_phys_alloc() function an inline wrapper for
    memblock_phys_alloc_range() and update the memblock_phys_alloc() callers
    to check the returned value and panic in case of error.

    Link: http://lkml.kernel.org/r/1548057848-15136-8-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Cc: Catalin Marinas
    Cc: Christophe Leroy
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Dennis Zhou
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Kroah-Hartman
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Guo Ren [c-sky]
    Cc: Heiko Carstens
    Cc: Juergen Gross [Xen]
    Cc: Mark Salter
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Paul Burton
    Cc: Petr Mladek
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Rob Herring
    Cc: Rob Herring
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • The calls to memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE)
    and memblock_phys_alloc(size, align) are equivalent as both try to
    allocate 'size' bytes with 'align' alignment anywhere in the memory and
    panic if hte allocation fails.

    The conversion is done using the following semantic patch:

    @@
    expression size, align;
    @@
    - memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE)
    + memblock_phys_alloc(size, align)

    Link: http://lkml.kernel.org/r/1548057848-15136-4-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Cc: Catalin Marinas
    Cc: Christophe Leroy
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Dennis Zhou
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Kroah-Hartman
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Guo Ren [c-sky]
    Cc: Heiko Carstens
    Cc: Juergen Gross [Xen]
    Cc: Mark Salter
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Paul Burton
    Cc: Petr Mladek
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Rob Herring
    Cc: Rob Herring
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     

11 Mar, 2019

1 commit

  • Pull DMA mapping updates from Christoph Hellwig:

    - add debugfs support for dumping dma-debug information (Corentin
    Labbe)

    - Kconfig cleanups (Andy Shevchenko and me)

    - debugfs cleanups (Greg Kroah-Hartman)

    - improve dma_map_resource and use it in the media code

    - arch_setup_dma_ops / arch_teardown_dma_ops cleanups

    - various small cleanups and improvements for the per-device coherent
    allocator

    - make the DMA mask an upper bound and don't fail "too large" dma mask
    in the remaning two architectures - this will allow big driver
    cleanups in the following merge windows

    * tag 'dma-mapping-5.1' of git://git.infradead.org/users/hch/dma-mapping: (21 commits)
    Documentation/DMA-API-HOWTO: update dma_mask sections
    sparc64/pci_sun4v: allow large DMA masks
    sparc64/iommu: allow large DMA masks
    sparc64: refactor the ali DMA quirk
    ccio: allow large DMA masks
    dma-mapping: remove the DMA_MEMORY_EXCLUSIVE flag
    dma-mapping: remove dma_mark_declared_memory_occupied
    dma-mapping: move CONFIG_DMA_CMA to kernel/dma/Kconfig
    dma-mapping: improve selection of dma_declare_coherent availability
    dma-mapping: remove an incorrect __iommem annotation
    of: select OF_RESERVED_MEM automatically
    device.h: dma_mem is only needed for HAVE_GENERIC_DMA_COHERENT
    mfd/sm501: depend on HAS_DMA
    dma-mapping: add a kconfig symbol for arch_teardown_dma_ops availability
    dma-mapping: add a kconfig symbol for arch_setup_dma_ops availability
    dma-mapping: move debug configuration options to kernel/dma
    dma-debug: add dumping facility via debugfs
    dma: debug: no need to check return value of debugfs_create functions
    videobuf2: replace a layering violation with dma_map_resource
    dma-mapping: don't BUG when calling dma_map_resource on RAM
    ...

    Linus Torvalds
     

10 Mar, 2019

1 commit

  • Pull media updates from Mauro Carvalho Chehab:

    - remove sensor drivers that got converted from soc_camera

    - remaining soc_camera drivers got moved to staging

    - some documentation cleanups and improvements

    - the imx staging driver now supports imx7

    - the ov9640, mt9m001 and mt9m111 got converted from soc_camera

    - the vim2m driver now does what a m2m convert driver expects to do

    - epoll() fixes on media subsystems

    - several drivers fixes, typos, cleanups and improvements

    * tag 'media/v5.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (346 commits)
    media: dvb/earth-pt1: fix wrong initialization for demod blocks
    media: vim2m: Address some coding style issues
    media: vim2m: don't use BUG()
    media: vim2m: speedup passthrough copy
    media: vim2m: add an horizontal scaler
    media: vim2m: don't accept YUYV anymore as output format
    media: vim2m: add vertical linear scaler
    media: vim2m: better handle cap/out buffers with different sizes
    media: vim2m: use different framesizes for bayer formats
    media: vim2m: add support for VIDIOC_ENUM_FRAMESIZES
    media: vim2m: ensure that width is multiple of two
    media: vim2m: improve debug messages
    media: vim2m: add bayer capture formats
    media: a few more typos at staging, pci, platform, radio and usb
    media: Documentation: fix several typos
    media: staging: fix several typos
    media: include: fix several typos
    media: common: fix several typos
    media: v4l2-core: fix several typos
    media: usb: fix several typos
    ...

    Linus Torvalds
     

08 Mar, 2019

2 commits

  • Rather than use the memblock_alloc_base that returns a physical address
    and then convert this address to the virtual one, use appropriate
    memblock function that returns a virtual address.

    There is a small functional change in the allocation of then
    NODE_DATA(). Instead of panicing if the local allocation failed, the
    non-local allocation attempt will be made.

    Link: http://lkml.kernel.org/r/1546248566-14910-4-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Cc: Arnd Bergmann
    Cc: Benjamin Herrenschmidt
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Greentime Hu
    Cc: Guan Xuetao
    Cc: Heiko Carstens
    Cc: Jonas Bonn
    Cc: Mark Salter
    Cc: Martin Schwidefsky
    Cc: Michael Ellerman
    Cc: Michal Hocko
    Cc: Michal Simek
    Cc: Michal Simek
    Cc: Paul Mackerras
    Cc: Rich Felker
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Stefan Kristiansson
    Cc: Vincent Chen
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     
  • This Kconfig option was removed during v4.19 development in commit
    771c035372a0 ("deprecate the '__deprecated' attribute warnings entirely
    and for good") so there's no point to keep it in defconfigs any longer.

    FWIW defconfigs were patched with:
    --------------------------->8----------------------
    find . -name *_defconfig -exec sed -i '/CONFIG_ENABLE_WARN_DEPRECATED/d' {} \;
    --------------------------->8----------------------

    Link: http://lkml.kernel.org/r/20190128152434.41969-1-abrodkin@synopsys.com
    Signed-off-by: Alexey Brodkin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Brodkin
     

07 Mar, 2019

1 commit

  • Merge misc updates from Andrew Morton:

    - a few misc things

    - ocfs2 updates

    - most of MM

    * emailed patches from Andrew Morton : (159 commits)
    tools/testing/selftests/proc/proc-self-syscall.c: remove duplicate include
    proc: more robust bulk read test
    proc: test /proc/*/maps, smaps, smaps_rollup, statm
    proc: use seq_puts() everywhere
    proc: read kernel cpu stat pointer once
    proc: remove unused argument in proc_pid_lookup()
    fs/proc/thread_self.c: code cleanup for proc_setup_thread_self()
    fs/proc/self.c: code cleanup for proc_setup_self()
    proc: return exit code 4 for skipped tests
    mm,mremap: bail out earlier in mremap_to under map pressure
    mm/sparse: fix a bad comparison
    mm/memory.c: do_fault: avoid usage of stale vm_area_struct
    writeback: fix inode cgroup switching comment
    mm/huge_memory.c: fix "orig_pud" set but not used
    mm/hotplug: fix an imbalance with DEBUG_PAGEALLOC
    mm/memcontrol.c: fix bad line in comment
    mm/cma.c: cma_declare_contiguous: correct err handling
    mm/page_ext.c: fix an imbalance with kmemleak
    mm/compaction: pass pgdat to too_many_isolated() instead of zone
    mm: remove zone_lru_lock() function, access ->lru_lock directly
    ...

    Linus Torvalds
     

06 Mar, 2019

2 commits

  • The __SYSCALL macro's arguments are system call number, system call
    entry name and number of arguments for the system call.

    Argument- nargs in __SYSCALL(nr, entry, nargs) is neither calculated nor
    used anywhere. So it would be better to keep the implementation as
    __SYSCALL(nr, entry). This unifies the implementation with some other
    architectures too.

    Link: http://lkml.kernel.org/r/1546443445-21075-2-git-send-email-firoz.khan@linaro.org
    Signed-off-by: Firoz Khan
    Cc: Yoshinori Sato
    Cc: Rich Felker
    Cc: Simon Horman
    Cc: Kuninori Morimoto
    Cc: Greg Kroah-Hartman
    Cc: Philippe Ombredanne
    Cc: Thomas Gleixner
    Cc: Kate Stewart
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Firoz Khan
     
  • Pull year 2038 updates from Thomas Gleixner:
    "Another round of changes to make the kernel ready for 2038. After lots
    of preparatory work this is the first set of syscalls which are 2038
    safe:

    403 clock_gettime64
    404 clock_settime64
    405 clock_adjtime64
    406 clock_getres_time64
    407 clock_nanosleep_time64
    408 timer_gettime64
    409 timer_settime64
    410 timerfd_gettime64
    411 timerfd_settime64
    412 utimensat_time64
    413 pselect6_time64
    414 ppoll_time64
    416 io_pgetevents_time64
    417 recvmmsg_time64
    418 mq_timedsend_time64
    419 mq_timedreceiv_time64
    420 semtimedop_time64
    421 rt_sigtimedwait_time64
    422 futex_time64
    423 sched_rr_get_interval_time64

    The syscall numbers are identical all over the architectures"

    * 'timers-2038-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
    riscv: Use latest system call ABI
    checksyscalls: fix up mq_timedreceive and stat exceptions
    unicore32: Fix __ARCH_WANT_STAT64 definition
    asm-generic: Make time32 syscall numbers optional
    asm-generic: Drop getrlimit and setrlimit syscalls from default list
    32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option
    compat ABI: use non-compat openat and open_by_handle_at variants
    y2038: add 64-bit time_t syscalls to all 32-bit architectures
    y2038: rename old time and utime syscalls
    y2038: remove struct definition redirects
    y2038: use time32 syscall names on 32-bit
    syscalls: remove obsolete __IGNORE_ macros
    y2038: syscalls: rename y2038 compat syscalls
    x86/x32: use time64 versions of sigtimedwait and recvmmsg
    timex: change syscalls to use struct __kernel_timex
    timex: use __kernel_timex internally
    sparc64: add custom adjtimex/clock_adjtime functions
    time: fix sys_timer_settime prototype
    time: Add struct __kernel_timex
    time: make adjtime compat handling available for 32 bit
    ...

    Linus Torvalds
     

05 Mar, 2019

2 commits

  • Pull regulator updates from Mark Brown:
    "The bulk of the standout changes in this release are cleanups, with
    the core work being a combination of factoring out common code into
    helpers and the completion of the conversion of the core to use GPIO
    descriptors.

    Summary:

    - Addition of helper functions for current limits and conversion of
    drivers to use them by Axel Lin.

    - Lots and lots of cleanups from Axel Lin.

    - Conversion of the core to use GPIO descriptors rather than numbers
    by Linus Walleij.

    - New drivers for Maxim MAX77650 and ROHM BD70528"

    * tag 'regulator-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (131 commits)
    regulator: mc13xxx: Constify regulator_ops variables
    regulator: palmas: Constify palmas_smps_ramp_delay array
    regulator: wm831x-dcdc: Convert to use regulator_set/get_current_limit_regmap
    regulator: pv88090: Convert to use regulator_set/get_current_limit_regmap
    regulator: pv88080: Convert to use regulator_set/get_current_limit_regmap
    regulator: pv88060: Convert to use regulator_set/get_current_limit_regmap
    regulator: max77650: Convert to use regulator_set/get_current_limit_regmap
    regulator: lp873x: Convert to use regulator_set/get_current_limit_regmap
    regulator: lp872x: Convert to use regulator_set/get_current_limit_regmap
    regulator: da9210: Convert to use regulator_set/get_current_limit_regmap
    regulator: da9055: Convert to use regulator_set/get_current_limit_regmap
    regulator: core: Add set/get_current_limit helpers for regmap users
    regulator: Fix comment for csel_reg and csel_mask
    regulator: stm32-vrefbuf: add power management support
    regulator: 88pm8607: Remove unused fields from struct pm8607_regulator_info
    regulator: 88pm8607: Simplify pm8607_list_voltage implementation
    regulator: cpcap: Constify omap4_regulators and xoom_regulators
    regulator: cpcap: Remove unused vsel_shift from struct cpcap_regulator
    dt-bindings: regulator: tps65218: rectify units of LS3
    dt-bindings: regulator: add LS2 load switch documentation
    ...

    Linus Torvalds
     
  • 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: Jann Horn
    Inspired-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

04 Mar, 2019

1 commit


20 Feb, 2019

2 commits


19 Feb, 2019

2 commits

  • All new 32-bit architectures should have 64-bit userspace off_t type, but
    existing architectures has 32-bit ones.

    To enforce the rule, new config option is added to arch/Kconfig that defaults
    ARCH_32BIT_OFF_T to be disabled for new 32-bit architectures. All existing
    32-bit architectures enable it explicitly.

    New option affects force_o_largefile() behaviour. Namely, if userspace
    off_t is 64-bits long, we have no reason to reject user to open big files.

    Note that even if architectures has only 64-bit off_t in the kernel
    (arc, c6x, h8300, hexagon, nios2, openrisc, and unicore32),
    a libc may use 32-bit off_t, and therefore want to limit the file size
    to 4GB unless specified differently in the open flags.

    Signed-off-by: Yury Norov
    Acked-by: Arnd Bergmann
    Signed-off-by: Yury Norov
    Signed-off-by: Arnd Bergmann

    Yury Norov
     
  • Since the removal of the stale soc_camera headers, Migo-R board fails to
    build due to missing dma-mapping include directive.

    Include missing dma-mapping.h header in Migo-R board file to fix the build
    error.

    Fixes: a50c7738e8ae ("media: sh: migor: Remove stale soc_camera include")

    Signed-off-by: Jacopo Mondi
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab

    Jacopo Mondi
     

13 Feb, 2019

1 commit

  • I fixed a similar build error in commit 1b1e4ee86e00 ("sh: fix build
    error for empty CONFIG_BUILTIN_DTB_SOURCE"), but it came back again.

    Since commit 37c8a5fafa3b ("kbuild: consolidate Devicetree dtb
    build rules"), the combination of CONFIG_OF_EARLY_FLATTREE=y and
    CONFIG_USE_BUILTIN_DTB=n results in the following build error:

    make[1]: *** No rule to make target 'arch/sh/boot/dts/.dtb.o',
    needed by 'arch/sh/boot/dts/built-in.a'. Stop.

    Prior to that commit, there was only one path to descend into
    arch/sh/boot/dts/, and arch/sh/Makefile correctly guards it with
    CONFIG_USE_BUILTIN_DTB:

    core-$(CONFIG_USE_BUILTIN_DTB) += arch/sh/boot/dts/

    Now, there is another path to descend there from the top Makefile
    when CONFIG_OF_EARLY_FLATTREE=y. If CONFIG_USE_BUILTIN_DTB is disabled,
    CONFIG_BUILTIN_DTB_SOURCE is invisible instead of defined as "".

    Add obj-$(CONFIG_USE_BUILTIN_DTB) guard to avoid the attempt to build
    the non-existing file.

    Fixes: 37c8a5fafa3b ("kbuild: consolidate Devicetree dtb build rules")
    Reported-by: kbuild test robot
    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

07 Feb, 2019

3 commits

  • This adds 21 new system calls on each ABI that has 32-bit time_t
    today. All of these have the exact same semantics as their existing
    counterparts, and the new ones all have macro names that end in 'time64'
    for clarification.

    This gets us to the point of being able to safely use a C library
    that has 64-bit time_t in user space. There are still a couple of
    loose ends to tie up in various areas of the code, but this is the
    big one, and should be entirely uncontroversial at this point.

    In particular, there are four system calls (getitimer, setitimer,
    waitid, and getrusage) that don't have a 64-bit counterpart yet,
    but these can all be safely implemented in the C library by wrapping
    around the existing system calls because the 32-bit time_t they
    pass only counts elapsed time, not time since the epoch. They
    will be dealt with later.

    Signed-off-by: Arnd Bergmann
    Acked-by: Heiko Carstens
    Acked-by: Geert Uytterhoeven
    Acked-by: Catalin Marinas

    Arnd Bergmann
     
  • The time, stime, utime, utimes, and futimesat system calls are only
    used on older architectures, and we do not provide y2038 safe variants
    of them, as they are replaced by clock_gettime64, clock_settime64,
    and utimensat_time64.

    However, for consistency it seems better to have the 32-bit architectures
    that still use them call the "time32" entry points (leaving the
    traditional handlers for the 64-bit architectures), like we do for system
    calls that now require two versions.

    Note: We used to always define __ARCH_WANT_SYS_TIME and
    __ARCH_WANT_SYS_UTIME and only set __ARCH_WANT_COMPAT_SYS_TIME and
    __ARCH_WANT_SYS_UTIME32 for compat mode on 64-bit kernels. Now this is
    reversed: only 64-bit architectures set __ARCH_WANT_SYS_TIME/UTIME, while
    we need __ARCH_WANT_SYS_TIME32/UTIME32 for 32-bit architectures and compat
    mode. The resulting asm/unistd.h changes look a bit counterintuitive.

    This is only a cleanup patch and it should not change any behavior.

    Signed-off-by: Arnd Bergmann
    Acked-by: Geert Uytterhoeven
    Acked-by: Heiko Carstens

    Arnd Bergmann
     
  • This is the big flip, where all 32-bit architectures set COMPAT_32BIT_TIME
    and use the _time32 system calls from the former compat layer instead
    of the system calls that take __kernel_timespec and similar arguments.

    The temporary redirects for __kernel_timespec, __kernel_itimerspec
    and __kernel_timex can get removed with this.

    It would be easy to split this commit by architecture, but with the new
    generated system call tables, it's easy enough to do it all at once,
    which makes it a little easier to check that the changes are the same
    in each table.

    Acked-by: Geert Uytterhoeven
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

06 Feb, 2019

1 commit

  • This pushes the handling of inversion semantics and open drain
    settings to the GPIO descriptor and gpiolib. All affected board
    files are also augmented.

    This is especially nice since we don't have to have any
    confusing flags passed around to the left and right littering
    the fixed and GPIO regulator drivers and the regulator core.
    It is all just very straight-forward: the core asks the GPIO
    line to be asserted or deasserted and gpiolib deals with the
    rest depending on how the platform is configured: if the line
    is active low, it deals with that, if the line is open drain,
    it deals with that too.

    Cc: Alexander Shiyan # i.MX boards user
    Cc: Haojian Zhuang # MMP2 maintainer
    Cc: Aaro Koskinen # OMAP1 maintainer
    Cc: Tony Lindgren # OMAP1,2,3 maintainer
    Cc: Mike Rapoport # EM-X270 maintainer
    Cc: Robert Jarzmik # EZX maintainer
    Cc: Philipp Zabel # Magician maintainer
    Cc: Petr Cvek # Magician
    Cc: Robert Jarzmik # PXA
    Cc: Paul Parsons # hx4700
    Cc: Daniel Mack # Raumfeld maintainer
    Cc: Marc Zyngier # Zeus maintainer
    Cc: Geert Uytterhoeven # SuperH pinctrl/GPIO maintainer
    Cc: Russell King # SA1100
    Tested-by: Marek Szyprowski
    Tested-by: Janusz Krzysztofik #OMAP1 Amstrad Delta
    Signed-off-by: Linus Walleij
    Signed-off-by: Mark Brown

    Linus Walleij
     

26 Jan, 2019

4 commits

  • Most architectures define system call numbers for the rseq and pkey system
    calls, even when they don't support the features, and perhaps never will.

    Only a few architectures are missing these, so just define them anyway
    for consistency. If we decide to add them later to one of these, the
    system call numbers won't get out of sync then.

    Signed-off-by: Arnd Bergmann
    Acked-by: Heiko Carstens
    Acked-by: Geert Uytterhoeven

    Arnd Bergmann
     
  • The IPC system call handling is highly inconsistent across architectures,
    some use sys_ipc, some use separate calls, and some use both. We also
    have some architectures that require passing IPC_64 in the flags, and
    others that set it implicitly.

    For the addition of a y2038 safe semtimedop() system call, I chose to only
    support the separate entry points, but that requires first supporting
    the regular ones with their own syscall numbers.

    The IPC_64 is now implied by the new semctl/shmctl/msgctl system
    calls even on the architectures that require passing it with the ipc()
    multiplexer.

    I'm not adding the new semtimedop() or semop() on 32-bit architectures,
    those will get implemented using the new semtimedop_time64() version
    that gets added along with the other time64 calls.
    Three 64-bit architectures (powerpc, s390 and sparc) get semtimedop().

    Signed-off-by: Arnd Bergmann
    Acked-by: Geert Uytterhoeven
    Acked-by: Heiko Carstens

    Arnd Bergmann
     
  • statx is available on almost all other architectures but
    got missed on sh, so add it now.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • When I merged this patch, the file was accidentally left intact
    instead of being removed, which means any changes to syscall.tbl
    have no effect.

    Fixes: 2b3c5a99d5f3 ("sh: generate uapi header and syscall table header files")
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

07 Jan, 2019

2 commits

  • Pull more Kbuild updates from Masahiro Yamada:

    - improve boolinit.cocci and use_after_iter.cocci semantic patches

    - fix alignment for kallsyms

    - move 'asm goto' compiler test to Kconfig and clean up jump_label
    CONFIG option

    - generate asm-generic wrappers automatically if arch does not
    implement mandatory UAPI headers

    - remove redundant generic-y defines

    - misc cleanups

    * tag 'kbuild-v4.21-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    kconfig: rename generated .*conf-cfg to *conf-cfg
    kbuild: remove unnecessary stubs for archheader and archscripts
    kbuild: use assignment instead of define ... endef for filechk_* rules
    arch: remove redundant UAPI generic-y defines
    kbuild: generate asm-generic wrappers if mandatory headers are missing
    arch: remove stale comments "UAPI Header export list"
    riscv: remove redundant kernel-space generic-y
    kbuild: change filechk to surround the given command with { }
    kbuild: remove redundant target cleaning on failure
    kbuild: clean up rule_dtc_dt_yaml
    kbuild: remove UIMAGE_IN and UIMAGE_OUT
    jump_label: move 'asm goto' support test to Kconfig
    kallsyms: lower alignment on ARM
    scripts: coccinelle: boolinit: drop warnings on named constants
    scripts: coccinelle: check for redeclaration
    kconfig: remove unused "file" field of yylval union
    nds32: remove redundant kernel-space generic-y
    nios2: remove unneeded HAS_DMA define

    Linus Torvalds
     
  • Commit 594cc251fdd0 ("make 'user_access_begin()' do 'access_ok()'")
    broke both alpha and SH booting in qemu, as noticed by Guenter Roeck.

    It turns out that the bug wasn't actually in that commit itself (which
    would have been surprising: it was mostly a no-op), but in how the
    addition of access_ok() to the strncpy_from_user() and strnlen_user()
    functions now triggered the case where those functions would test the
    access of the very last byte of the user address space.

    The string functions actually did that user range test before too, but
    they did it manually by just comparing against user_addr_max(). But
    with user_access_begin() doing the check (using "access_ok()"), it now
    exposed problems in the architecture implementations of that function.

    For example, on alpha, the access_ok() helper macro looked like this:

    #define __access_ok(addr, size) \
    ((get_fs().seg & (addr | size | (addr+size))) == 0)

    and what it basically tests is of any of the high bits get set (the
    USER_DS masking value is 0xfffffc0000000000).

    And that's completely wrong for the "addr+size" check. Because it's
    off-by-one for the case where we check to the very end of the user
    address space, which is exactly what the strn*_user() functions do.

    Why? Because "addr+size" will be exactly the size of the address space,
    so trying to access the last byte of the user address space will fail
    the __access_ok() check, even though it shouldn't. As a result, the
    user string accessor functions failed consistently - because they
    literally don't know how long the string is going to be, and the max
    access is going to be that last byte of the user address space.

    Side note: that alpha macro is buggy for another reason too - it re-uses
    the arguments twice.

    And SH has another version of almost the exact same bug:

    #define __addr_ok(addr) \
    ((unsigned long __force)(addr) < current_thread_info()->addr_limit.seg)

    so far so good: yes, a user address must be below the limit. But then:

    #define __access_ok(addr, size) \
    (__addr_ok((addr) + (size)))

    is wrong with the exact same off-by-one case: the case when "addr+size"
    is exactly _equal_ to the limit is actually perfectly fine (think "one
    byte access at the last address of the user address space")

    The SH version is actually seriously buggy in another way: it doesn't
    actually check for overflow, even though it did copy the _comment_ that
    talks about overflow.

    So it turns out that both SH and alpha actually have completely buggy
    implementations of access_ok(), but they happened to work in practice
    (although the SH overflow one is a serious serious security bug, not
    that anybody likely cares about SH security).

    This fixes the problems by using a similar macro on both alpha and SH.
    It isn't trying to be clever, the end address is based on this logic:

    unsigned long __ao_end = __ao_a + __ao_b - !!__ao_b;

    which basically says "add start and length, and then subtract one unless
    the length was zero". We can't subtract one for a zero length, or we'd
    just hit an underflow instead.

    For a lot of access_ok() users the length is a constant, so this isn't
    actually as expensive as it initially looks.

    Reported-and-tested-by: Guenter Roeck
    Cc: Matt Turner
    Cc: Yoshinori Sato
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

06 Jan, 2019

6 commits

  • Now that Kbuild automatically creates asm-generic wrappers for missing
    mandatory headers, it is redundant to list the same headers in
    generic-y and mandatory-y.

    Suggested-by: Sam Ravnborg
    Signed-off-by: Masahiro Yamada
    Acked-by: Sam Ravnborg

    Masahiro Yamada
     
  • These comments are leftovers of commit fcc8487d477a ("uapi: export all
    headers under uapi directories").

    Prior to that commit, exported headers must be explicitly added to
    header-y. Now, all headers under the uapi/ directories are exported.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Since commit 9c2af1c7377a ("kbuild: add .DELETE_ON_ERROR special
    target"), the target file is automatically deleted on failure.

    The boilerplate code

    ... || { rm -f $@; false; }

    is unneeded.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Pull ftrace sh build fix from Steven Rostedt:
    "It appears that the zero-day bot did find a bug in my sh build.

    And that I didn't have the bad code in my config file when I cross
    compiled it, although there are a few other errors in sh that makes it
    not build for me, I missed that I added one more"

    * tag 'trace-v4.21-1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
    sh: ftrace: Fix missing parenthesis in WARN_ON()

    Linus Torvalds
     
  • Pull vfs mount API prep from Al Viro:
    "Mount API prereqs.

    Mostly that's LSM mount options cleanups. There are several minor
    fixes in there, but nothing earth-shattering (leaks on failure exits,
    mostly)"

    * 'mount.part1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (27 commits)
    mount_fs: suppress MAC on MS_SUBMOUNT as well as MS_KERNMOUNT
    smack: rewrite smack_sb_eat_lsm_opts()
    smack: get rid of match_token()
    smack: take the guts of smack_parse_opts_str() into a new helper
    LSM: new method: ->sb_add_mnt_opt()
    selinux: rewrite selinux_sb_eat_lsm_opts()
    selinux: regularize Opt_... names a bit
    selinux: switch away from match_token()
    selinux: new helper - selinux_add_opt()
    LSM: bury struct security_mnt_opts
    smack: switch to private smack_mnt_opts
    selinux: switch to private struct selinux_mnt_opts
    LSM: hide struct security_mnt_opts from any generic code
    selinux: kill selinux_sb_get_mnt_opts()
    LSM: turn sb_eat_lsm_opts() into a method
    nfs_remount(): don't leak, don't ignore LSM options quietly
    btrfs: sanitize security_mnt_opts use
    selinux; don't open-code a loop in sb_finish_set_opts()
    LSM: split ->sb_set_mnt_opts() out of ->sb_kern_mount()
    new helper: security_sb_eat_lsm_opts()
    ...

    Linus Torvalds
     
  • Merge more updates from Andrew Morton:

    - procfs updates

    - various misc bits

    - lib/ updates

    - epoll updates

    - autofs

    - fatfs

    - a few more MM bits

    * emailed patches from Andrew Morton : (58 commits)
    mm/page_io.c: fix polled swap page in
    checkpatch: add Co-developed-by to signature tags
    docs: fix Co-Developed-by docs
    drivers/base/platform.c: kmemleak ignore a known leak
    fs: don't open code lru_to_page()
    fs/: remove caller signal_pending branch predictions
    mm/: remove caller signal_pending branch predictions
    arch/arc/mm/fault.c: remove caller signal_pending_branch predictions
    kernel/sched/: remove caller signal_pending branch predictions
    kernel/locking/mutex.c: remove caller signal_pending branch predictions
    mm: select HAVE_MOVE_PMD on x86 for faster mremap
    mm: speed up mremap by 20x on large regions
    mm: treewide: remove unused address argument from pte_alloc functions
    initramfs: cleanup incomplete rootfs
    scripts/gdb: fix lx-version string output
    kernel/kcov.c: mark write_comp_data() as notrace
    kernel/sysctl: add panic_print into sysctl
    panic: add options to print system info when panic happens
    bfs: extra sanity checking and static inode bitmap
    exec: separate MM_ANONPAGES and RLIMIT_STACK accounting
    ...

    Linus Torvalds
     

05 Jan, 2019

1 commit

  • Patch series "Add support for fast mremap".

    This series speeds up the mremap(2) syscall by copying page tables at
    the PMD level even for non-THP systems. There is concern that the extra
    'address' argument that mremap passes to pte_alloc may do something
    subtle architecture related in the future that may make the scheme not
    work. Also we find that there is no point in passing the 'address' to
    pte_alloc since its unused. This patch therefore removes this argument
    tree-wide resulting in a nice negative diff as well. Also ensuring
    along the way that the enabled architectures do not do anything funky
    with the 'address' argument that goes unnoticed by the optimization.

    Build and boot tested on x86-64. Build tested on arm64. The config
    enablement patch for arm64 will be posted in the future after more
    testing.

    The changes were obtained by applying the following Coccinelle script.
    (thanks Julia for answering all Coccinelle questions!).
    Following fix ups were done manually:
    * Removal of address argument from pte_fragment_alloc
    * Removal of pte_alloc_one_fast definitions from m68k and microblaze.

    // Options: --include-headers --no-includes
    // Note: I split the 'identifier fn' line, so if you are manually
    // running it, please unsplit it so it runs for you.

    virtual patch

    @pte_alloc_func_def depends on patch exists@
    identifier E2;
    identifier fn =~
    "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
    type T2;
    @@

    fn(...
    - , T2 E2
    )
    { ... }

    @pte_alloc_func_proto_noarg depends on patch exists@
    type T1, T2, T3, T4;
    identifier fn =~ "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
    @@

    (
    - T3 fn(T1, T2);
    + T3 fn(T1);
    |
    - T3 fn(T1, T2, T4);
    + T3 fn(T1, T2);
    )

    @pte_alloc_func_proto depends on patch exists@
    identifier E1, E2, E4;
    type T1, T2, T3, T4;
    identifier fn =~
    "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
    @@

    (
    - T3 fn(T1 E1, T2 E2);
    + T3 fn(T1 E1);
    |
    - T3 fn(T1 E1, T2 E2, T4 E4);
    + T3 fn(T1 E1, T2 E2);
    )

    @pte_alloc_func_call depends on patch exists@
    expression E2;
    identifier fn =~
    "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
    @@

    fn(...
    -, E2
    )

    @pte_alloc_macro depends on patch exists@
    identifier fn =~
    "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
    identifier a, b, c;
    expression e;
    position p;
    @@

    (
    - #define fn(a, b, c) e
    + #define fn(a, b) e
    |
    - #define fn(a, b) e
    + #define fn(a) e
    )

    Link: http://lkml.kernel.org/r/20181108181201.88826-2-joelaf@google.com
    Signed-off-by: Joel Fernandes (Google)
    Suggested-by: Kirill A. Shutemov
    Acked-by: Kirill A. Shutemov
    Cc: Michal Hocko
    Cc: Julia Lawall
    Cc: Kirill A. Shutemov
    Cc: William Kucharski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joel Fernandes (Google)
     

04 Jan, 2019

2 commits

  • Adding a function inside a WARN_ON() didn't close the WARN_ON parathesis.

    Link: http://lkml.kernel.org/r/201901020958.28Mzbs0O%fengguang.wu@intel.com
    Cc: linux-sh@vger.kernel.org
    Cc: Yoshinori Sato
    Cc: Rich Felker
    Reported-by: kbuild test robot
    Fixes: cec8d0e7f06e ("sh: ftrace: Use ftrace_graph_get_ret_stack() instead of curr_ret_stack")
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     
  • 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: Linus Torvalds

    Linus Torvalds