08 Apr, 2022

1 commit

  • commit 8126b1c73108bc691f5643df19071a59a69d0bc6 upstream.

    pstore_dump() is *always* invoked in atomic context (nowadays in an RCU
    read-side critical section, before that under a spinlock).
    It doesn't make sense to try to use semaphores here.

    This is mostly a revert of commit ea84b580b955 ("pstore: Convert buf_lock
    to semaphore"), except that two parts aren't restored back exactly as they
    were:

    - keep the lock initialization in pstore_register
    - in efi_pstore_write(), always set the "block" flag to false
    - omit "is_locked", that was unnecessary since
    commit 959217c84c27 ("pstore: Actually give up during locking failure")
    - fix the bailout message

    The actual problem that the buggy commit was trying to address may have
    been that the use of preemptible() in efi_pstore_write() was wrong - it
    only looks at preempt_count() and the state of IRQs, but __rcu_read_lock()
    doesn't touch either of those under CONFIG_PREEMPT_RCU.
    (Sidenote: CONFIG_PREEMPT_RCU means that the scheduler can preempt tasks in
    RCU read-side critical sections, but you're not allowed to actively
    block/reschedule.)

    Lockdep probably never caught the problem because it's very rare that you
    actually hit the contended case, so lockdep always just sees the
    down_trylock(), not the down_interruptible(), and so it can't tell that
    there's a problem.

    Fixes: ea84b580b955 ("pstore: Convert buf_lock to semaphore")
    Cc: stable@vger.kernel.org
    Acked-by: Sebastian Andrzej Siewior
    Signed-off-by: Jann Horn
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20220314185953.2068993-1-jannh@google.com
    Signed-off-by: Greg Kroah-Hartman

    Jann Horn
     

25 Nov, 2021

2 commits

  • commit 61eb495c83bf6ebde490992bf888ca15b9babc39 upstream.

    On 32-bit:

    fs/pstore/blk.c: In function ‘__best_effort_init’:
    include/linux/kern_levels.h:5:18: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 3 has type ‘long unsigned int’ [-Wformat=]
    5 | #define KERN_SOH "\001" /* ASCII Start Of Header */
    | ^~~~~~
    include/linux/kern_levels.h:14:19: note: in expansion of macro ‘KERN_SOH’
    14 | #define KERN_INFO KERN_SOH "6" /* informational */
    | ^~~~~~~~
    include/linux/printk.h:373:9: note: in expansion of macro ‘KERN_INFO’
    373 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
    | ^~~~~~~~~
    fs/pstore/blk.c:314:3: note: in expansion of macro ‘pr_info’
    314 | pr_info("attached %s (%zu) (no dedicated panic_write!)\n",
    | ^~~~~~~

    Cc: stable@vger.kernel.org
    Fixes: 7bb9557b48fcabaa ("pstore/blk: Use the normal block device I/O path")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20210629103700.1935012-1-geert@linux-m68k.org
    Cc: Jens Axboe
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     
  • commit d1faacbf67b1944f0e0c618dc581d929263f6fe9 upstream.

    This reverts commit d07f3b081ee632268786601f55e1334d1f68b997.

    pstore-blk was fixed to avoid the unwanted APIs in commit 7bb9557b48fc
    ("pstore/blk: Use the normal block device I/O path"), which landed in
    the same release as the commit adding BROKEN.

    Cc: Jens Axboe
    Cc: Christoph Hellwig
    Cc: stable@vger.kernel.org
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20211116181559.3975566-1-keescook@chromium.org
    Signed-off-by: Jens Axboe
    Signed-off-by: Greg Kroah-Hartman

    Kees Cook
     

01 Jul, 2021

1 commit

  • Pull block driver updates from Jens Axboe:
    "Pretty calm round, mostly just NVMe and a bit of MD:

    - NVMe updates (via Christoph)
    - improve the APST configuration algorithm (Alexey Bogoslavsky)
    - look for StorageD3Enable on companion ACPI device
    (Mario Limonciello)
    - allow selecting the network interface for TCP connections
    (Martin Belanger)
    - misc cleanups (Amit Engel, Chaitanya Kulkarni, Colin Ian King,
    Christoph)
    - move the ACPI StorageD3 code to drivers/acpi/ and add quirks
    for certain AMD CPUs (Mario Limonciello)
    - zoned device support for nvmet (Chaitanya Kulkarni)
    - fix the rules for changing the serial number in nvmet
    (Noam Gottlieb)
    - various small fixes and cleanups (Dan Carpenter, JK Kim,
    Chaitanya Kulkarni, Hannes Reinecke, Wesley Sheng, Geert
    Uytterhoeven, Daniel Wagner)

    - MD updates (Via Song)
    - iostats rewrite (Guoqing Jiang)
    - raid5 lock contention optimization (Gal Ofri)

    - Fall through warning fix (Gustavo)

    - Misc fixes (Gustavo, Jiapeng)"

    * tag 'for-5.14/drivers-2021-06-29' of git://git.kernel.dk/linux-block: (78 commits)
    nvmet: use NVMET_MAX_NAMESPACES to set nn value
    loop: Fix missing discard support when using LOOP_CONFIGURE
    nvme.h: add missing nvme_lba_range_type endianness annotations
    nvme: remove zeroout memset call for struct
    nvme-pci: remove zeroout memset call for struct
    nvmet: remove zeroout memset call for struct
    nvmet: add ZBD over ZNS backend support
    nvmet: add Command Set Identifier support
    nvmet: add nvmet_req_bio put helper for backends
    nvmet: add req cns error complete helper
    block: export blk_next_bio()
    nvmet: remove local variable
    nvmet: use nvme status value directly
    nvmet: use u32 type for the local variable nsid
    nvmet: use u32 for nvmet_subsys max_nsid
    nvmet: use req->cmd directly in file-ns fast path
    nvmet: use req->cmd directly in bdev-ns fast path
    nvmet: make ver stable once connection established
    nvmet: allow mn change if subsys not discovered
    nvmet: make sn stable once connection was established
    ...

    Linus Torvalds
     

17 Jun, 2021

3 commits

  • Information was redundant between struct pstore_zone_info and struct
    pstore_device_info. Use struct pstore_zone_info, with member name "zone".

    Additionally untangle the logic for the "best effort" block device
    instance.

    Signed-off-by: Kees Cook
    Fixed-by: Pu Lehui
    Link: https://lore.kernel.org/lkml/20210617005424.182305-1-pulehui@huawei.com

    Kees Cook
     
  • Remove redundant details of blkdev and fix up resulting kerndoc.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Kees Cook

    Kees Cook
     
  • Stop poking into block layer internals and just open the block device
    file an use kernel_read and kernel_write on it. Note that this means
    the transformation from name_to_dev_t can't be used anymore when
    pstore_blk is loaded as a module: a full filesystem device path name
    must be used instead. Additionally removes ":internal:" kerndoc link,
    since no such documentation remains.

    Co-developed-by: Christoph Hellwig
    Signed-off-by: Christoph Hellwig
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Kees Cook

    Kees Cook
     

16 Jun, 2021

2 commits


14 Jun, 2021

1 commit

  • pstore-blk just pokes directly into the pagecache for the block
    device without going through the file operations for that by faking
    up it's own file operations that do not match the block device ones.

    As this breaks the control of the block layer of it's page cache,
    and even now just works by accident only the best thing is to just
    disable this driver.

    Fixes: 17639f67c1d6 ("pstore/blk: Introduce backend for block devices")
    Signed-off-by: Christoph Hellwig
    Link: https://lore.kernel.org/r/20210608161327.1537919-1-hch@lst.de
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

28 Apr, 2021

1 commit

  • Pull printk updates from Petr Mladek:

    - Stop synchronizing kernel log buffer readers by logbuf_lock. As a
    result, the access to the buffer is fully lockless now.

    Note that printk() itself still uses locks because it tries to flush
    the messages to the console immediately. Also the per-CPU temporary
    buffers are still there because they prevent infinite recursion and
    serialize backtraces from NMI. All this is going to change in the
    future.

    - kmsg_dump API rework and cleanup as a side effect of the logbuf_lock
    removal.

    - Make bstr_printf() aware that %pf and %pF formats could deference the
    given pointer.

    - Show also page flags by %pGp format.

    - Clarify the documentation for plain pointer printing.

    - Do not show no_hash_pointers warning multiple times.

    - Update Senozhatsky email address.

    - Some clean up.

    * tag 'printk-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: (24 commits)
    lib/vsprintf.c: remove leftover 'f' and 'F' cases from bstr_printf()
    printk: clarify the documentation for plain pointer printing
    kernel/printk.c: Fixed mundane typos
    printk: rename vprintk_func to vprintk
    vsprintf: dump full information of page flags in pGp
    mm, slub: don't combine pr_err with INFO
    mm, slub: use pGp to print page flags
    MAINTAINERS: update Senozhatsky email address
    lib/vsprintf: do not show no_hash_pointers message multiple times
    printk: console: remove unnecessary safe buffer usage
    printk: kmsg_dump: remove _nolock() variants
    printk: remove logbuf_lock
    printk: introduce a kmsg_dump iterator
    printk: kmsg_dumper: remove @active field
    printk: add syslog_lock
    printk: use atomic64_t for devkmsg_user.seq
    printk: use seqcount_latch for clear_seq
    printk: introduce CONSOLE_LOG_MAX
    printk: consolidate kmsg_dump_get_buffer/syslog_print_all code
    printk: refactor kmsg_dump_get_buffer()
    ...

    Linus Torvalds
     

01 Apr, 2021

1 commit

  • There could be a scenario where we define some region
    in normal memory and use them store to logs which is later
    retrieved by bootloader during warm reset.

    In this scenario, we wanted to treat this memory as normal
    cacheable memory instead of default behaviour which
    is an overhead. Making it cacheable could improve
    performance.

    This commit gives control to change mem_type from Device
    tree, and also documents the value for normal memory.

    Signed-off-by: Mukesh Ojha
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/1616438537-13719-1-git-send-email-mojha@codeaurora.org

    Mukesh Ojha
     

08 Mar, 2021

1 commit

  • Rather than storing the iterator information in the registered
    kmsg_dumper structure, create a separate iterator structure. The
    kmsg_dump_iter structure can reside on the stack of the caller, thus
    allowing lockless use of the kmsg_dump functions.

    Update code that accesses the kernel logs using the kmsg_dumper
    structure to use the new kmsg_dump_iter structure. For kmsg_dumpers,
    this also means adding a call to kmsg_dump_rewind() to initialize
    the iterator.

    All this is in preparation for removal of @logbuf_lock.

    Signed-off-by: John Ogness
    Reviewed-by: Kees Cook # pstore
    Reviewed-by: Petr Mladek
    Signed-off-by: Petr Mladek
    Link: https://lore.kernel.org/r/20210303101528.29901-13-john.ogness@linutronix.de

    John Ogness
     

06 Mar, 2021

1 commit


03 Mar, 2021

1 commit

  • There is a quite huge "uncorrectable error in header" flood in KMSG
    on a clean system boot since there is no pstore buffer saved in RAM.
    Let's silence the redundant noisy messages by rate-limiting the printk
    message. Now there are maximum 10 messages printed repeatedly instead
    of 35+.

    Signed-off-by: Dmitry Osipenko
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20210302095850.30894-1-digetx@gmail.com

    Dmitry Osipenko
     

24 Feb, 2021

1 commit

  • syzbot is hitting WARN_ON(pstore_sb != sb) at pstore_kill_sb() [1], for the
    assumption that pstore_sb != NULL is wrong because pstore_fill_super() will
    not assign pstore_sb = sb when new_inode() for d_make_root() returned NULL
    (due to memory allocation fault injection).

    Since mount_single() calls pstore_kill_sb() when pstore_fill_super()
    failed, pstore_kill_sb() needs to be aware of such failure path.

    [1] https://syzkaller.appspot.com/bug?id=6abacb8da5137cb47a416f2bef95719ed60508a0

    Reported-by: syzbot
    Signed-off-by: Tetsuo Handa
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20210214031307.57903-1-penguin-kernel@I-love.SAKURA.ne.jp

    Tetsuo Handa
     

23 Feb, 2021

1 commit

  • Pull documentation updates from Jonathan Corbet:
    "It has been a relatively quiet cycle in docsland.

    - As promised, the minimum Sphinx version to build the docs is now
    1.7, and we have dropped support for Python 2 entirely. That
    allowed the removal of a bunch of compatibility code.

    - A set of treewide warning fixups from Mauro that I applied after it
    became clear nobody else was going to deal with them.

    - The automarkup mechanism can now create cross-references from
    relative paths to RST files.

    - More translations, typo fixes, and warning fixes"

    * tag 'docs-5.12' of git://git.lwn.net/linux: (75 commits)
    docs: kernel-hacking: be more civil
    docs: Remove the Microsoft rhetoric
    Documentation/admin-guide: kernel-parameters: Update nohlt section
    doc/admin-guide: fix spelling mistake: "perfomance" -> "performance"
    docs: Document cross-referencing using relative path
    docs: Enable usage of relative paths to docs on automarkup
    docs: thermal: fix spelling mistakes
    Documentation: admin-guide: Update kvm/xen config option
    docs: Make syscalls' helpers naming consistent
    coding-style.rst: Avoid comma statements
    Documentation: /proc/loadavg: add 3 more field descriptions
    Documentation/submitting-patches: Add blurb about backtraces in commit messages
    Docs: drop Python 2 support
    Move our minimum Sphinx version to 1.7
    Documentation: input: define ABS_PRESSURE/ABS_MT_PRESSURE resolution as grams
    scripts/kernel-doc: add internal hyperlink to DOC: sections
    Update Documentation/admin-guide/sysctl/fs.rst
    docs: Update DTB format references
    docs: zh_CN: add iio index.rst translation
    docs/zh_CN: add iio ep93xx_adc.rst translation
    ...

    Linus Torvalds
     

19 Feb, 2021

1 commit

  • Both pstore_compress() and decompress_record() use a mistyped config
    option name ("PSTORE_COMPRESSION" instead of "PSTORE_COMPRESS"). As
    a result compression and decompression of pstore records was always
    disabled.

    Use the correct config option name.

    Signed-off-by: Jiri Bohac
    Fixes: fd49e03280e5 ("pstore: Fix linking when crypto API disabled")
    Acked-by: Matteo Croce
    Signed-off-by: Kees Cook
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20210218111547.johvp5klpv3xrpnn@dwarf.suse.cz

    Jiri Bohac
     

22 Jan, 2021

1 commit


18 Dec, 2020

1 commit

  • Pull tracing updates from Steven Rostedt:
    "The major update to this release is that there's a new arch config
    option called CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS.

    Currently, only x86_64 enables it. All the ftrace callbacks now take a
    struct ftrace_regs instead of a struct pt_regs. If the architecture
    has HAVE_DYNAMIC_FTRACE_WITH_ARGS enabled, then the ftrace_regs will
    have enough information to read the arguments of the function being
    traced, as well as access to the stack pointer.

    This way, if a user (like live kernel patching) only cares about the
    arguments, then it can avoid using the heavier weight "regs" callback,
    that puts in enough information in the struct ftrace_regs to simulate
    a breakpoint exception (needed for kprobes).

    A new config option that audits the timestamps of the ftrace ring
    buffer at most every event recorded.

    Ftrace recursion protection has been cleaned up to move the protection
    to the callback itself (this saves on an extra function call for those
    callbacks).

    Perf now handles its own RCU protection and does not depend on ftrace
    to do it for it (saving on that extra function call).

    New debug option to add "recursed_functions" file to tracefs that
    lists all the places that triggered the recursion protection of the
    function tracer. This will show where things need to be fixed as
    recursion slows down the function tracer.

    The eval enum mapping updates done at boot up are now offloaded to a
    work queue, as it caused a noticeable pause on slow embedded boards.

    Various clean ups and last minute fixes"

    * tag 'trace-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (33 commits)
    tracing: Offload eval map updates to a work queue
    Revert: "ring-buffer: Remove HAVE_64BIT_ALIGNED_ACCESS"
    ring-buffer: Add rb_check_bpage in __rb_allocate_pages
    ring-buffer: Fix two typos in comments
    tracing: Drop unneeded assignment in ring_buffer_resize()
    tracing: Disable ftrace selftests when any tracer is running
    seq_buf: Avoid type mismatch for seq_buf_init
    ring-buffer: Fix a typo in function description
    ring-buffer: Remove obsolete rb_event_is_commit()
    ring-buffer: Add test to validate the time stamp deltas
    ftrace/documentation: Fix RST C code blocks
    tracing: Clean up after filter logic rewriting
    tracing: Remove the useless value assignment in test_create_synth_event()
    livepatch: Use the default ftrace_ops instead of REGS when ARGS is available
    ftrace/x86: Allow for arguments to be passed in to ftrace_regs by default
    ftrace: Have the callbacks receive a struct ftrace_regs instead of pt_regs
    MAINTAINERS: assign ./fs/tracefs to TRACING
    tracing: Fix some typos in comments
    ftrace: Remove unused varible 'ret'
    ring-buffer: Add recording of ring buffer recursion into recursed_functions
    ...

    Linus Torvalds
     

17 Dec, 2020

1 commit

  • Pull block updates from Jens Axboe:
    "Another series of killing more code than what is being added, again
    thanks to Christoph's relentless cleanups and tech debt tackling.

    This contains:

    - blk-iocost improvements (Baolin Wang)

    - part0 iostat fix (Jeffle Xu)

    - Disable iopoll for split bios (Jeffle Xu)

    - block tracepoint cleanups (Christoph Hellwig)

    - Merging of struct block_device and hd_struct (Christoph Hellwig)

    - Rework/cleanup of how block device sizes are updated (Christoph
    Hellwig)

    - Simplification of gendisk lookup and removal of block device
    aliasing (Christoph Hellwig)

    - Block device ioctl cleanups (Christoph Hellwig)

    - Removal of bdget()/blkdev_get() as exported API (Christoph Hellwig)

    - Disk change rework, avoid ->revalidate_disk() (Christoph Hellwig)

    - sbitmap improvements (Pavel Begunkov)

    - Hybrid polling fix (Pavel Begunkov)

    - bvec iteration improvements (Pavel Begunkov)

    - Zone revalidation fixes (Damien Le Moal)

    - blk-throttle limit fix (Yu Kuai)

    - Various little fixes"

    * tag 'for-5.11/block-2020-12-14' of git://git.kernel.dk/linux-block: (126 commits)
    blk-mq: fix msec comment from micro to milli seconds
    blk-mq: update arg in comment of blk_mq_map_queue
    blk-mq: add helper allocating tagset->tags
    Revert "block: Fix a lockdep complaint triggered by request queue flushing"
    nvme-loop: use blk_mq_hctx_set_fq_lock_class to set loop's lock class
    blk-mq: add new API of blk_mq_hctx_set_fq_lock_class
    block: disable iopoll for split bio
    block: Improve blk_revalidate_disk_zones() checks
    sbitmap: simplify wrap check
    sbitmap: replace CAS with atomic and
    sbitmap: remove swap_lock
    sbitmap: optimise sbitmap_deferred_clear()
    blk-mq: skip hybrid polling if iopoll doesn't spin
    blk-iocost: Factor out the base vrate change into a separate function
    blk-iocost: Factor out the active iocgs' state check into a separate function
    blk-iocost: Move the usage ratio calculation to the correct place
    blk-iocost: Remove unnecessary advance declaration
    blk-iocost: Fix some typos in comments
    blktrace: fix up a kerneldoc comment
    block: remove the request_queue to argument request based tracepoints
    ...

    Linus Torvalds
     

02 Dec, 2020

4 commits

  • Now that the hd_struct always has a block device attached to it, there is
    no need for having two size field that just get out of sync.

    Additionally the field in hd_struct did not use proper serialization,
    possibly allowing for torn writes. By only using the block_device field
    this problem also gets fixed.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Greg Kroah-Hartman
    Reviewed-by: Jan Kara
    Reviewed-by: Hannes Reinecke
    Acked-by: Coly Li [bcache]
    Acked-by: Chao Yu [f2fs]
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • While kmsg_bytes can be set for pstore via mount, if a crash occurs
    before the mount only partial console log will be stored as kmsg_bytes
    defaults to a potentially different hardcoded value in the kernel
    (PSTORE_DEFAULT_KMSG_BYTES). This makes it impossible to analyze valuable
    post-mortem data especially on the embedded development or in the process
    of bringing up new boards. Change this value to be a Kconfig option
    with the default of old PSTORE_DEFAULT_KMSG_BYTES

    Signed-off-by: Vasile-Laurentiu Stanimir
    Signed-off-by: Kees Cook

    Vasile-Laurentiu Stanimir
     
  • This interface is entirely unused, so remove them and various bits of
    unreachable code.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20201016132047.3068029-4-hch@lst.de

    Christoph Hellwig
     
  • Introduce an abritrary 128MiB cap to avoid malloc failures when using
    a larger block device.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: WeiXiong Liao
    Reviewed-by: Kees Cook
    Signed-off-by: Kees Cook
    Link: https://lore.kernel.org/r/20201016132047.3068029-2-hch@lst.de

    Christoph Hellwig
     

14 Nov, 2020

1 commit

  • In preparation to have arguments of a function passed to callbacks attached
    to functions as default, change the default callback prototype to receive a
    struct ftrace_regs as the forth parameter instead of a pt_regs.

    For callbacks that set the FL_SAVE_REGS flag in their ftrace_ops flags, they
    will now need to get the pt_regs via a ftrace_get_regs() helper call. If
    this is called by a callback that their ftrace_ops did not have a
    FL_SAVE_REGS flag set, it that helper function will return NULL.

    This will allow the ftrace_regs to hold enough just to get the parameters
    and stack pointer, but without the worry that callbacks may have a pt_regs
    that is not completely filled.

    Acked-by: Peter Zijlstra (Intel)
    Reviewed-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     

06 Nov, 2020

2 commits

  • This adds CONFIG_FTRACE_RECORD_RECURSION that will record to a file
    "recursed_functions" all the functions that caused recursion while a
    callback to the function tracer was running.

    Link: https://lkml.kernel.org/r/20201106023548.102375687@goodmis.org

    Cc: Masami Hiramatsu
    Cc: Andrew Morton
    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Cc: Jonathan Corbet
    Cc: Guo Ren
    Cc: "James E.J. Bottomley"
    Cc: Helge Deller
    Cc: Michael Ellerman
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: Heiko Carstens
    Cc: Vasily Gorbik
    Cc: Christian Borntraeger
    Cc: Thomas Gleixner
    Cc: Borislav Petkov
    Cc: x86@kernel.org
    Cc: "H. Peter Anvin"
    Cc: Kees Cook
    Cc: Anton Vorontsov
    Cc: Colin Cross
    Cc: Tony Luck
    Cc: Josh Poimboeuf
    Cc: Jiri Kosina
    Cc: Miroslav Benes
    Cc: Petr Mladek
    Cc: Joe Lawrence
    Cc: Kamalesh Babulal
    Cc: Mauro Carvalho Chehab
    Cc: Sebastian Andrzej Siewior
    Cc: linux-doc@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Cc: linux-csky@vger.kernel.org
    Cc: linux-parisc@vger.kernel.org
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: linux-s390@vger.kernel.org
    Cc: live-patching@vger.kernel.org
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     
  • If a ftrace callback does not supply its own recursion protection and
    does not set the RECURSION_SAFE flag in its ftrace_ops, then ftrace will
    make a helper trampoline to do so before calling the callback instead of
    just calling the callback directly.

    The default for ftrace_ops is going to change. It will expect that handlers
    provide their own recursion protection, unless its ftrace_ops states
    otherwise.

    Link: https://lkml.kernel.org/r/20201028115612.990886844@goodmis.org
    Link: https://lkml.kernel.org/r/20201106023546.720372267@goodmis.org

    Cc: Peter Zijlstra
    Cc: Ingo Molnar
    Cc: Josh Poimboeuf
    Cc: Jiri Kosina
    Cc: Miroslav Benes
    Cc: Petr Mladek
    Cc: Masami Hiramatsu
    Cc: Andrew Morton
    Cc: Thomas Meyer
    Reviewed-by: Kees Cook
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     

24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

07 Jul, 2020

1 commit

  • When building a kernel with CONFIG_PSTORE=y and CONFIG_CRYPTO not set,
    a build error happens:

    ld: fs/pstore/platform.o: in function `pstore_dump':
    platform.c:(.text+0x3f9): undefined reference to `crypto_comp_compress'
    ld: fs/pstore/platform.o: in function `pstore_get_backend_records':
    platform.c:(.text+0x784): undefined reference to `crypto_comp_decompress'

    This because some pstore code uses crypto_comp_(de)compress regardless
    of the CONFIG_CRYPTO status. Fix it by wrapping the (de)compress usage
    by IS_ENABLED(CONFIG_PSTORE_COMPRESS)

    Signed-off-by: Matteo Croce
    Link: https://lore.kernel.org/lkml/20200706234045.9516-1-mcroce@linux.microsoft.com
    Fixes: cb3bee0369bc ("pstore: Use crypto compress API")
    Cc: stable@vger.kernel.org
    Signed-off-by: Kees Cook

    Matteo Croce
     

02 Jun, 2020

1 commit


01 Jun, 2020

4 commits

  • In order to use arbitrary block devices as a pstore backend, provide a
    new module param named "best_effort", which will allow using any block
    device, even if it has not provided a panic_write callback.

    Link: https://lore.kernel.org/lkml/20200511233229.27745-12-keescook@chromium.org/
    Signed-off-by: Kees Cook

    Kees Cook
     
  • Add support for non-block devices (e.g. MTD). A non-block driver calls
    pstore_blk_register_device() to register iself.

    In addition, pstore/zone is updated to handle non-block devices,
    where an erase must be done before a write. Without this, there is no
    way to remove records stored to an MTD.

    Signed-off-by: WeiXiong Liao
    Link: https://lore.kernel.org/lkml/20200511233229.27745-10-keescook@chromium.org/
    Co-developed-by: Kees Cook
    Signed-off-by: Kees Cook

    WeiXiong Liao
     
  • In order to configure itself, the MTD backend needs to be able to query
    the current pstore configuration. Introduce pstore_blk_get_config() for
    this purpose.

    Signed-off-by: WeiXiong Liao
    Link: https://lore.kernel.org/lkml/20200511233229.27745-9-keescook@chromium.org/
    Co-developed-by: Kees Cook
    Signed-off-by: Kees Cook

    WeiXiong Liao
     
  • One requirement to support MTD devices in pstore/zone is having a
    way to declare certain regions as broken. Add this support to
    pstore/zone.

    The MTD driver should return -ENOMSG when encountering a bad region,
    which tells pstore/zone to skip and try the next one.

    Signed-off-by: WeiXiong Liao
    Link: https://lore.kernel.org/lkml/20200511233229.27745-8-keescook@chromium.org/
    Co-developed-by: Colin Ian King
    Signed-off-by: Colin Ian King
    Link: //lore.kernel.org/lkml/20200512173801.222666-1-colin.king@canonical.com
    Signed-off-by: Kees Cook

    WeiXiong Liao
     

31 May, 2020

5 commits

  • Add details on using pstore/blk, the new backend of pstore to record
    dumps to block devices, in Documentation/admin-guide/pstore-blk.rst

    Signed-off-by: WeiXiong Liao
    Link: https://lore.kernel.org/lkml/20200511233229.27745-7-keescook@chromium.org/
    Signed-off-by: Kees Cook

    WeiXiong Liao
     
  • Support backend for ftrace. To enable ftrace backend, just make
    ftrace_size be greater than 0 and a multiple of 4096.

    Signed-off-by: WeiXiong Liao
    Link: https://lore.kernel.org/lkml/20200511233229.27745-6-keescook@chromium.org/
    Co-developed-by: Colin Ian King
    Signed-off-by: Colin Ian King
    Link: https://lore.kernel.org/lkml/20200512170719.221514-1-colin.king@canonical.com
    Signed-off-by: Kees Cook

    WeiXiong Liao
     
  • Support backend for console. To enable console backend, just make
    console_size be greater than 0 and a multiple of 4096.

    Signed-off-by: WeiXiong Liao
    Link: https://lore.kernel.org/lkml/20200511233229.27745-5-keescook@chromium.org/
    Signed-off-by: Kees Cook

    WeiXiong Liao
     
  • Add pmsg support to pstore/blk (through pstore/zone). To enable, pmsg_size
    must be greater than 0 and a multiple of 4096.

    Signed-off-by: WeiXiong Liao
    Link: https://lore.kernel.org/lkml/20200511233229.27745-4-keescook@chromium.org/
    Co-developed-by: Colin Ian King
    Signed-off-by: Colin Ian King
    Link: https://lore.kernel.org/lkml/20200512171932.222102-1-colin.king@canonical.com
    Co-developed-by: Kees Cook
    Signed-off-by: Kees Cook

    WeiXiong Liao
     
  • pstore/blk is similar to pstore/ram, but uses a block device as the
    storage rather than persistent ram.

    The pstore/blk backend solves two common use-cases that used to preclude
    using pstore/ram:
    - not all devices have a battery that could be used to persist
    regular RAM across power failures.
    - most embedded intelligent equipment have no persistent ram, which
    increases costs, instead preferring cheaper solutions, like block
    devices.

    pstore/blk provides separate configurations for the end user and for the
    block drivers. User configuration determines how pstore/blk operates, such
    as record sizes, max kmsg dump reasons, etc. These can be set by Kconfig
    and/or module parameters, but module parameter have priority over Kconfig.
    Driver configuration covers all the details about the target block device,
    such as total size of the device and how to perform read/write operations.
    These are provided by block drivers, calling pstore_register_blkdev(),
    including an optional panic_write callback used to bypass regular IO
    APIs in an effort to avoid potentially destabilized kernel code during
    a panic.

    Signed-off-by: WeiXiong Liao
    Link: https://lore.kernel.org/lkml/20200511233229.27745-3-keescook@chromium.org/
    Co-developed-by: Kees Cook
    Signed-off-by: Kees Cook

    WeiXiong Liao