28 Mar, 2019

1 commit


26 Mar, 2019

1 commit

  • Commit

    bf904d2762ee ("x86/pti/64: Remove the SYSCALL64 entry trampoline")

    removed the sole usage of kclist_add_remap() but it did not remove the
    left-over definition from the include file.

    Fix the same.

    Signed-off-by: Bhupesh Sharma
    Signed-off-by: Borislav Petkov
    Cc: Adrian Hunter
    Cc: Andrew Morton
    Cc: Dave Anderson
    Cc: Dave Young
    Cc: "David S. Miller"
    Cc: Ingo Molnar
    Cc: James Morse
    Cc: Kairui Song
    Cc: kexec@lists.infradead.org
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: Michael Ellerman
    Cc: Omar Sandoval
    Cc: "Peter Zijlstra (Intel)"
    Cc: Rahul Lakkireddy
    Cc: Thomas Gleixner
    Cc: x86-ml
    Link: https://lkml.kernel.org/r/1553583028-17804-1-git-send-email-bhsharma@redhat.com

    Bhupesh Sharma
     

23 Mar, 2019

1 commit

  • On machines where the GART aperture is mapped over physical RAM,
    /proc/kcore contains the GART aperture range. Accessing the GART range via
    /proc/kcore results in a kernel crash.

    vmcore used to have the same issue, until it was fixed with commit
    2a3e83c6f96c ("x86/gart: Exclude GART aperture from vmcore")', leveraging
    existing hook infrastructure in vmcore to let /proc/vmcore return zeroes
    when attempting to read the aperture region, and so it won't read from the
    actual memory.

    Apply the same workaround for kcore. First implement the same hook
    infrastructure for kcore, then reuse the hook functions introduced in the
    previous vmcore fix. Just with some minor adjustment, rename some functions
    for more general usage, and simplify the hook infrastructure a bit as there
    is no module usage yet.

    Suggested-by: Baoquan He
    Signed-off-by: Kairui Song
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Jiri Bohac
    Acked-by: Baoquan He
    Cc: Borislav Petkov
    Cc: "H. Peter Anvin"
    Cc: Alexey Dobriyan
    Cc: Andrew Morton
    Cc: Omar Sandoval
    Cc: Dave Young
    Link: https://lkml.kernel.org/r/20190308030508.13548-1-kasong@redhat.com

    Kairui Song
     

27 Aug, 2018

1 commit

  • Pull perf updates from Thomas Gleixner:
    "Kernel:
    - Improve kallsyms coverage
    - Add x86 entry trampolines to kcore
    - Fix ARM SPE handling
    - Correct PPC event post processing

    Tools:
    - Make the build system more robust
    - Small fixes and enhancements all over the place
    - Update kernel ABI header copies
    - Preparatory work for converting libtraceevnt to a shared library
    - License cleanups"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (100 commits)
    tools arch: Update arch/x86/lib/memcpy_64.S copy used in 'perf bench mem memcpy'
    tools arch x86: Update tools's copy of cpufeatures.h
    perf python: Fix pyrf_evlist__read_on_cpu() interface
    perf mmap: Store real cpu number in 'struct perf_mmap'
    perf tools: Remove ext from struct kmod_path
    perf tools: Add gzip_is_compressed function
    perf tools: Add lzma_is_compressed function
    perf tools: Add is_compressed callback to compressions array
    perf tools: Move the temp file processing into decompress_kmodule
    perf tools: Use compression id in decompress_kmodule()
    perf tools: Store compression id into struct dso
    perf tools: Add compression id into 'struct kmod_path'
    perf tools: Make is_supported_compression() static
    perf tools: Make decompress_to_file() function static
    perf tools: Get rid of dso__needs_decompress() call in __open_dso()
    perf tools: Get rid of dso__needs_decompress() call in symbol__disassemble()
    perf tools: Get rid of dso__needs_decompress() call in read_object_code()
    tools lib traceevent: Change to SPDX License format
    perf llvm: Allow passing options to llc in addition to clang
    perf parser: Improve error message for PMU address filters
    ...

    Linus Torvalds
     

23 Aug, 2018

1 commit

  • Patch series "/proc/kcore improvements", v4.

    This series makes a few improvements to /proc/kcore. It fixes a couple of
    small issues in v3 but is otherwise the same. Patches 1, 2, and 3 are
    prep patches. Patch 4 is a fix/cleanup. Patch 5 is another prep patch.
    Patches 6 and 7 are optimizations to ->read(). Patch 8 makes it possible
    to enable CRASH_CORE on any architecture, which is needed for patch 9.
    Patch 9 adds vmcoreinfo to /proc/kcore.

    This patch (of 9):

    kclist_add() is only called at init time, so there's no point in grabbing
    any locks. We're also going to replace the rwlock with a rwsem, which we
    don't want to try grabbing during early boot.

    While we're here, mark kclist_add() with __init so that we'll get a
    warning if it's called from non-init code.

    Link: http://lkml.kernel.org/r/98208db1faf167aa8b08eebfa968d95c70527739.1531953780.git.osandov@fb.com
    Signed-off-by: Omar Sandoval
    Reviewed-by: Andrew Morton
    Reviewed-by: Bhupesh Sharma
    Tested-by: Bhupesh Sharma
    Cc: Alexey Dobriyan
    Cc: Bhupesh Sharma
    Cc: Eric Biederman
    Cc: James Morse
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Omar Sandoval
     

15 Aug, 2018

