22 Feb, 2018

5 commits

  • commit 961888b1d76d84efc66a8f5604b06ac12ac2f978 upstream.

    For distributions with old userspace header files, the _sigfault
    structure is different. mpx-mini-test fails with the following
    error:

    [root@Purley]# mpx-mini-test_64 tabletest
    XSAVE is supported by HW & OS
    XSAVE processor supported state mask: 0x2ff
    XSAVE OS supported state mask: 0x2ff
    BNDREGS: size: 64 user: 1 supervisor: 0 aligned: 0
    BNDCSR: size: 64 user: 1 supervisor: 0 aligned: 0
    starting mpx bounds table test
    ERROR: siginfo bounds do not match shadow bounds for register 0

    Fix it by using the correct offset of _lower/_upper in _sigfault.
    RHEL needs this patch to work.

    Signed-off-by: Rui Wang
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: dave.hansen@linux.intel.com
    Fixes: e754aedc26ef ("x86/mpx, selftests: Add MPX self test")
    Link: http://lkml.kernel.org/r/1513586050-1641-1-git-send-email-rui.y.wang@intel.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Rui Wang
     
  • commit 4105c69703cdeba76f384b901712c9397b04e9c2 upstream.

    On 64-bit builds, we should not rely on "int $0x80" working (it only does if
    CONFIG_IA32_EMULATION=y is enabled). To keep the "Set TF and check int80"
    test running on 64-bit installs with CONFIG_IA32_EMULATION=y enabled, build
    this test only if we can also build 32-bit binaries (which should be a
    good approximation for that).

    Signed-off-by: Dominik Brodowski
    Cc: Andy Lutomirski
    Cc: Dmitry Safonov
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kselftest@vger.kernel.org
    Cc: shuah@kernel.org
    Link: http://lkml.kernel.org/r/20180211111013.16888-5-linux@dominikbrodowski.net
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Dominik Brodowski
     
  • commit 2cbc0d66de0480449c75636f55697c7ff3af61fc upstream.

    On 64-bit builds, we should not rely on "int $0x80" working (it only does if
    CONFIG_IA32_EMULATION=y is enabled).

    Without this patch, the move test may succeed, but the "int $0x80" causes
    a segfault, resulting in a false negative output of this self-test.

    Signed-off-by: Dominik Brodowski
    Cc: Andy Lutomirski
    Cc: Dmitry Safonov
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kselftest@vger.kernel.org
    Cc: shuah@kernel.org
    Link: http://lkml.kernel.org/r/20180211111013.16888-4-linux@dominikbrodowski.net
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Dominik Brodowski
     
  • commit ce676638fe7b284132a7d7d5e7e7ad81bab9947e upstream.

    This also gets rid of two build warnings:

    protection_keys.c: In function ‘dumpit’:
    protection_keys.c:419:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
    write(1, buf, nr_read);
    ^~~~~~~~~~~~~~~~~~~~~~

    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Dave Hansen
    Cc: Shuah Khan
    Cc: Andy Lutomirski
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Ingo Molnar
     
  • commit 4c1baad223906943b595a887305f2e8124821dad upstream.

    Running the compaction_test sometimes results in out-of-memory
    failures. When I debugged this, it turned out that the code to
    reset the number of hugepages to the initial value is simply
    broken since we write into an open sysctl file descriptor
    multiple times without seeking back to the start.

    Adding the lseek here fixes the problem.

    Cc: stable@vger.kernel.org
    Reported-by: Naresh Kamboju
    Link: https://bugs.linaro.org/show_bug.cgi?id=3145
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     

17 Jan, 2018

1 commit

  • commit 352909b49ba0d74929b96af6dfbefc854ab6ebb5 upstream.

    This tests that the vsyscall entries do what they're expected to do.
    It also confirms that attempts to read the vsyscall page behave as
    expected.

    If changes are made to the vsyscall code or its memory map handling,
    running this test in all three of vsyscall=none, vsyscall=emulate,
    and vsyscall=native are helpful.

    (Because it's easy, this also compares the vsyscall results to their
    vDSO equivalents.)

    Note to KAISER backporters: please test this under all three
    vsyscall modes. Also, in the emulate and native modes, make sure
    that test_vsyscall_64 agrees with the command line or config
    option as to which mode you're in. It's quite easy to mess up
    the kernel such that native mode accidentally emulates
    or vice versa.

    Greg, etc: please backport this to all your Meltdown-patched
    kernels. It'll help make sure the patches didn't regress
    vsyscalls.

    CSigned-off-by: Andy Lutomirski
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Dave Hansen
    Cc: Greg Kroah-Hartman
    Cc: H. Peter Anvin
    Cc: Hugh Dickins
    Cc: Josh Poimboeuf
    Cc: Juergen Gross
    Cc: Kees Cook
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: stable@vger.kernel.org
    Link: http://lkml.kernel.org/r/2b9c5a174c1d60fd7774461d518aa75598b1d8fd.1515719552.git.luto@kernel.org
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     

20 Dec, 2017

1 commit

  • [ Upstream commit 46aa6a302b53f543f8e8b8e1714dc5e449ad36a6 ]

    linux/tools/testing/selftests/vm $ make

    gcc -Wall -I ../../../../usr/include compaction_test.c -lrt -o /compaction_test
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.4/../../../../x86_64-pc-linux-gnu/bin/ld: cannot open output file /compaction_test: Permission denied
    collect2: error: ld returned 1 exit status
    make: *** [../lib.mk:54: /compaction_test] Error 1

    Since commit a8ba798bc8ec ("selftests: enable O and KBUILD_OUTPUT")
    selftests/vm build fails if run from the "selftests/vm" directory, but
    it works in the selftests/ directory. It's quicker to be able to do a
    local vm-only build after a tree wipe and this patch allows for it
    again.

    Link: http://lkml.kernel.org/r/20170302173738.18994-4-aarcange@redhat.com
    Signed-off-by: Andrea Arcangeli
    Cc: Mike Rapoport
    Cc: "Dr. David Alan Gilbert"
    Cc: Mike Kravetz
    Cc: Pavel Emelyanov
    Cc: Hillf Danton
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Andrea Arcangeli
     

14 Dec, 2017

3 commits

  • [ Upstream commit a6400120d042397675fcf694060779d21e9e762d ]

    The MPX hardware data structurse are defined in a weird way: they define
    their size in bytes and then union that with the type with which we want
    to access them.

    Yes, this is weird, but it does work. But, new GCC's complain that we
    are accessing the array out of bounds. Just make it a zero-sized array
    so gcc will stop complaining. There was not really a bug here.

    Signed-off-by: Dave Hansen
    Acked-by: Thomas Gleixner
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20171111001229.58A7933D@viggo.jf.intel.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dave Hansen
     
  • [ Upstream commit a6d8a21596df041f36f4c2ccc260c459e3e851f1 ]

    Tests under alignment subdirectory are skipped when executed on previous
    generation hardware, but harness still marks them as failed.

    test: test_copy_unaligned
    tags: git_version:unknown
    [SKIP] Test skipped on line 26
    skip: test_copy_unaligned
    selftests: copy_unaligned [FAIL]

    The MAGIC_SKIP_RETURN_VALUE value assigned to rc variable is retained till
    the program exit which causes the test to be marked as failed.

    This patch resets the value before returning to the main() routine.
    With this patch the test o/p is as follows:

    test: test_copy_unaligned
    tags: git_version:unknown
    [SKIP] Test skipped on line 26
    skip: test_copy_unaligned
    selftests: copy_unaligned [PASS]

    Signed-off-by: Sachin Sant
    Signed-off-by: Michael Ellerman
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sachin Sant
     
  • [ Upstream commit 2a4d0c627f5374f365a873dea4e10ae0bb437680 ]

    Kernel erases R8..R11 registers prior returning to userspace
    from int80:

    https://lkml.org/lkml/2009/10/1/164

    GCC can reuse these registers and doesn't expect them to change
    during syscall invocation. I met this kind of bug in CRIU once
    GCC 6.1 and CLANG stored local variables in those registers
    and the kernel zerofied them during syscall:

    https://github.com/xemul/criu/commit/990d33f1a1cdd17bca6c2eb059ab3be2564f7fa2

    By that reason I suggest to add those registers to clobbers
    in selftests. Also, as noted by Andy - removed unneeded clobber
    for flags in INT $0x80 inline asm.

    Signed-off-by: Dmitry Safonov
    Acked-by: Andy Lutomirski
    Cc: 0x7f454c46@gmail.com
    Cc: Borislav Petkov
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Shuah Khan
    Cc: Thomas Gleixner
    Cc: linux-kselftest@vger.kernel.org
    Link: http://lkml.kernel.org/r/20170213101336.20486-1-dsafonov@virtuozzo.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Safonov
     

10 Dec, 2017

1 commit

  • [ Upstream commit fec8f5ae1715a01c72ad52cb2ecd8aacaf142302 ]

    We weren't testing the .limit and .limit_in_pages fields very well.
    Add more tests.

    This addition seems to trigger the "bits 16:19 are undefined" issue
    that was fixed in an earlier patch. I think that, at least on my
    CPU, the high nibble of the limit ends in LAR bits 16:19.

    Signed-off-by: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/5601c15ea9b3113d288953fd2838b18bedf6bc67.1509794321.git.luto@kernel.org
    Signed-off-by: Ingo Molnar
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     

15 Nov, 2017