1 commit

  • Without program headers for PTI entry trampoline pages, the trampoline
    virtual addresses do not map to anything.

    Example before:

    sudo gdb --quiet vmlinux /proc/kcore
    Reading symbols from vmlinux...done.
    [New process 1]
    Core was generated by `BOOT_IMAGE=/boot/vmlinuz-4.16.0 root=UUID=a6096b83-b763-4101-807e-f33daff63233'.
    #0 0x0000000000000000 in irq_stack_union ()
    (gdb) x /21ib 0xfffffe0000006000
    0xfffffe0000006000: Cannot access memory at address 0xfffffe0000006000
    (gdb) quit

    After:

    sudo gdb --quiet vmlinux /proc/kcore
    [sudo] password for ahunter:
    Reading symbols from vmlinux...done.
    [New process 1]
    Core was generated by `BOOT_IMAGE=/boot/vmlinuz-4.16.0-fix-4-00005-gd6e65a8b4072 root=UUID=a6096b83-b7'.
    #0 0x0000000000000000 in irq_stack_union ()
    (gdb) x /21ib 0xfffffe0000006000
    0xfffffe0000006000: swapgs
    0xfffffe0000006003: mov %rsp,-0x3e12(%rip) # 0xfffffe00000021f8
    0xfffffe000000600a: xchg %ax,%ax
    0xfffffe000000600c: mov %cr3,%rsp
    0xfffffe000000600f: bts $0x3f,%rsp
    0xfffffe0000006014: and $0xffffffffffffe7ff,%rsp
    0xfffffe000000601b: mov %rsp,%cr3
    0xfffffe000000601e: mov -0x3019(%rip),%rsp # 0xfffffe000000300c
    0xfffffe0000006025: pushq $0x2b
    0xfffffe0000006027: pushq -0x3e35(%rip) # 0xfffffe00000021f8
    0xfffffe000000602d: push %r11
    0xfffffe000000602f: pushq $0x33
    0xfffffe0000006031: push %rcx
    0xfffffe0000006032: push %rdi
    0xfffffe0000006033: mov $0xffffffff91a00010,%rdi
    0xfffffe000000603a: callq 0xfffffe0000006046
    0xfffffe000000603f: pause
    0xfffffe0000006041: lfence
    0xfffffe0000006044: jmp 0xfffffe000000603f
    0xfffffe0000006046: mov %rdi,(%rsp)
    0xfffffe000000604a: retq
    (gdb) quit

    In addition, entry trampolines all map to the same page. Represent that
    by giving the corresponding program headers in kcore the same offset.

    This has the benefit that, when perf tools uses /proc/kcore as a source
    for kernel object code, samples from different CPU trampolines are
    aggregated together. Note, such aggregation is normal for profiling
    i.e. people want to profile the object code, not every different virtual
    address the object code might be mapped to (across different processes
    for example).

    Notes by PeterZ:

    This also adds the KCORE_REMAP functionality.

    Signed-off-by: Adrian Hunter
    Acked-by: Andi Kleen
    Acked-by: Peter Zijlstra (Intel)
    Cc: Alexander Shishkin
    Cc: Andy Lutomirski
    Cc: Dave Hansen
    Cc: H. Peter Anvin
    Cc: Jiri Olsa
    Cc: Joerg Roedel
    Cc: Thomas Gleixner
    Cc: x86@kernel.org
    Link: http://lkml.kernel.org/r/1528289651-4113-4-git-send-email-adrian.hunter@intel.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Adrian Hunter
     

15 May, 2018

1 commit

  • The sequence of actions done by device drivers to append their device
    specific hardware/firmware logs to /proc/vmcore are as follows:

    1. During probe (before hardware is initialized), device drivers
    register to the vmcore module (via vmcore_add_device_dump()), with
    callback function, along with buffer size and log name needed for
    firmware/hardware log collection.

    2. vmcore module allocates the buffer with requested size. It adds
    an Elf note and invokes the device driver's registered callback
    function.

    3. Device driver collects all hardware/firmware logs into the buffer
    and returns control back to vmcore module.

    Ensure that the device dump buffer size is always aligned to page size
    so that it can be mmaped.

    Also, rename alloc_elfnotes_buf() to vmcore_alloc_buf() to make it more
    generic and reserve NT_VMCOREDD note type to indicate vmcore device
    dump.

    Suggested-by: Eric Biederman .
    Signed-off-by: Rahul Lakkireddy
    Signed-off-by: Ganesh Goudar
    Signed-off-by: David S. Miller

    Rahul Lakkireddy
     

13 Feb, 2018

1 commit

  • Commit:

    df04abfd181a ("fs/proc/kcore.c: Add bounce buffer for ktext data")

    ... introduced a bounce buffer to work around CONFIG_HARDENED_USERCOPY=y.
    However, accessing the vsyscall user page will cause an SMAP fault.

    Replace memcpy() with copy_from_user() to fix this bug works, but adding
    a common way to handle this sort of user page may be useful for future.

    Currently, only vsyscall page requires KCORE_USER.

    Signed-off-by: Jia Zhang
    Reviewed-by: Jiri Olsa
    Cc: Al Viro
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: jolsa@redhat.com
    Link: http://lkml.kernel.org/r/1518446694-21124-2-git-send-email-zhang.jia@linux.alibaba.com
    Signed-off-by: Ingo Molnar

    Jia Zhang
     

02 Nov, 2017

1 commit

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

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

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

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

    How this work was done:

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

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

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

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

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

    Greg Kroah-Hartman
     

30 Apr, 2013

1 commit