2 commits

  • commit afb999cdef69148f366839e74470d8f5375ba5f1 upstream.

    Some distributions (Debian, OpenSUSE) have a udev rule in place to cancel
    all fallback mechanism uevents immediately. This would obviously
    make it hard to test against the fallback mechanism test interface,
    so we need to check for this.

    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: Amit Pundir
    Signed-off-by: Greg Kroah-Hartman

    Luis R. Rodriguez
     
  • commit 880444e214cfd293a2e8cc4bd3505f7ffa6ce33a upstream.

    Error that we expect should not be spilled to stdout.

    Without this we get:

    ./fw_filesystem.sh: line 58: printf: write error: Invalid argument
    ./fw_filesystem.sh: line 63: printf: write error: No such device
    ./fw_filesystem.sh: line 69: echo: write error: No such file or directory
    ./fw_filesystem.sh: filesystem loading works
    ./fw_filesystem.sh: async filesystem loading works

    With it:

    ./fw_filesystem.sh: filesystem loading works
    ./fw_filesystem.sh: async filesystem loading works

    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: Amit Pundir
    Signed-off-by: Greg Kroah-Hartman

    Luis R. Rodriguez
     

05 Oct, 2017

1 commit

  • commit 10859f3855db4c6f10dc7974ff4b3a292f3de8e0 upstream.

    The 2.26 release of glibc changed how siginfo_t is defined, and the earlier
    work-around to using the kernel definition are no longer needed. The old
    way needs to stay around for a while, though.

    Reported-by: Seth Forshee
    Cc: Andy Lutomirski
    Cc: Will Drewry
    Cc: Shuah Khan
    Cc: linux-kselftest@vger.kernel.org
    Signed-off-by: Kees Cook
    Tested-by: Seth Forshee
    Signed-off-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Kees Cook
     

14 Sep, 2017

1 commit

  • commit 23d98c204386a98d9ef9f9e744f41443ece4929f upstream.

    Those are funny cases. Make sure they work.

    (Something is screwy with signal handling if a selector is 1, 2, or 3.
    Anyone who wants to dive into that rabbit hole is welcome to do so.)

    Signed-off-by: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Chang Seok
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     

30 Aug, 2017

2 commits

  • commit 0eb46345364d7318b11068c46e8a68d5dc10f65e upstream.

    After the link tests, there is a race on one side of the test for
    the link coming up. It's possible, in some cases, for the test script
    to write to the 'peer_trans' files before the link has come up.

    To fix this, we simply use the link event file to ensure both sides
    see the link as up before continuning.

    Signed-off-by: Logan Gunthorpe
    Acked-by: Allen Hubbe
    Signed-off-by: Jon Mason
    Fixes: a9c59ef77458 ("ntb_test: Add a selftest script for the NTB subsystem")
    Signed-off-by: Greg Kroah-Hartman

    Logan Gunthorpe
     
  • commit 07b0b22b3e58824f70b9188d085d400069ca3240 upstream.

    The code mistakenly prints the local perf results for the remote test
    so the script reports identical results for both directions. Fix this
    by ensuring we print the remote result.

    Signed-off-by: Logan Gunthorpe
    Fixes: a9c59ef77458 ("ntb_test: Add a selftest script for the NTB subsystem")
    Acked-by: Allen Hubbe
    Signed-off-by: Jon Mason
    Signed-off-by: Greg Kroah-Hartman

    Logan Gunthorpe
     

21 Jul, 2017

1 commit

  • commit 796a3bae2fba6810427efdb314a1c126c9490fb3 upstream.

    test_execve does rather odd mount manipulations to safely create
    temporary setuid and setgid executables that aren't visible to the
    rest of the system. Those executables end up in the test's cwd, but
    that cwd is MNT_DETACHed.

    The core namespace code considers MNT_DETACHed trees to belong to no
    mount namespace at all and, in general, MNT_DETACHed trees are only
    barely function. This interacted with commit 380cf5ba6b0a ("fs:
    Treat foreign mounts as nosuid") to cause all MNT_DETACHed trees to
    act as though they're nosuid, breaking the test.

    Fix it by just not detaching the tree. It's still in a private
    mount namespace and is therefore still invisible to the rest of the
    system (except via /proc, and the same nosuid logic will protect all
    other programs on the system from believing in test_execve's setuid
    bits).

    While we're at it, fix some blatant whitespace problems.

    Reported-by: Naresh Kamboju
    Fixes: 380cf5ba6b0a ("fs: Treat foreign mounts as nosuid")
    Cc: "Eric W. Biederman"
    Cc: Kees Cook
    Cc: Shuah Khan
    Cc: Greg KH
    Cc: linux-kselftest@vger.kernel.org
    Signed-off-by: Andy Lutomirski
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Shuah Khan
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     

20 May, 2017

1 commit

  • commit 65973dd3fd31151823f4b8c289eebbb3fb7e6bc0 upstream.

    i386 glibc is buggy and calls the sigaction syscall incorrectly.

    This is asymptomatic for normal programs, but it blows up on
    programs that do evil things with segmentation. The ldt_gdt
    self-test is an example of such an evil program.

    This doesn't appear to be a regression -- I think I just got lucky
    with the uninitialized memory that glibc threw at the kernel when I
    wrote the test.

    This hackish fix manually issues sigaction(2) syscalls to undo the
    damage. Without the fix, ldt_gdt_32 segfaults; with the fix, it
    passes for me.

    See: https://sourceware.org/bugzilla/show_bug.cgi?id=21269

    Signed-off-by: Andy Lutomirski
    Cc: Boris Ostrovsky
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Juergen Gross
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Garnier
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/aaab0f9f93c9af25396f01232608c163a760a668.1490218061.git.luto@kernel.org
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Andy Lutomirski
     

14 May, 2017

1 commit

  • commit e64d5fbe56259c94df504af8ce804cfc6a022adb upstream.

    Ingo pointed out that the MPX tests were no longer in the selftests
    Makefile. It appears that I shot myself in the foot on this one
    and accidentally removed them when I added the pkeys tests, probably
    from bungling a merge conflict.

    Reported-by: Ingo Molnar
    Signed-off-by: Dave Hansen
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Fixes: 5f23f6d082a9 ("x86/pkeys: Add self-tests")
    Link: http://lkml.kernel.org/r/20170201225629.C3070852@viggo.jf.intel.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Dave Hansen
     

15 Mar, 2017

1 commit

  • commit 32677207dcc5e594254b7fb4fb2352b1755b1d5b upstream.

    The child_exit errno needs to be shifted by 8 bits to compare against the
    return values for the bisect variables.

    Fixes: c5dacb88f0a64 ("ktest: Allow overriding bisect test results")
    Signed-off-by: Steven Rostedt (VMware)
    Signed-off-by: Greg Kroah-Hartman

    Steven Rostedt (VMware)
     

26 Jan, 2017

1 commit


20 Jan, 2017

2 commits


07 Dec, 2016

1 commit

  • A recent flurry of bug discoveries in the nfit driver's DSM marshalling
    routine has highlighted the fact that we do not have unit test coverage
    for this routine. Add a self-test of acpi_nfit_ctl() routine before
    probing the "nfit_test.0" device. This mocks stimulus to acpi_nfit_ctl()
    and if any of the tests fail "nfit_test.0" will be unavailable causing
    the rest of the tests to not run / fail.

    This unit test will also be a place to land reproductions of quirky BIOS
    behavior discovered in the field and ensure the kernel does not regress
    against implementations it has seen in practice.

    Signed-off-by: Dan Williams

    Dan Williams
     

15 Oct, 2016

2 commits

  • …/kernel/git/shuah/linux-kselftest

    Pull kselftest updates from Shuah Khan:
    "This update consists of:

    - Fixes and improvements to existing tests

    - Moving code from Documentation to selftests, samples, and tools:

    * Moves dnotify_test, prctl, ptp, vDSO, ia64, watchdog, and
    networking tests from Documentation to selftests.

    * Moves mic/mpssd, misc-devices/mei, timers, watchdog, auxdisplay,
    and blackfin examples from Documentation to samples.

    * Moves accounting, laptops/dslm, and pcmcia/crc32hash tools from
    Documentation to tools.

    * Deletes BUILD_DOCSRC and its dependencies"

    * tag 'linux-kselftest-4.9-rc1-update' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (21 commits)
    selftests/futex: Check ANSI terminal color support
    Doc: update 00-INDEX files to reflect the runnable code move
    samples: move blackfin gptimers-example from Documentation
    tools: move pcmcia crc32hash tool from Documentation
    tools: move laptops dslm tool from Documentation
    tools: move accounting tool from Documentation
    samples: move auxdisplay example code from Documentation
    samples: move watchdog example code from Documentation
    samples: move timers example code from Documentation
    samples: move misc-devices/mei example code from Documentation
    samples: move mic/mpssd example code from Documentation
    selftests: Move networking/timestamping from Documentation
    selftests: move watchdog tests from Documentation/watchdog
    selftests: move ia64 tests from Documentation/ia64
    selftests: move vDSO tests from Documentation/vDSO
    selftests: move ptp tests from Documentation/ptp
    selftests: move prctl tests from Documentation/prctl
    selftests: move dnotify_test from Documentation/filesystems
    selftests/timers: Add missing error code assignment before test
    selftests/zram: replace ZRAM_LZ4_COMPRESS
    ...

    Linus Torvalds
     
  • Pull more powerpc updates from Michael Ellerman:
    "Some more powerpc updates for 4.9:

    Freescale updates from Scott Wood:
    - qbman support (a prerequisite for datapath drivers such as ethernet)
    - a PCI DMA fix+improvement
    - reset handler changes
    - more 8xx optimizations
    - some cleanups and fixes.'

    Fixes:
    - selftests/powerpc: Add missing binaries to .gitignores (Michael Ellerman)
    - selftests/powerpc: Fix build break caused by EXPORT_SYMBOL changes (Michael Ellerman)
    - powerpc/pseries: Fix stack corruption in htpe code (Laurent Dufour)
    - powerpc/64s: Fix power4_fixup_nap placement (Nicholas Piggin)
    - powerpc/64: Fix incorrect return value from __copy_tofrom_user (Paul Mackerras)
    - powerpc/mm/hash64: Fix might_have_hea() check (Michael Ellerman)

    Other:
    - MAINTAINERS: Remove myself from PA Semi entries (Olof Johansson)
    - MAINTAINERS: Drop separate pseries entry (Michael Ellerman)
    - MAINTAINERS: Update powerpc website & add selftests (Michael Ellerman):

    * tag 'powerpc-4.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (35 commits)
    powerpc/mm/hash64: Fix might_have_hea() check
    powerpc/64: Fix incorrect return value from __copy_tofrom_user
    powerpc/64s: Fix power4_fixup_nap placement
    powerpc/pseries: Fix stack corruption in htpe code
    selftests/powerpc: Fix build break caused by EXPORT_SYMBOL changes
    MAINTAINERS: Update powerpc website & add selftests
    MAINTAINERS: Drop separate pseries entry
    MAINTAINERS: Remove myself from PA Semi entries
    selftests/powerpc: Add missing binaries to .gitignores
    arch/powerpc: Add CONFIG_FSL_DPAA to corenetXX_smp_defconfig
    soc/qman: Add self-test for QMan driver
    soc/bman: Add self-test for BMan driver
    soc/fsl: Introduce DPAA 1.x QMan device driver
    soc/fsl: Introduce DPAA 1.x BMan device driver
    powerpc/8xx: make user addr DTLB miss the short path
    powerpc/8xx: Move additional DTLBMiss handlers out of exception area
    powerpc/8xx: use r3 to scratch CR in ITLBmiss
    soc/fsl/qe: fix gpio save_regs functions
    powerpc/8xx: add dedicated machine check handler
    powerpc/8xx: add system_reset_exception
    ...

    Linus Torvalds
     

12 Oct, 2016

5 commits

  • Merge more updates from Andrew Morton:

    - a few block updates that fell in my lap

    - lib/ updates

    - checkpatch

    - autofs

    - ipc

    - a ton of misc other things

    * emailed patches from Andrew Morton : (100 commits)
    mm: split gfp_mask and mapping flags into separate fields
    fs: use mapping_set_error instead of opencoded set_bit
    treewide: remove redundant #include
    hung_task: allow hung_task_panic when hung_task_warnings is 0
    kthread: add kerneldoc for kthread_create()
    kthread: better support freezable kthread workers
    kthread: allow to modify delayed kthread work
    kthread: allow to cancel kthread work
    kthread: initial support for delayed kthread work
    kthread: detect when a kthread work is used by more workers
    kthread: add kthread_destroy_worker()
    kthread: add kthread_create_worker*()
    kthread: allow to call __kthread_create_on_node() with va_list args
    kthread/smpboot: do not park in kthread_create_on_cpu()
    kthread: kthread worker API cleanup
    kthread: rename probe_kthread_data() to kthread_probe_data()
    scripts/tags.sh: enable code completion in VIM
    mm: kmemleak: avoid using __va() on addresses that don't have a lowmem mapping
    kdump, vmcoreinfo: report memory sections virtual addresses
    ipc/sem.c: add cond_resched in exit_sme
    ...

    Linus Torvalds
     
  • Kernel source files need not include explicitly
    because the top Makefile forces to include it with:

    -include $(srctree)/include/linux/kconfig.h

    This commit removes explicit includes except the following:

    * arch/s390/include/asm/facilities_src.h
    * tools/testing/radix-tree/linux/kernel.h

    These two are used for host programs.

    Link: http://lkml.kernel.org/r/1473656164-11929-1-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     
  • The pthread_mutex_t in regression1.c wasn't being initialized properly.

    Link: http://lkml.kernel.org/r/20160815194237.25967-4-ross.zwisler@linux.intel.com
    Signed-off-by: Ross Zwisler
    Cc: Konstantin Khlebnikov
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Cc: Shuah Khan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ross Zwisler
     
  • There are four cases I can see where we could end up with a NULL 'slot' in
    radix_tree_next_slot(). This unit test exercises all four of them, making
    sure that if in the future we have an unsafe path through
    radix_tree_next_slot(), we'll catch it.

    Here are details on the four cases:

    1) radix_tree_iter_retry() via a non-tagged iteration like
    radix_tree_for_each_slot(). In this case we currently aren't seeing a bug
    because radix_tree_iter_retry() sets

    iter->next_index = iter->index;

    which means that in in the else case in radix_tree_next_slot(), 'count' is
    zero, so we skip over the while() loop and effectively just return NULL
    without ever dereferencing 'slot'.

    2) radix_tree_iter_retry() via tagged iteration like
    radix_tree_for_each_tagged(). This case was giving us NULL pointer
    dereferences in testing, and was fixed with this commit:

    commit 3cb9185c6730 ("radix-tree: fix radix_tree_iter_retry() for tagged
    iterators.")

    This fix doesn't explicitly check for 'slot' being NULL, though, it works
    around the NULL pointer dereference by instead zeroing iter->tags in
    radix_tree_iter_retry(), which makes us bail out of the if() case in
    radix_tree_next_slot() before we dereference 'slot'.

    3) radix_tree_iter_next() via via a non-tagged iteration like
    radix_tree_for_each_slot(). This currently happens in shmem_tag_pins()
    and shmem_partial_swap_usage().

    As with non-tagged iteration, 'count' in the else case of
    radix_tree_next_slot() is zero, so we skip over the while() loop and
    effectively just return NULL without ever dereferencing 'slot'.

    4) radix_tree_iter_next() via tagged iteration like
    radix_tree_for_each_tagged(). This happens in shmem_wait_for_pins().

    radix_tree_iter_next() zeros out iter->tags, so we end up exiting
    radix_tree_next_slot() here:

    if (flags & RADIX_TREE_ITER_TAGGED) {
    void *canon = slot;

    iter->tags >>= 1;
    if (unlikely(!iter->tags))
    return NULL;

    Link: http://lkml.kernel.org/r/20160815194237.25967-3-ross.zwisler@linux.intel.com
    Signed-off-by: Ross Zwisler
    Cc: Konstantin Khlebnikov
    Cc: Andrey Ryabinin
    Cc: Dmitry Vyukov
    Cc: Shuah Khan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ross Zwisler
     
  • Pull libnvdimm updates from Dan Williams:
    "Aside from the recently added pmem sub-division support these have
    been in -next for several releases with no reported issues. The sub-
    division support was included in next-20161010 with no reported
    issues. It passes all unit tests including new tests for all the new
    functionality below.

    Summary:

    - PMEM sub-division support: Allow a single PMEM region to be divided
    into multiple namespaces. Originally, ~2 years ago, it was thought
    that partitions of a /dev/pmemX block device could handle
    sub-allocations of persistent memory for different use cases. With
    the decision to not support DAX mappings of raw block-devices, and
    the genesis of device-dax, the need for having multiple
    pmem-namespace per region has grown.

    - Device-DAX unified inode: In support of dynamic-resizing of a
    device-dax instance the kernel arranges for all mappings of a
    device-dax node to share the same inode. This allows unmap /
    truncate / invalidation events to affect all instances of the
    device similar to the behavior of mmap on block devices.

    - Hardware error scrubbing reworks: The original address-range-scrub
    and badblocks tracking solution allowed clearing entries at the
    individual namespace level, but it failed to clear the internal
    list of media errors maintained at the bus level. The result was
    that the next scrub or namespace disable/re-enable event would
    restore the cleared badblocks, but now that is fixed. The v4.8
    kernel introduced an auto-scrub-on-machine-check behavior to
    repopulate the badblocks list. Now, in v4.9, the auto-scrub
    behavior can be disabled and simply arrange for the error reported
    in the machine-check to be added to the list.

    - DIMM health-event notification support: ACPI 6.1 defines a
    notification event code that can be send to ACPI NVDIMM devices. A
    poll(2) capable file descriptor for these events can be obtained
    from the nmemX/nfit/flags sysfs-attribute of a libnvdimm memory
    device.

    - Miscellaneous fixes: NVDIMM-N probe error, device-dax build error,
    and a change to dedup the flush hint list to not flush the memory
    controller more than necessary"

    * tag 'libnvdimm-for-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (39 commits)
    /dev/dax: fix Kconfig dependency build breakage
    dax: use correct dev_t value
    dax: convert devm_create_dax_dev to PTR_ERR
    libnvdimm, namespace: allow creation of multiple pmem-namespaces per region
    libnvdimm, namespace: lift single pmem limit in scan_labels()
    libnvdimm, namespace: filter out of range labels in scan_labels()
    libnvdimm, namespace: enable allocation of multiple pmem namespaces
    libnvdimm, namespace: update label implementation for multi-pmem
    libnvdimm, namespace: expand pmem device naming scheme for multi-pmem
    libnvdimm, region: update nd_region_available_dpa() for multi-pmem support
    libnvdimm, namespace: sort namespaces by dpa at init
    libnvdimm, namespace: allow multiple pmem-namespaces per region at scan time
    tools/testing/nvdimm: support for sub-dividing a pmem region
    libnvdimm, namespace: unify blk and pmem label scanning
    libnvdimm, namespace: refactor uuid_show() into a namespace_to_uuid() helper
    libnvdimm, label: convert label tracking to a linked list
    libnvdimm, region: move region-mapping input-paramters to nd_mapping_desc
    nvdimm: reduce duplicated wpq flushes
    libnvdimm: clear the internal poison_list when clearing badblocks
    pmem: reduce kmap_atomic sections to the memcpys only
    ...

    Linus Torvalds
     

11 Oct, 2016

2 commits

  • Because test for color support of the running shell does not aware ANSI
    type terminals, it does not print colorful messages on some environemnt.
    This commit modifies the test to aware ANSI type terminal, too.

    Signed-off-by: SeongJae Park
    Acked-by: Darren Hart
    Signed-off-by: Shuah Khan

    SeongJae Park
     
  • Pull protection keys syscall interface from Thomas Gleixner:
    "This is the final step of Protection Keys support which adds the
    syscalls so user space can actually allocate keys and protect memory
    areas with them. Details and usage examples can be found in the
    documentation.

    The mm side of this has been acked by Mel"

    * 'mm-pkeys-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/pkeys: Update documentation
    x86/mm/pkeys: Do not skip PKRU register if debug registers are not used
    x86/pkeys: Fix pkeys build breakage for some non-x86 arches
    x86/pkeys: Add self-tests
    x86/pkeys: Allow configuration of init_pkru
    x86/pkeys: Default to a restrictive init PKRU
    pkeys: Add details of system call use to Documentation/
    generic syscalls: Wire up memory protection keys syscalls
    x86: Wire up protection keys system calls
    x86/pkeys: Allocation/free syscalls
    x86/pkeys: Make mprotect_key() mask off additional vm_flags
    mm: Implement new pkey_mprotect() system call
    x86/pkeys: Add fault handling for PF_PK page fault bit

    Linus Torvalds
     

08 Oct, 2016

6 commits

  • Merge updates from Andrew Morton:

    - fsnotify updates

    - ocfs2 updates

    - all of MM

    * emailed patches from Andrew Morton : (127 commits)
    console: don't prefer first registered if DT specifies stdout-path
    cred: simpler, 1D supplementary groups
    CREDITS: update Pavel's information, add GPG key, remove snail mail address
    mailmap: add Johan Hovold
    .gitattributes: set git diff driver for C source code files
    uprobes: remove function declarations from arch/{mips,s390}
    spelling.txt: "modeled" is spelt correctly
    nmi_backtrace: generate one-line reports for idle cpus
    arch/tile: adopt the new nmi_backtrace framework
    nmi_backtrace: do a local dump_stack() instead of a self-NMI
    nmi_backtrace: add more trigger_*_cpu_backtrace() methods
    min/max: remove sparse warnings when they're nested
    Documentation/filesystems/proc.txt: add more description for maps/smaps
    mm, proc: fix region lost in /proc/self/smaps
    proc: fix timerslack_ns CAP_SYS_NICE check when adjusting self
    proc: add LSM hook checks to /proc//timerslack_ns
    proc: relax /proc//timerslack_ns capability requirements
    meminfo: break apart a very long seq_printf with #ifdefs
    seq/proc: modify seq_put_decimal_[u]ll to take a const char *, not char
    proc: faster /proc/*/status
    ...

    Linus Torvalds
     
  • Pull powerpc updates from Michael Ellerman:
    "Highlights:
    - Major rework of Book3S 64-bit exception vectors (Nicholas Piggin)
    - Use gas sections for arranging exception vectors et. al.
    - Large set of TM cleanups and selftests (Cyril Bur)
    - Enable transactional memory (TM) lazily for userspace (Cyril Bur)
    - Support for XZ compression in the zImage wrapper (Oliver
    O'Halloran)
    - Add support for bpf constant blinding (Naveen N. Rao)
    - Beginnings of upstream support for PA Semi Nemo motherboards
    (Darren Stevens)

    Fixes:
    - Ensure .mem(init|exit).text are within _stext/_etext (Michael
    Ellerman)
    - xmon: Don't use ld on 32-bit (Michael Ellerman)
    - vdso64: Use double word compare on pointers (Anton Blanchard)
    - powerpc/nvram: Fix an incorrect partition merge (Pan Xinhui)
    - powerpc: Fix usage of _PAGE_RO in hugepage (Christophe Leroy)
    - powerpc/mm: Update FORCE_MAX_ZONEORDER range to allow hugetlb w/4K
    (Aneesh Kumar K.V)
    - Fix memory leak in queue_hotplug_event() error path (Andrew
    Donnellan)
    - Replay hypervisor maintenance interrupt first (Nicholas Piggin)

    Various performance optimisations (Anton Blanchard):
    - Align hot loops of memset() and backwards_memcpy()
    - During context switch, check before setting mm_cpumask
    - Remove static branch prediction in atomic{, 64}_add_unless
    - Only disable HAVE_EFFICIENT_UNALIGNED_ACCESS on POWER7 little
    endian
    - Set default CPU type to POWER8 for little endian builds

    Cleanups & features:
    - Sparse fixes/cleanups (Daniel Axtens)
    - Preserve CFAR value on SLB miss caused by access to bogus address
    (Paul Mackerras)
    - Radix MMU fixups for POWER9 (Aneesh Kumar K.V)
    - Support for setting used_(vsr|vr|spe) in sigreturn path (for CRIU)
    (Simon Guo)
    - Optimise syscall entry for virtual, relocatable case (Nicholas
    Piggin)
    - Optimise MSR handling in exception handling (Nicholas Piggin)
    - Support for kexec with Radix MMU (Benjamin Herrenschmidt)
    - powernv EEH fixes (Russell Currey)
    - Suprise PCI hotplug support for powernv (Gavin Shan)
    - Endian/sparse fixes for powernv PCI (Gavin Shan)
    - Defconfig updates (Anton Blanchard)
    - KVM: PPC: Book3S HV: Migrate pinned pages out of CMA (Balbir Singh)
    - cxl: Flush PSL cache before resetting the adapter (Frederic Barrat)
    - cxl: replace loop with for_each_child_of_node(), remove unneeded
    of_node_put() (Andrew Donnellan)
    - Fix HV facility unavailable to use correct handler (Nicholas
    Piggin)
    - Remove unnecessary syscall trampoline (Nicholas Piggin)
    - fadump: Fix build break when CONFIG_PROC_VMCORE=n (Michael
    Ellerman)
    - Quieten EEH message when no adapters are found (Anton Blanchard)
    - powernv: Add PHB register dump debugfs handle (Russell Currey)
    - Use kprobe blacklist for exception handlers & asm functions
    (Nicholas Piggin)
    - Document the syscall ABI (Nicholas Piggin)
    - MAINTAINERS: Update cxl maintainers (Michael Neuling)
    - powerpc: Remove all usages of NO_IRQ (Michael Ellerman)

    Minor cleanups:
    - Andrew Donnellan, Christophe Leroy, Colin Ian King, Cyril Bur,
    Frederic Barrat, Pan Xinhui, PrasannaKumar Muralidharan, Rui Teng,
    Simon Guo"

    * tag 'powerpc-4.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (156 commits)
    powerpc/bpf: Add support for bpf constant blinding
    powerpc/bpf: Implement support for tail calls
    powerpc/bpf: Introduce accessors for using the tmp local stack space
    powerpc/fadump: Fix build break when CONFIG_PROC_VMCORE=n
    powerpc: tm: Enable transactional memory (TM) lazily for userspace
    powerpc/tm: Add TM Unavailable Exception
    powerpc: Remove do_load_up_transact_{fpu,altivec}
    powerpc: tm: Rename transct_(*) to ck(\1)_state
    powerpc: tm: Always use fp_state and vr_state to store live registers
    selftests/powerpc: Add checks for transactional VSXs in signal contexts
    selftests/powerpc: Add checks for transactional VMXs in signal contexts
    selftests/powerpc: Add checks for transactional FPUs in signal contexts
    selftests/powerpc: Add checks for transactional GPRs in signal contexts
    selftests/powerpc: Check that signals always get delivered
    selftests/powerpc: Add TM tcheck helpers in C
    selftests/powerpc: Allow tests to extend their kill timeout
    selftests/powerpc: Introduce GPR asm helper header file
    selftests/powerpc: Move VMX stack frame macros to header file
    selftests/powerpc: Rework FPU stack placement macros and move to header file
    selftests/powerpc: Check for VSX preservation across userspace preemption
    ...

    Linus Torvalds
     
  • This patch will randomly perform mlock/mlock2 on a given memory region,
    and verify the RLIMIT_MEMLOCK limitation works properly.

    Suggested-by: David Rientjes
    Link: http://lkml.kernel.org/r/1473325970-11393-4-git-send-email-wei.guo.simon@gmail.com
    Signed-off-by: Simon Guo
    Cc: Shuah Khan
    Cc: Vlastimil Babka
    Cc: "Kirill A. Shutemov"
    Cc: Michal Hocko
    Cc: Eric B Munson
    Cc: Simon Guo
    Cc: Mel Gorman
    Cc: Alexey Klimov
    Cc: Andrea Arcangeli
    Cc: Thierry Reding
    Cc: Mike Kravetz
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Simon Guo
     
  • Function seek_to_smaps_entry() can be useful for other selftest
    functionalities, so move it out to header file.

    Link: http://lkml.kernel.org/r/1473325970-11393-3-git-send-email-wei.guo.simon@gmail.com
    Signed-off-by: Simon Guo
    Cc: Shuah Khan
    Cc: Vlastimil Babka
    Cc: "Kirill A. Shutemov"
    Cc: Michal Hocko
    Cc: Eric B Munson
    Cc: Simon Guo
    Cc: Mel Gorman
    Cc: Alexey Klimov
    Cc: Andrea Arcangeli
    Cc: Thierry Reding
    Cc: Mike Kravetz
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Simon Guo
     
  • This patch adds mlock() test for multiple invocation on the same address
    area, and verify it doesn't mess the rlimit mlock limitation.

    Link: http://lkml.kernel.org/r/1472554781-9835-5-git-send-email-wei.guo.simon@gmail.com
    Signed-off-by: Simon Guo
    Cc: Alexey Klimov
    Cc: Eric B Munson
    Cc: Geert Uytterhoeven
    Cc: "Kirill A. Shutemov"
    Cc: Mel Gorman
    Cc: Michal Hocko
    Cc: Shuah Khan
    Cc: Simon Guo
    Cc: Thierry Reding
    Cc: Vlastimil Babka
    Cc: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Simon Guo
     
  • To prepare mlock2.h whose functionality will be reused.

    Link: http://lkml.kernel.org/r/1472554781-9835-4-git-send-email-wei.guo.simon@gmail.com
    Signed-off-by: Simon Guo
    Cc: Alexey Klimov
    Cc: Eric B Munson
    Cc: Geert Uytterhoeven
    Cc: "Kirill A. Shutemov"
    Cc: Mel Gorman
    Cc: Michal Hocko
    Cc: Shuah Khan
    Cc: Simon Guo
    Cc: Thierry Reding
    Cc: Vlastimil Babka
    Cc: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Simon Guo