Commit Graph

300 Commits

Author SHA1 Message Date
Ming Lei 90333bbc05 wrapper for access to ->bd_partno
JIRA: https://issues.redhat.com/browse/RHEL-79409

commit b8c873edbf35570b93edfeddad9e85da54defa52
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Fri Apr 12 01:01:36 2024 -0400

    wrapper for access to ->bd_partno

    On the next step it's going to get folded into a field where flags will go.

    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Signed-off-by: Ming Lei <ming.lei@redhat.com>
2025-03-14 16:48:08 +08:00
Ming Lei 17006103a6 Use bdev_is_paritition() instead of open-coding it
JIRA: https://issues.redhat.com/browse/RHEL-79409

commit 3f9b8fb46e5d20eac314f56747e24e1a4e74539d
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Fri Apr 12 00:54:19 2024 -0400

    Use bdev_is_paritition() instead of open-coding it

    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Signed-off-by: Ming Lei <ming.lei@redhat.com>
2025-03-14 16:48:07 +08:00
Desnes Nunes b390b8856a minmax: don't use max() in situations that want a C constant expression
JIRA: https://issues.redhat.com/browse/RHEL-59051
Conflicts:
* Avoiding commit <107e6f6fe6f3> ("can: etas_es58x: rework the version
  check logic to silence")

commit cb04e8b1d2f24c4c2c92f7b7529031fc35a16fed
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Sun, 28 Jul 2024 17:32:05 -0700

  We only had a couple of array[] declarations, and changing them to just
  use 'MAX()' instead of 'max()' fixes the issue.

  This will allow us to simplify our min/max macros enormously, since they
  can now unconditionally use temporary variables to avoid using the
  argument values multiple times.

  Cc: David Laight <David.Laight@aculab.com>
  Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
  Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Desnes Nunes <desnesn@redhat.com>
2024-11-18 10:30:14 -03:00
David Arcari 3701ae3d07 lib/vsprintf: split out sprintf() and friends
JIRA: https://issues.redhat.com/browse/RHEL-20053

commit 39ced19b9e60f6f5b80db6b72965a8cf1982439d
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Mon Aug 14 19:33:43 2023 +0300

    lib/vsprintf: split out sprintf() and friends

    Patch series "lib/vsprintf: Rework header inclusions", v3.

    Some patches that reduce the mess with the header inclusions related to
    vsprintf.c module.  Each patch has its own description, and has no
    dependencies to each other, except the collisions over modifications of
    the same places.  Hence the series.

    This patch (of 2):

    kernel.h is being used as a dump for all kinds of stuff for a long time.
    sprintf() and friends are used in many drivers without need of the full
    kernel.h dependency train with it.

    Here is the attempt on cleaning it up by splitting out sprintf() and
    friends.

    Link: https://lkml.kernel.org/r/20230814163344.17429-1-andriy.shevchenko@linux.intel.com
    Link: https://lkml.kernel.org/r/20230814163344.17429-2-andriy.shevchenko@linux.intel.com
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-by: Petr Mladek <pmladek@suse.com>
    Cc: Alexander Potapenko <glider@google.com>
    Cc: Dmitry Vyukov <dvyukov@google.com>
    Cc: Marco Elver <elver@google.com>
    Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-05-22 12:24:58 -04:00
Lucas Zampieri b9f5553f44 Merge: printk: Update the printk series to 6.6-rt-stable
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/3895

Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git/

JIRA: https://issues.redhat.com/browse/RHEL-3987

JIRA: https://issues.redhat.com/browse/RHEL-24205

This series updates the CentOS Stream 9 Kernels TTY Layer to 6.7, and updates printk to 6.6-stable-rt.

After a series of introduced regressions with the _older_ printk NOBKL atomic console implementation (circa LPC-dublin) [0][1][2], the KRTS team has been targeting the the newer NBCON atomic console printk rewrite, which aims to resolve the problems introduced from other implementations. Mainly, NBCON addresses the issue of deadlocks introduced from unsafe contexts, panics, nested NMIs, and other oddities caused by console lock contention.

However, as the newer upstream nbcon implementation is dependent on newer additions to the TTY subsystem, such as updates to UART port lock wrappers, 8250 changes, and additions to serial_core, the printk update requires a substantial update to the TTY layer.

This MR will also facilitate TTY, nbcon and printk updates for the foreseeable future, as newer changes will be based on the current UART Port lock wrappers present in 6.6+ kernels.

This MR effectively undoes the TTY/printk PREEMPT_RT bits responsible for the older printk implementation, pulls up the TTY layer to 6.7, and applies the 6.6-stable-rt (as 6.7.y-rt is now considered 'stale') printk changes (with some minor hunks brought in for panic.c, RCU, and lockdep).



[0] https://issues.redhat.com/browse/RHEL-9380

[1] https://issues.redhat.com/browse/RHEL-15897

[2] https://issues.redhat.com/browse/RHEL-17709


Signed-off-by: Andrew Halaney <ahalaney@redhat.com>

Signed-off-by: Derek Barbosa <debarbos@redhat.com>

Approved-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Approved-by: Herton R. Krzesinski <herton@redhat.com>
Approved-by: Tony Camuso <tcamuso@redhat.com>
Approved-by: Jocelyn Falempe <jfalempe@redhat.com>
Approved-by: Eric Chanudet <echanude@redhat.com>
Approved-by: Juri Lelli <juri.lelli@redhat.com>

Merged-by: Lucas Zampieri <lzampier@redhat.com>
2024-05-14 14:09:16 +00:00
Andrew Halaney a2f8bdb69a vsprintf: rework bitmap_list_string
JIRA: https://issues.redhat.com/browse/RHEL-24205

commit 15325b4f768f2b27b5765489eeab6ec0d6b5e902
Author: Yury Norov <yury.norov@gmail.com>
Date:   Sat Aug 14 14:17:13 2021 -0700

    vsprintf: rework bitmap_list_string

    bitmap_list_string() is very ineffective when printing bitmaps with long
    ranges of set bits because it calls find_next_bit for each bit in the
    bitmap.  We can do better by detecting ranges of set bits.

    In my environment, before/after is 943008/31008 ns.

    Signed-off-by: Yury Norov <yury.norov@gmail.com>
    Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
2024-05-09 11:24:27 -04:00
Chris von Recklinghausen ea5a8c928e mm, printk: introduce new format %pGt for page_type
JIRA: https://issues.redhat.com/browse/RHEL-27741

commit 4c85c0be3d7a9a7ffe48bfe0954eacc0ba9d3c75
Author: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Date:   Mon Jan 30 13:25:13 2023 +0900

    mm, printk: introduce new format %pGt for page_type

    %pGp format is used to display 'flags' field of a struct page.  However,
    some page flags (i.e.  PG_buddy, see page-flags.h for more details) are
    stored in page_type field.  To display human-readable output of page_type,
    introduce %pGt format.

    It is important to note the meaning of bits are different in page_type.
    if page_type is 0xffffffff, no flags are set.  Setting PG_buddy
    (0x00000080) flag results in a page_type of 0xffffff7f.  Clearing a bit
    actually means setting a flag.  Bits in page_type are inverted when
    displaying type names.

    Only values for which page_type_has_type() returns true are considered as
    page_type, to avoid confusion with mapcount values.  if it returns false,
    only raw values are displayed and not page type names.

    Link: https://lkml.kernel.org/r/20230130042514.2418-3-42.hyeyoo@gmail.com
    Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
    Reviewed-by: Petr Mladek <pmladek@suse.com>     [vsprintf part]
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Joe Perches <joe@perches.com>
    Cc: John Ogness <john.ogness@linutronix.de>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com>
2024-04-30 07:00:05 -04:00
John B. Wyatt IV 8248ded4f8 lib/vsprintf: Initialize vsprintf's pointer hash once the random core is ready.
JIRA: https://issues.redhat.com/browse/RHEL-2246

Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git

commit db409d41c227c83729fa039644ce0412384c438a
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date:   Tue Sep 27 12:49:12 2022 +0200

	lib/vsprintf: Initialize vsprintf's pointer hash once the random core is ready.

	The printk code invokes vnsprintf in order to compute the complete
	string before adding it into its buffer. This happens in an IRQ-off
	region which leads to a warning on PREEMPT_RT in the random code if the
	format strings contains a %p for pointer printing. This happens because
	the random core acquires locks which become sleeping locks on PREEMPT_RT
	which must not be acquired with disabled interrupts and or preemption
	disabled.
	By default the pointers are hashed which requires a random value on the
	first invocation (either by printk or another user which comes first.

	One could argue that there is no need for printk to disable interrupts
	during the vsprintf() invocation which would fix the just mentioned
	problem. However printk itself can be invoked in a context with
	disabled interrupts which would lead to the very same problem.

	Move the initialization of ptr_key into a worker and schedule it from
	subsys_initcall(). This happens early but after the workqueue subsystem
	is ready. Use get_random_bytes() to retrieve the random value if the RNG
	core is ready, otherwise schedule a worker in two seconds and try again.

	Another advantage is that it removes a lock from the vsprintf() code path.
	It prevents a possible deadlock when printk("%p", ptr) is called under
	the lock taken in get_random_bytes().

	Reported-by: Mike Galbraith <efault@gmx.de>
	Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
	Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>
	Reviewed-by: Petr Mladek <pmladek@suse.com>
	[pmladek@suse.com: Added a note about the it prevented a possible deadlock in printk().]
	Signed-off-by: Petr Mladek <pmladek@suse.com>
	Link: https://lore.kernel.org/r/20220927104912.622645-3-bigeasy@linutronix.de

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
2024-01-10 23:13:08 -05:00
John B. Wyatt IV 6f3e52ecae lib/vsprintf: Remove static_branch_likely() from __ptr_to_hashval().
JIRA: https://issues.redhat.com/browse/RHEL-2246

Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git

commit 90828cd1a2c5fcbf218bedab1691af6bbcda3ea9
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date:   Tue Sep 27 12:49:11 2022 +0200

	lib/vsprintf: Remove static_branch_likely() from __ptr_to_hashval().

	Using static_branch_likely() to signal that ptr_key has been filled is a
	bit much given that it is not a fast path.

	Replace static_branch_likely() with bool for condition and a memory
	barrier for ptr_key.

	Suggested-by: Petr Mladek <pmladek@suse.com>
	Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
	Reviewed-by: Petr Mladek <pmladek@suse.com>
	Signed-off-by: Petr Mladek <pmladek@suse.com>
	Link: https://lore.kernel.org/r/20220927104912.622645-2-bigeasy@linutronix.de

Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
2024-01-10 23:13:08 -05:00
Ivan Vecera 5bd2cb2496 random: remove rng_has_arch_random()
JIRA: https://issues.redhat.com/browse/RHEL-3646

commit e052a478a7daeca67664f7addd308ff51dd40654
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Wed Jun 8 10:31:25 2022 +0200

    random: remove rng_has_arch_random()

    With arch randomness being used by every distro and enabled in
    defconfigs, the distinction between rng_has_arch_random() and
    rng_is_initialized() is now rather small. In fact, the places where they
    differ are now places where paranoid users and system builders really
    don't want arch randomness to be used, in which case we should respect
    that choice, or places where arch randomness is known to be broken, in
    which case that choice is all the more important. So this commit just
    removes the function and its one user.

    Reviewed-by: Petr Mladek <pmladek@suse.com> # for vsprintf.c
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2023-09-13 18:44:18 +02:00
Ivan Vecera 22c511049e random: remove mostly unused async readiness notifier
JIRA: https://issues.redhat.com/browse/RHEL-3646

commit 6701de6c51c172b5de5633374479503c81fefc0b
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Sun May 15 15:06:18 2022 +0200

    random: remove mostly unused async readiness notifier

    The register_random_ready_notifier() notifier is somewhat complicated,
    and was already recently rewritten to use notifier blocks. It is only
    used now by one consumer in the kernel, vsprintf.c, for which the async
    mechanism is really overly complex for what it actually needs. This
    commit removes register_random_ready_notifier() and unregister_random_
    ready_notifier(), because it just adds complication with little utility,
    and changes vsprintf.c to just check on `!rng_is_initialized() &&
    !rng_has_arch_random()`, which will eventually be true. Performance-
    wise, that code was already using a static branch, so there's basically
    no overhead at all to this change.

    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Acked-by: Petr Mladek <pmladek@suse.com> # for vsprintf.c
    Reviewed-by: Petr Mladek <pmladek@suse.com>
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2023-09-13 18:42:36 +02:00
Ivan Vecera 065ebf6d40 random: remove get_random_bytes_arch() and add rng_has_arch_random()
JIRA: https://issues.redhat.com/browse/RHEL-3646

commit 248561ad25a8ba4ecbc7df42f9a5a82fd5fbb4f6
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Sat May 14 13:09:17 2022 +0200

    random: remove get_random_bytes_arch() and add rng_has_arch_random()

    The RNG incorporates RDRAND into its state at boot and every time it
    reseeds, so there's no reason for callers to use it directly. The
    hashing that the RNG does on it is preferable to using the bytes raw.

    The only current use case of get_random_bytes_arch() is vsprintf's
    siphash key for pointer hashing, which uses it to initialize the pointer
    secret earlier than usual if RDRAND is available. In order to replace
    this narrow use case, just expose whether RDRAND is mixed into the RNG,
    with a new function called rng_has_arch_random(). With that taken care
    of, there are no users of get_random_bytes_arch() left, so it can be
    removed.

    Later, if trust_cpu gets turned on by default (as most distros are
    doing), this one use of rng_has_arch_random() can probably go away as
    well.

    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Acked-by: Petr Mladek <pmladek@suse.com> # for vsprintf.c
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
2023-09-13 18:42:34 +02:00
Patrick Talbert 900e539254 Merge: drivers/char/random.c: Update for kernel-rt
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/789

Bugzilla: https://bugzilla.redhat.com/2079030

Conflicts: Note there are some context issues that didn't pop up during
backport application but are reported in revumatic.  These are minor context
issues.

The kernel-rt team has requested specific commits for the random driver to
be backported in RHEL9.1.  Since it is so close to upstream it seems like
we can just update it, instead of targeting specific backports.

The new drivers/char/random.c driver requires that the BLAKE2S crypto
library be built-in.

There are only some minor drift issues in these changes.  To make
backporting easier, I have reverted Herbert Xu's RHEL only hook commit,
and re-applied it at the end of the series.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>

Approved-by: Phil Auld <pauld@redhat.com>
Approved-by: David Arcari <darcari@redhat.com>
Approved-by: Hangbin Liu <haliu@redhat.com>
Approved-by: Bruno Meneguele <bmeneg@redhat.com>
Approved-by: Mark Salter <msalter@redhat.com>

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
2022-05-18 10:58:45 +02:00
Patrick Talbert c02636ade8 Merge: DRM 5.18 backport dependencies
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/636

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2072020

So as discussed on kernel-info I am trying to split the drm backport into two bits:
1. getting dependencies and treewide changes in
2. the actual drm backport.

The main idea here is to identify what is acceptable to pull in and what is not. If subsystem maintainers are not happy with certain commits I can drop them and work around when doing the actual DRM backport. But with all those changes most conflicts were due to CVE fixes or other things which landed earlier and made the DRM backport itself quite trivial.

The biggest changes in this MR are the following:
* -isystem removal with a bunch of new headers shipped with the kernel
* Implement generic cc_platform_has() helper function (https://lore.kernel.org/all/20210928191009.32551-1-bp@alien8.de/)
* vgaarb changes as it was moved to `drivers/pci/`
* various little helper functions and other trivial changes

Part of this MR are all identified commits which won't be part of the drm mega commits.

Draft MR for the actual backport: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/717

```
Signed-off-by: Karol Herbst <kherbst@redhat.com>
```

Approved-by: Wander Lairson Costa <wander@redhat.com>
Approved-by: Donald Dutile <ddutile@redhat.com>
Approved-by: David Arcari <darcari@redhat.com>
Approved-by: Phil Auld <pauld@redhat.com>
Approved-by: Kamal Heib <kheib@redhat.com>
Approved-by: Michel Dänzer <mdaenzer@redhat.com>
Approved-by: Bruno Meneguele <bmeneg@redhat.com>
Approved-by: John W. Linville <linville@redhat.com>

Conflicts:
- 50d7bd38c3aa ('stddef: Introduce struct_group() helper macro') already
  merged in MR 595.
- Small context change in arch/powerpc/platforms/pseries/Makefile due to
  b903737bc522 ('powerpc/pseries/vas: sysfs interface to export
  capabilities') from MR 738.

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
2022-05-04 11:13:49 +02:00
Prarit Bhargava 7a11dfb6d5 random: replace custom notifier chain with standard one
Bugzilla: https://bugzilla.redhat.com/2079030

commit 5acd35487dc911541672b3ffc322851769c32a56
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Tue Mar 1 20:03:49 2022 +0100

    random: replace custom notifier chain with standard one

    We previously rolled our own randomness readiness notifier, which only
    has two users in the whole kernel. Replace this with a more standard
    atomic notifier block that serves the same purpose with less code. Also
    unexport the symbols, because no modules use it, only unconditional
    builtins. The only drawback is that it's possible for a notification
    handler returning the "stop" code to prevent further processing, but
    given that there are only two users, and that we're unexporting this
    anyway, that doesn't seem like a significant drawback for the
    simplification we receive here.

    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Theodore Ts'o <tytso@mit.edu>
    Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
    Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
2022-04-27 10:49:06 -04:00
Karol Herbst 52935cce10 isystem: ship and use stdarg.h
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2072020
Upstream Status: v5.15-rc1

commit c0891ac15f0428ffa81b2e818d416bdf3cb74ab6
Author:     Alexey Dobriyan <adobriyan@gmail.com>
AuthorDate: Mon Aug  2 23:40:32 2021 +0300
Commit:     Masahiro Yamada <masahiroy@kernel.org>
CommitDate: Thu Aug 19 09:02:55 2021 +0900

    Ship minimal stdarg.h (1 type, 4 macros) as <linux/stdarg.h>.
    stdarg.h is the only userspace header commonly used in the kernel.

    GPL 2 version of <stdarg.h> can be extracted from
    http://archive.debian.org/debian/pool/main/g/gcc-4.2/gcc-4.2_4.2.4.orig.tar.gz

    Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
    Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Acked-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Signed-off-by: Karol Herbst <kherbst@redhat.com>
2022-04-19 15:52:25 +02:00
Waiman Long e743e34e13 lib/vsprintf: avoid redundant work with 0 size
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2073625

commit ef62c8ff1de437ec2e0582205c1293c7dbbc4484
Author: Waiman Long <longman@redhat.com>
Date:   Thu, 24 Mar 2022 18:09:02 -0700

    lib/vsprintf: avoid redundant work with 0 size

    Patch series "mm/page_owner: Extend page_owner to show memcg information", v4.

    While debugging the constant increase in percpu memory consumption on a
    system that spawned large number of containers, it was found that a lot
    of offline mem_cgroup structures remained in place without being freed.
    Further investigation indicated that those mem_cgroup structures were
    pinned by some pages.

    In order to find out what those pages are, the existing page_owner
    debugging tool is extended to show memory cgroup information and whether
    those memcgs are offline or not.  With the enhanced page_owner tool, the
    following is a typical page that pinned the mem_cgroup structure in my
    test case:

      Page allocated via order 0, mask 0x1100cca(GFP_HIGHUSER_MOVABLE), pid 162970 (podman), ts 1097761405537 ns, free_ts 1097760838089 ns
      PFN 1925700 type Movable Block 3761 type Movable Flags 0x17ffffc00c001c(uptodate|dirty|lru|reclaim|swapbacked|node=0|zone=2|lastcpupid=0x1fffff)
        prep_new_page+0xac/0xe0
        get_page_from_freelist+0x1327/0x14d0
        __alloc_pages+0x191/0x340
        alloc_pages_vma+0x84/0x250
        shmem_alloc_page+0x3f/0x90
        shmem_alloc_and_acct_page+0x76/0x1c0
        shmem_getpage_gfp+0x281/0x940
        shmem_write_begin+0x36/0xe0
        generic_perform_write+0xed/0x1d0
        __generic_file_write_iter+0xdc/0x1b0
        generic_file_write_iter+0x5d/0xb0
        new_sync_write+0x11f/0x1b0
        vfs_write+0x1ba/0x2a0
        ksys_write+0x59/0xd0
        do_syscall_64+0x37/0x80
        entry_SYSCALL_64_after_hwframe+0x44/0xae
      Charged to offline memcg libpod-conmon-15e4f9c758422306b73b2dd99f9d50a5ea53cbb16b4a13a2c2308a4253cc0ec8.

    So the page was not freed because it was part of a shmem segment.  That
    is useful information that can help users to diagnose similar problems.

    With cgroup v1, /proc/cgroups can be read to find out the total number
    of memory cgroups (online + offline).  With cgroup v2, the cgroup.stat
    of the root cgroup can be read to find the number of dying cgroups (most
    likely pinned by dying memcgs).

    The page_owner feature is not supposed to be enabled for production
    system due to its memory overhead.  However, if it is suspected that
    dying memcgs are increasing over time, a test environment with
    page_owner enabled can then be set up with appropriate workload for
    further analysis on what may be causing the increasing number of dying
    memcgs.

    This patch (of 4):

    For *scnprintf(), vsnprintf() is always called even if the input size is
    0.  That is a waste of time, so just return 0 in this case.

    Note that vsnprintf() will never return -1 to indicate an error.  So
    skipping the call to vsnprintf() when size is 0 will have no functional
    impact at all.

    Link: https://lkml.kernel.org/r/20220202203036.744010-1-longman@redhat.com
    Link: https://lkml.kernel.org/r/20220202203036.744010-2-longman@redhat.com
    Signed-off-by: Waiman Long <longman@redhat.com>
    Acked-by: David Rientjes <rientjes@google.com>
    Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
    Acked-by: Roman Gushchin <guro@fb.com>
    Acked-by: Rafael Aquini <aquini@redhat.com>
    Acked-by: Mike Rapoport <rppt@linux.ibm.com>
    Cc: Roman Gushchin <roman.gushchin@linux.dev>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
    Cc: Petr Mladek <pmladek@suse.com>
    Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
    Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
    Cc: Ira Weiny <ira.weiny@intel.com>
    Cc: David Rientjes <rientjes@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Waiman Long <longman@redhat.com>
2022-04-08 21:09:36 -04:00
Waiman Long bd1fb2084e vsprintf: Make %pGp print the hex value
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2073625

commit 23efd0804c0a869dfb1e78470f80a27251317b7e
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date:   Tue, 19 Oct 2021 15:26:21 +0100

    vsprintf: Make %pGp print the hex value

    All existing users of %pGp want the hex value as well as the decoded
    flag names.  This looks awkward (passing the same parameter to printf
    twice), so move that functionality into the core.  If we want, we
    can make that optional with flag arguments to %pGp in the future.

    Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Reviewed-by: Yafang Shao <laoar.shao@gmail.com>
    Reviewed-by: Petr Mladek <pmladek@suse.com>
    Signed-off-by: Petr Mladek <pmladek@suse.com>
    Link: https://lore.kernel.org/r/20211019142621.2810043-6-willy@infradead.org

Signed-off-by: Waiman Long <longman@redhat.com>
2022-04-08 21:09:33 -04:00
Rafael Aquini ff756827f4 mm: introduce PAGEFLAGS_MASK to replace ((1UL << NR_PAGEFLAGS) - 1)
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2023396

This patch is a backport of the following upstream commit:
commit 41c961b9013ee9b6d0491f6926df546e37964b1f
Author: Muchun Song <songmuchun@bytedance.com>
Date:   Tue Sep 7 19:56:15 2021 -0700

    mm: introduce PAGEFLAGS_MASK to replace ((1UL << NR_PAGEFLAGS) - 1)

    Instead of hard-coding ((1UL << NR_PAGEFLAGS) - 1) everywhere, introducing
    PAGEFLAGS_MASK to make the code clear to get the page flags.

    Link: https://lkml.kernel.org/r/20210819150712.59948-1-songmuchun@bytedance.com
    Signed-off-by: Muchun Song <songmuchun@bytedance.com>
    Reviewed-by: Roman Gushchin <guro@fb.com>
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    Reviewed-by: Shakeel Butt <shakeelb@google.com>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Rafael Aquini <aquini@redhat.com>
2021-11-29 11:43:18 -05:00
Stephen Boyd 9294523e37 module: add printk formats to add module build ID to stacktraces
Let's make kernel stacktraces easier to identify by including the build
ID[1] of a module if the stacktrace is printing a symbol from a module.
This makes it simpler for developers to locate a kernel module's full
debuginfo for a particular stacktrace.  Combined with
scripts/decode_stracktrace.sh, a developer can download the matching
debuginfo from a debuginfod[2] server and find the exact file and line
number for the functions plus offsets in a stacktrace that match the
module.  This is especially useful for pstore crash debugging where the
kernel crashes are recorded in something like console-ramoops and the
recovery kernel/modules are different or the debuginfo doesn't exist on
the device due to space concerns (the debuginfo can be too large for space
limited devices).

Originally, I put this on the %pS format, but that was quickly rejected
given that %pS is used in other places such as ftrace where build IDs
aren't meaningful.  There was some discussions on the list to put every
module build ID into the "Modules linked in:" section of the stacktrace
message but that quickly becomes very hard to read once you have more than
three or four modules linked in.  It also provides too much information
when we don't expect each module to be traversed in a stacktrace.  Having
the build ID for modules that aren't important just makes things messy.
Splitting it to multiple lines for each module quickly explodes the number
of lines printed in an oops too, possibly wrapping the warning off the
console.  And finally, trying to stash away each module used in a
callstack to provide the ID of each symbol printed is cumbersome and would
require changes to each architecture to stash away modules and return
their build IDs once unwinding has completed.

Instead, we opt for the simpler approach of introducing new printk formats
'%pS[R]b' for "pointer symbolic backtrace with module build ID" and '%pBb'
for "pointer backtrace with module build ID" and then updating the few
places in the architecture layer where the stacktrace is printed to use
this new format.

Before:

 Call trace:
  lkdtm_WARNING+0x28/0x30 [lkdtm]
  direct_entry+0x16c/0x1b4 [lkdtm]
  full_proxy_write+0x74/0xa4
  vfs_write+0xec/0x2e8

After:

 Call trace:
  lkdtm_WARNING+0x28/0x30 [lkdtm 6c2215028606bda50de823490723dc4bc5bf46f9]
  direct_entry+0x16c/0x1b4 [lkdtm 6c2215028606bda50de823490723dc4bc5bf46f9]
  full_proxy_write+0x74/0xa4
  vfs_write+0xec/0x2e8

[akpm@linux-foundation.org: fix build with CONFIG_MODULES=n, tweak code layout]
[rdunlap@infradead.org: fix build when CONFIG_MODULES is not set]
  Link: https://lkml.kernel.org/r/20210513171510.20328-1-rdunlap@infradead.org
[akpm@linux-foundation.org: make kallsyms_lookup_buildid() static]
[cuibixuan@huawei.com: fix build error when CONFIG_SYSFS is disabled]
  Link: https://lkml.kernel.org/r/20210525105049.34804-1-cuibixuan@huawei.com

Link: https://lkml.kernel.org/r/20210511003845.2429846-6-swboyd@chromium.org
Link: https://fedoraproject.org/wiki/Releases/FeatureBuildId [1]
Link: https://sourceware.org/elfutils/Debuginfod.html [2]
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jessica Yu <jeyu@kernel.org>
Cc: Evan Green <evgreen@chromium.org>
Cc: Hsin-Yi Wang <hsinyi@chromium.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Baoquan He <bhe@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-07-08 11:48:22 -07:00
Zhen Lei 9dbbc3b9d0 lib: fix spelling mistakes
Fix some spelling mistakes in comments:
permanentely ==> permanently
wont ==> won't
remaning ==> remaining
succed ==> succeed
shouldnt ==> shouldn't
alpha-numeric ==> alphanumeric
storeing ==> storing
funtion ==> function
documenation ==> documentation
Determin ==> Determine
intepreted ==> interpreted
ammount ==> amount
obious ==> obvious
interupts ==> interrupts
occured ==> occurred
asssociated ==> associated
taking into acount ==> taking into account
squence ==> sequence
stil ==> still
contiguos ==> contiguous
matchs ==> matches

Link: https://lkml.kernel.org/r/20210607072555.12416-1-thunder.leizhen@huawei.com
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-07-08 11:48:20 -07:00
Linus Torvalds 71bd934101 Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton:
 "190 patches.

  Subsystems affected by this patch series: mm (hugetlb, userfaultfd,
  vmscan, kconfig, proc, z3fold, zbud, ras, mempolicy, memblock,
  migration, thp, nommu, kconfig, madvise, memory-hotplug, zswap,
  zsmalloc, zram, cleanups, kfence, and hmm), procfs, sysctl, misc,
  core-kernel, lib, lz4, checkpatch, init, kprobes, nilfs2, hfs,
  signals, exec, kcov, selftests, compress/decompress, and ipc"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (190 commits)
  ipc/util.c: use binary search for max_idx
  ipc/sem.c: use READ_ONCE()/WRITE_ONCE() for use_global_lock
  ipc: use kmalloc for msg_queue and shmid_kernel
  ipc sem: use kvmalloc for sem_undo allocation
  lib/decompressors: remove set but not used variabled 'level'
  selftests/vm/pkeys: exercise x86 XSAVE init state
  selftests/vm/pkeys: refill shadow register after implicit kernel write
  selftests/vm/pkeys: handle negative sys_pkey_alloc() return code
  selftests/vm/pkeys: fix alloc_random_pkey() to make it really, really random
  kcov: add __no_sanitize_coverage to fix noinstr for all architectures
  exec: remove checks in __register_bimfmt()
  x86: signal: don't do sas_ss_reset() until we are certain that sigframe won't be abandoned
  hfsplus: report create_date to kstat.btime
  hfsplus: remove unnecessary oom message
  nilfs2: remove redundant continue statement in a while-loop
  kprobes: remove duplicated strong free_insn_page in x86 and s390
  init: print out unknown kernel parameters
  checkpatch: do not complain about positive return values starting with EPOLL
  checkpatch: improve the indented label test
  checkpatch: scripts/spdxcheck.py now requires python3
  ...
2021-07-02 12:08:10 -07:00
Alexey Dobriyan ad65dcef3a lib: uninline simple_strtoull()
Gcc inlines simple_strtoull() too agressively.

Given that all 4 signatures match, everything very efficiently calls or
tailcalls into simple_strtoull():

	ffffffff81da0240 <simple_strtoll>:
	ffffffff81da0240:       80 3f 2d                cmp    BYTE PTR [rdi],0x2d
	ffffffff81da0243:       74 05                   je     ffffffff81da024a <simple_strtoll+0xa>
	ffffffff81da0245:       e9 76 ff ff ff          jmp    simple_strtoull
	ffffffff81da024a:       48 83 c7 01             add    rdi,0x1
	ffffffff81da024e:       e8 6d ff ff ff          call   simple_strtoull
	ffffffff81da0253:       48 f7 d8                neg    rax
	ffffffff81da0256:       c3                      ret

Space savings (on F34-ish .config)

	add/remove: 0/0 grow/shrink: 1/3 up/down: 52/-313 (-261)
	Function                                     old     new   delta
	vsscanf                                     2167    2219     +52
	simple_strtoul                                72       2     -70
	simple_strtoll                               143      23    -120
	simple_strtol                                143      20    -123

Link: https://lkml.kernel.org/r/YMO2zoOQk2eF34tn@localhost.localdomain
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-07-01 11:06:05 -07:00
Linus Torvalds 65090f30ab Merge branch 'akpm' (patches from Andrew)
Merge misc updates from Andrew Morton:
 "191 patches.

  Subsystems affected by this patch series: kthread, ia64, scripts,
  ntfs, squashfs, ocfs2, kernel/watchdog, and mm (gup, pagealloc, slab,
  slub, kmemleak, dax, debug, pagecache, gup, swap, memcg, pagemap,
  mprotect, bootmem, dma, tracing, vmalloc, kasan, initialization,
  pagealloc, and memory-failure)"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (191 commits)
  mm,hwpoison: make get_hwpoison_page() call get_any_page()
  mm,hwpoison: send SIGBUS with error virutal address
  mm/page_alloc: split pcp->high across all online CPUs for cpuless nodes
  mm/page_alloc: allow high-order pages to be stored on the per-cpu lists
  mm: replace CONFIG_FLAT_NODE_MEM_MAP with CONFIG_FLATMEM
  mm: replace CONFIG_NEED_MULTIPLE_NODES with CONFIG_NUMA
  docs: remove description of DISCONTIGMEM
  arch, mm: remove stale mentions of DISCONIGMEM
  mm: remove CONFIG_DISCONTIGMEM
  m68k: remove support for DISCONTIGMEM
  arc: remove support for DISCONTIGMEM
  arc: update comment about HIGHMEM implementation
  alpha: remove DISCONTIGMEM and NUMA
  mm/page_alloc: move free_the_page
  mm/page_alloc: fix counting of managed_pages
  mm/page_alloc: improve memmap_pages dbg msg
  mm: drop SECTION_SHIFT in code comments
  mm/page_alloc: introduce vm.percpu_pagelist_high_fraction
  mm/page_alloc: limit the number of pages on PCP lists when reclaim is active
  mm/page_alloc: scale the number of pages that are batch freed
  ...
2021-06-29 17:29:11 -07:00
Linus Torvalds e563592c3e printk changes for 5.14
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEESH4wyp42V4tXvYsjUqAMR0iAlPIFAmDa2mEACgkQUqAMR0iA
 lPKBiBAAgvhNnaRVR6/GBVrv5jYM8obJM7PHPxp8dh+ZRb1mDyL1ZDU2r7lmQjMD
 ORBN5eK6pXk/gVabXR5lY0B7vQ8phJmYO98Lk2E3n9ZTgMkTHQ5WOHzBpt93gd/y
 l9m00ZD0YcHrkmM1fq73FuZVEMzPk85cjTe8n6JeHJgSAdoOY/rl61Cn57ZHFIa4
 DkpdNGkJaf77UIWOc8NLAXOdSD9NxSGycHXpU0q8QO9UFq+Le2qN4OPj3S1CNCO2
 ciy+VcW1VQ/BesPPlBIk3ImHWPS4ty3n4EYFzNm+saElIaWxyhNBXAvcBAK/x9LK
 3QibfBFwbS3sllhnk96Z24UaWWMg2AygbV2aqd3xMLpW3XD6q/MVnWGHfayhnmYj
 aNcWpldIjwDH4iZJ5vnD4KewQpYp+Jc5Hqv6UyIf1O8nEvvQubrDXjSDLLcbZFI1
 m2cs9DTc5ezyX/DifBsViDbw8hPjJg7QAbRjVk1EfVQrH090mRQoSoQQI4QtuMEi
 pPiTALNG1HRKIoYrKxQMB43JvZ1zjaSbtNbW4JJ9Bm3kxFZ/Oa8NXzE5BOjeykZm
 bCePtc018GZaGNW0z/Zr460c/Tuaj8fZSzUOj9Xnw5Hv4G3W5+5EqDy7sU/GTPjL
 It9rAZYo+cM9vp1BD2343YPZgnChWHaW0BF/WDqFAhLd9av/WKI=
 =Oa1c
 -----END PGP SIGNATURE-----

Merge tag 'printk-for-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux

Pull printk updates from Petr Mladek:

 - Add %pt[RT]s modifier to vsprintf(). It overrides ISO 8601 separator
   by using ' ' (space). It produces "YYYY-mm-dd HH:MM:SS" instead of
   "YYYY-mm-ddTHH:MM:SS".

 - Correctly parse long row of numbers by sscanf() when using the field
   width. Add extensive sscanf() selftest.

 - Generalize re-entrant CPU lock that has already been used to
   serialize dump_stack() output. It is part of the ongoing printk
   rework. It will allow to remove the obsoleted printk_safe buffers and
   introduce atomic consoles.

 - Some code clean up and sparse warning fixes.

* tag 'printk-for-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
  printk: fix cpu lock ordering
  lib/dump_stack: move cpu lock to printk.c
  printk: Remove trailing semicolon in macros
  random32: Fix implicit truncation warning in prandom_seed_state()
  lib: test_scanf: Remove pointless use of type_min() with unsigned types
  selftests: lib: Add wrapper script for test_scanf
  lib: test_scanf: Add tests for sscanf number conversion
  lib: vsprintf: Fix handling of number field widths in vsscanf
  lib: vsprintf: scanf: Negative number must have field width > 1
  usb: host: xhci-tegra: Switch to use %ptTs
  nilfs2: Switch to use %ptTs
  kdb: Switch to use %ptTs
  lib/vsprintf: Allow to override ISO 8601 date and time separator
2021-06-29 12:07:18 -07:00
Stephen Boyd 792702911f slub: force on no_hash_pointers when slub_debug is enabled
Obscuring the pointers that slub shows when debugging makes for some
confusing slub debug messages:

 Padding overwritten. 0x0000000079f0674a-0x000000000d4dce17

Those addresses are hashed for kernel security reasons.  If we're trying
to be secure with slub_debug on the commandline we have some big problems
given that we dump whole chunks of kernel memory to the kernel logs.
Let's force on the no_hash_pointers commandline flag when slub_debug is on
the commandline.  This makes slub debug messages more meaningful and if by
chance a kernel address is in some slub debug object dump we will have a
better chance of figuring out what went wrong.

Note that we don't use %px in the slub code because we want to reduce the
number of places that %px is used in the kernel.  This also nicely prints
a big fat warning at kernel boot if slub_debug is on the commandline so
that we know that this kernel shouldn't be used on production systems.

[akpm@linux-foundation.org: fix build with CONFIG_SLUB_DEBUG=n]

Link: https://lkml.kernel.org/r/20210601182202.3011020-5-swboyd@chromium.org
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Petr Mladek <pmladek@suse.com>
Cc: Joe Perches <joe@perches.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-06-29 10:53:47 -07:00
Petr Mladek d8c032145f Merge branch 'for-5.14-vsprintf-scanf' into for-linus 2021-06-29 09:51:58 +02:00
Richard Fitzgerald 900fdc4573 lib: vsprintf: Fix handling of number field widths in vsscanf
The existing code attempted to handle numbers by doing a strto[u]l(),
ignoring the field width, and then repeatedly dividing to extract the
field out of the full converted value. If the string contains a run of
valid digits longer than will fit in a long or long long, this would
overflow and no amount of dividing can recover the correct value.

This patch fixes vsscanf() to obey number field widths when parsing
the number.

A new _parse_integer_limit() is added that takes a limit for the number
of characters to parse. The number field conversion in vsscanf is changed
to use this new function.

If a number starts with a radix prefix, the field width  must be long
enough for at last one digit after the prefix. If not, it will be handled
like this:

 sscanf("0x4", "%1i", &i): i=0, scanning continues with the 'x'
 sscanf("0x4", "%2i", &i): i=0, scanning continues with the '4'

This is consistent with the observed behaviour of userland sscanf.

Note that this patch does NOT fix the problem of a single field value
overflowing the target type. So for example:

  sscanf("123456789abcdef", "%x", &i);

Will not produce the correct result because the value obviously overflows
INT_MAX. But sscanf will report a successful conversion.

Note that where a very large number is used to mean "unlimited", the value
INT_MAX is used for consistency with the behaviour of vsnprintf().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210514161206.30821-2-rf@opensource.cirrus.com
2021-05-19 15:05:11 +02:00
Richard Fitzgerald 11b3dda5e8 lib: vsprintf: scanf: Negative number must have field width > 1
If a signed number field starts with a '-' the field width must be > 1,
or unlimited, to allow at least one digit after the '-'.

This patch adds a check for this. If a signed field starts with '-'
and field_width == 1 the scanf will quit.

It is ok for a signed number field to have a field width of 1 if it
starts with a digit. In that case the single digit can be converted.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210514161206.30821-1-rf@opensource.cirrus.com
2021-05-19 15:05:11 +02:00
Andy Shevchenko 20bc8c1e97 lib/vsprintf: Allow to override ISO 8601 date and time separator
ISO 8601 defines 'T' as a separator between date and time. Though,
some ABIs use time and date with ' ' (space) separator instead.

Add a flavour to the %pt specifier to override default separator.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210511153958.34527-1-andriy.shevchenko@linux.intel.com
2021-05-17 12:01:26 +02:00
Linus Torvalds 68a32ba141 drm for 5.13-rc1
- printk fourcc modifier support added %p4cc
 
 core:
 - drm_crtc_commit_wait
 - atomic plane state helpers reworked for full state
 - dma-buf heaps API rework
 - edid: rework and improvements for displayid
 
 dp-mst:
  - better topology logging
 
 bridge:
 - Chipone ICN6211
 - Lontium LT8912B
 - anx7625 regulator support
 
 panel:
 - fix lt9611 4k panels handling
 
 simple-kms:
 - add plane state helpers
 
 ttm:
 - debugfs support
 - removal of unused sysfs
 - ignore signaled moved fences
 - ioremap buffer according to mem caching
 
 i915:
 - Alderlake S enablement
 - Conversion to dma_resv_locking
 - Bring back watchdog timeout support
 - legacy ioctl cleanups
 - add GEM TDDO and RFC process
 - DG1 LMEM preparation work
 - intel_display.c refactoring
 - Gen9/TGL PCH combination support
 - eDP MSO Support
 - multiple PSR instance support
 - Link training debug updates
 - Disable PSR2 support on JSL/EHL
 - DDR5/LPDDR5 support for bw calcs
 - LSPCON limited to gen9/10 platforms
 - HSW/BDW async flip/VTd corruption workaround
 = SAGV watermakr fixes
 - SNB hard hang on ring resume fix
 - Limit imported dma-buf size
 - move to use new tasklet API
 - refactor KBL/TGL/ADL-S display/gt steppings
 - refactoring legacy DP/HDMI, FB plane code out
 
 amdgpu:
 - uapi: add ioctl to query video capabilities
 - Iniital AMD Freesync HDMI support
 - Initial Adebaran support
 - 10bpc dithering improvements
 - DCN secure display support
 - Drop legacy IO BAR requirements
 - PCIE/S0ix/RAS/Prime/Reset fixes
 - Display ASSR support
 - SMU gfx busy queues for RV/PCO
 - Initial LTTPR display work
 
 amdkfd:
 - MMU notifier fixes
 - APU fixes
 
 radeon:
 - debugfs cleanps
 - fw error handling ifix
 - Flexible array cleanups
 
 msm:
 - big DSI phy/pll cleanup
 - sc7280 initial support
 - commong bandwidth scaling path
 - shrinker locking contention fixes
 - unpin/swap support for GEM objcets
 
 ast:
 - cursor plane handling reworked
 
 tegra:
 - don't register DP AUX channels before connectors
 
 zynqmp:
 - fix OOB struct padding memset
 
 gma500:
 - drop ttm and medfield support
 
 exynos:
 - request_irq cleanup function
 
 mediatek:
 - fine tune line time for EOTp
 - MT8192 dpi support
 - atomic crtc config updates
 - don't support HDMI connector creation
 
 mxsdb:
 - imx8mm support
 
 panfrost:
 -= MMU IRQ handling rework
 
 qxl:
 - locking fixes
 - resource deallocation changes
 
 sun4i:
 - add alpha properties to UI/VI layers
 
 vc4:
 - RPi4 CEC support
 
 vmwgfx:
 - doc cleanups
 
 arc:
 - moved to drm/tiny
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJgiNSVAAoJEAx081l5xIa+fvYP/1206BfOYOx5opt5K3By06ZY
 zrOsbeaqFdHzfUR7xVwO4vqQNhkX4Pt8H/U7uYZx8PRdrXzGENwWLIaIskyUrKOd
 BtwNqUr0ZXJGDlGg26StnUHKeAXuYXlpBKLta5y4LUTkI+bm6V/oVaDMq4dnah70
 2CXS4C2mnaFRLBzuRlraxoGFN4eZkz6Waeyo6PJxn/l2GE2gw+jho0Yrh8e8F2w5
 EjQeNF22/uHwznov03XFJlyugecuBDbE8A6Ma/znnkVdBXcT94eUMugbKOKi4Nn6
 PuJOEdJxmj/9s3oi6kBERc8dvpOj0O+8Vp+xOzn2U3BVXebvu7VoJsq6FcAvL5lN
 ltj4iErxUlEud2GRIVUMx8OTFiKj4ThRFJ2/8Uf22r3P7RHO5E9BLnZBzqIAhDVr
 s2cDBMItcxcVHRCmE04h12XAO4libZBb2TVjbqG94Acq7beR76pMszFrmxPmHBEm
 NGe1s7+ajxMzsq/NIsk4XAhqSmJo6+ujKyyVnrgvKUVeEaWW1U4YvjhJaetnP4fB
 47gF24wOSNFwiCUZlqaIpp/MR4Z8YmaJ7tayWQq4Oj/neWe/yc8xQgQIuE8GL20j
 P9eNQNvlBnoxkz275M9x4kVhJ5FRjr7OYnd3sFVnALuj6fnL3Z1RXLqI1lNtIz1d
 YM89veZuNxMaiDz8roPH
 =bLWZ
 -----END PGP SIGNATURE-----

Merge tag 'drm-next-2021-04-28' of git://anongit.freedesktop.org/drm/drm

Pull drm updates from Dave Airlie:
 "The usual lots of work all over the place.

  i915 has gotten some Alderlake work and prelim DG1 code, along with a
  major locking rework over the GEM code, and brings back the property
  of timing out long running jobs using a watchdog. amdgpu has some
  Alderbran support (new GPU), freesync HDMI support along with a lot
  other fixes.

  Outside of the drm, there is a new printf specifier added which should
  have all the correct acks/sobs:

   - printk fourcc modifier support added %p4cc

  Summary:

  core:
   - drm_crtc_commit_wait
   - atomic plane state helpers reworked for full state
   - dma-buf heaps API rework
   - edid: rework and improvements for displayid

  dp-mst:
   - better topology logging

  bridge:
   - Chipone ICN6211
   - Lontium LT8912B
   - anx7625 regulator support

  panel:
   - fix lt9611 4k panels handling

  simple-kms:
   - add plane state helpers

  ttm:
   - debugfs support
   - removal of unused sysfs
   - ignore signaled moved fences
   - ioremap buffer according to mem caching

  i915:
   - Alderlake S enablement
   - Conversion to dma_resv_locking
   - Bring back watchdog timeout support
   - legacy ioctl cleanups
   - add GEM TDDO and RFC process
   - DG1 LMEM preparation work
   - intel_display.c refactoring
   - Gen9/TGL PCH combination support
   - eDP MSO Support
   - multiple PSR instance support
   - Link training debug updates
   - Disable PSR2 support on JSL/EHL
   - DDR5/LPDDR5 support for bw calcs
   - LSPCON limited to gen9/10 platforms
   - HSW/BDW async flip/VTd corruption workaround
   - SAGV watermark fixes
   - SNB hard hang on ring resume fix
   - Limit imported dma-buf size
   - move to use new tasklet API
   - refactor KBL/TGL/ADL-S display/gt steppings
   - refactoring legacy DP/HDMI, FB plane code out

  amdgpu:
   - uapi: add ioctl to query video capabilities
   - Iniital AMD Freesync HDMI support
   - Initial Adebaran support
   - 10bpc dithering improvements
   - DCN secure display support
   - Drop legacy IO BAR requirements
   - PCIE/S0ix/RAS/Prime/Reset fixes
   - Display ASSR support
   - SMU gfx busy queues for RV/PCO
   - Initial LTTPR display work

  amdkfd:
   - MMU notifier fixes
   - APU fixes

  radeon:
   - debugfs cleanps
   - fw error handling ifix
   - Flexible array cleanups

  msm:
   - big DSI phy/pll cleanup
   - sc7280 initial support
   - commong bandwidth scaling path
   - shrinker locking contention fixes
   - unpin/swap support for GEM objcets

  ast:
   - cursor plane handling reworked

  tegra:
   - don't register DP AUX channels before connectors

  zynqmp:
   - fix OOB struct padding memset

  gma500:
   - drop ttm and medfield support

  exynos:
   - request_irq cleanup function

  mediatek:
   - fine tune line time for EOTp
   - MT8192 dpi support
   - atomic crtc config updates
   - don't support HDMI connector creation

  mxsdb:
   - imx8mm support

  panfrost:
   - MMU IRQ handling rework

  qxl:
   - locking fixes
   - resource deallocation changes

  sun4i:
   - add alpha properties to UI/VI layers

  vc4:
   - RPi4 CEC support

  vmwgfx:
   - doc cleanups

  arc:
   - moved to drm/tiny"

* tag 'drm-next-2021-04-28' of git://anongit.freedesktop.org/drm/drm: (1390 commits)
  drm/ttm: Don't count pages in SG BOs against pages_limit
  drm/ttm: fix return value check
  drm/bridge: lt8912b: fix incorrect handling of of_* return values
  drm: bridge: fix LONTIUM use of mipi_dsi_() functions
  drm: bridge: fix ANX7625 use of mipi_dsi_() functions
  drm/amdgpu: page retire over debugfs mechanism
  drm/radeon: Fix a missing check bug in radeon_dp_mst_detect()
  drm/amd/display: Fix the Wunused-function warning
  drm/radeon/r600: Fix variables that are not used after assignment
  drm/amdgpu/smu7: fix CAC setting on TOPAZ
  drm/amd/display: Update DCN302 SR Exit Latency
  drm/amdgpu: enable ras eeprom on aldebaran
  drm/amdgpu: RAS harvest on driver load
  drm/amdgpu: add ras aldebaran ras eeprom driver
  drm/amd/pm: increase time out value when sending msg to SMU
  drm/amdgpu: add DMUB outbox event IRQ source define/complete/debug flag
  drm/amd/pm: add the callback to get vbios bootup values for vangogh
  drm/radeon: Fix size overflow
  drm/amdgpu: Fix size overflow
  drm/amdgpu: move mmhub ras_func init to ip specific file
  ...
2021-04-28 10:01:40 -07:00
Petr Mladek da34b03fbd Merge branch 'for-5.13-vsprintf-pgp' into for-linus 2021-04-27 14:31:38 +02:00
Rasmus Villemoes 84696cfaf4 lib/vsprintf.c: remove leftover 'f' and 'F' cases from bstr_printf()
Commit 9af7706492 ("lib/vsprintf: Remove support for %pF and %pf in
favour of %pS and %ps") removed support for %pF and %pf, and correctly
removed the handling of those cases in vbin_printf(). However, the
corresponding cases in bstr_printf() were left behind.

In the same series, %pf was re-purposed for dealing with
fwnodes (3bd32d6a2e, "lib/vsprintf: Add %pfw conversion specifier
for printing fwnode names").

So should anyone use %pf with the binary printf routines,
vbin_printf() would (correctly, as it involves dereferencing the
pointer) do the string formatting to the u32 array, but bstr_printf()
would not copy the string from the u32 array, but instead interpret
the first sizeof(void*) bytes of the formatted string as a pointer -
which generally won't end well (also, all subsequent get_args would be
out of sync).

Fixes: 9af7706492 ("lib/vsprintf: Remove support for %pF and %pf in favour of %pS and %ps")
Cc: stable@vger.kernel.org
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210423094529.1862521-1-linux@rasmusvillemoes.dk
2021-04-23 16:43:23 +02:00
Vlastimil Babka a48849e235 printk: clarify the documentation for plain pointer printing
We have several modifiers for plain pointers (%p, %px and %pK) and now
also the no_hash_pointers boot parameter. The documentation should help
to choose which variant to use. Importantly, we should discourage %px
in favor of %p (with the new boot parameter when debugging), and stress
that %pK should be only used for procfs and similar files, not dmesg
buffer. This patch clarifies the documentation in that regard.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210225164639.27212-1-vbabka@suse.cz
2021-04-07 13:20:59 +02:00
Yafang Shao c244297acb vsprintf: dump full information of page flags in pGp
Currently the pGp only shows the names of page flags, rather than
the full information including section, node, zone, last cpupid and
kasan tag. While it is not easy to parse these information manually
because there're so many flavors. Let's interpret them in pGp as well.

To be compitable with the existed format of pGp, the new introduced ones
also use '|' as the separator, then the user tools parsing pGp won't
need to make change, suggested by Matthew. The new information is
tracked onto the end of the existed one.

On example of the output in mm/slub.c as follows,
- Before the patch,
[ 6343.396602] Slab 0x000000004382e02b objects=33 used=3 fp=0x000000009ae06ffc flags=0x17ffffc0010200(slab|head)

- After the patch,
[ 8448.272530] Slab 0x0000000090797883 objects=33 used=3 fp=0x00000000790f1c26 flags=0x17ffffc0010200(slab|head|node=0|zone=2|lastcpupid=0x1fffff)

The documentation and test cases are also updated. The output of the
test cases as follows,
[68599.816764] test_printf: loaded.
[68599.819068] test_printf: all 388 tests passed
[68599.830367] test_printf: unloaded.

[lkp@intel.com: reported issues in the prev version in test_printf.c]

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Joe Perches <joe@perches.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: kernel test robot <lkp@intel.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210319101246.73513-4-laoar.shao@gmail.com
2021-03-19 16:38:49 +01:00
Marco Elver 9f961c2e08 lib/vsprintf: do not show no_hash_pointers message multiple times
Do not show no_hash_pointers message multiple times if the option was
passed more than once (e.g. via generated command line).

Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210305194206.3165917-1-elver@google.com
2021-03-19 10:54:02 +01:00
Dave Airlie 51c3b916a4 drm-misc-next for 5.13:
UAPI Changes:
 
 Cross-subsystem Changes:
 
 Core Changes:
   - %p4cc printk format modifier
   - atomic: introduce drm_crtc_commit_wait, rework atomic plane state
     helpers to take the drm_commit_state structure
   - dma-buf: heaps rework to return a struct dma_buf
   - simple-kms: Add plate state helpers
   - ttm: debugfs support, removal of sysfs
 
 Driver Changes:
   - Convert drivers to shadow plane helpers
   - arc: Move to drm/tiny
   - ast: cursor plane reworks
   - gma500: Remove TTM and medfield support
   - mxsfb: imx8mm support
   - panfrost: MMU IRQ handling rework
   - qxl: rework to better handle resources deallocation, locking
   - sun4i: Add alpha properties for UI and VI layers
   - vc4: RPi4 CEC support
   - vmwgfx: doc cleanup
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYD9fUAAKCRDj7w1vZxhR
 xcRLAQDdWKgUNeHnkKCUNh3ewPGabxvc6KQtPqAxcFv0I3ZmWgEAlfTS0pRLdyzQ
 ITRBL0T0S7cIyqnDULZkwfqB6Q8D0ws=
 =hPCS
 -----END PGP SIGNATURE-----

Merge tag 'drm-misc-next-2021-03-03' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for 5.13:

UAPI Changes:

Cross-subsystem Changes:

Core Changes:
  - %p4cc printk format modifier
  - atomic: introduce drm_crtc_commit_wait, rework atomic plane state
    helpers to take the drm_commit_state structure
  - dma-buf: heaps rework to return a struct dma_buf
  - simple-kms: Add plate state helpers
  - ttm: debugfs support, removal of sysfs

Driver Changes:
  - Convert drivers to shadow plane helpers
  - arc: Move to drm/tiny
  - ast: cursor plane reworks
  - gma500: Remove TTM and medfield support
  - mxsfb: imx8mm support
  - panfrost: MMU IRQ handling rework
  - qxl: rework to better handle resources deallocation, locking
  - sun4i: Add alpha properties for UI and VI layers
  - vc4: RPi4 CEC support
  - vmwgfx: doc cleanup

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210303100600.dgnkadonzuvfnu22@gilmour
2021-03-16 17:08:46 +10:00
Sakari Ailus af612e43de lib/vsprintf: Add support for printing V4L2 and DRM fourccs
Add a printk modifier %p4cc (for pixel format) for printing V4L2 and DRM
pixel formats denoted by fourccs. The fourcc encoding is the same for both
so the same implementation can be used.

Suggested-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20210216155723.17109-2-sakari.ailus@linux.intel.com
2021-02-17 12:52:20 +01:00
Timur Tabi 5ead723a20 lib/vsprintf: no_hash_pointers prints all addresses as unhashed
If the no_hash_pointers command line parameter is set, then
printk("%p") will print pointers as unhashed, which is useful for
debugging purposes.  This change applies to any function that uses
vsprintf, such as print_hex_dump() and seq_buf_printf().

A large warning message is displayed if this option is enabled.
Unhashed pointers expose kernel addresses, which can be a security
risk.

Also update test_printf to skip the hashed pointer tests if the
command-line option is set.

Signed-off-by: Timur Tabi <timur@kernel.org>
Acked-by: Petr Mladek <pmladek@suse.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Marco Elver <elver@google.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210214161348.369023-4-timur@kernel.org
2021-02-15 11:08:32 +01:00
Gustavo A. R. Silva 36f9ff9e03 lib: Fix fall-through warnings for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix multiple
warnings by explicitly adding multiple break statements instead of
letting the code fall through to the next case, and by replacing a
number of /* fall through */ comments with the new pseudo-keyword
macro fallthrough.

Notice that Clang doesn't recognize /* Fall through */ comments as
implicit fall-through markings.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2020-11-19 07:23:47 -06:00
Nick Desaulniers 4c1ca831ad Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
This reverts commit 6a9dc5fd61 ("lib: Revert use of fallthrough
pseudo-keyword in lib/")

Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
re-enable these fixes for lib/.

Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://github.com/ClangBuiltLinux/linux/issues/236
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2020-11-18 14:15:17 -06:00
Christoph Hellwig 700cd59db5 vsprintf: use bd_partno in bdev_name
No need to go through the hd_struct to find the partition number.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2020-09-25 08:18:58 -06:00
Gustavo A. R. Silva 6a9dc5fd61 lib: Revert use of fallthrough pseudo-keyword in lib/
The following build error for powerpc64 was reported by Nathan Chancellor:

  "$ scripts/config --file arch/powerpc/configs/powernv_defconfig -e KERNEL_XZ

   $ make -skj"$(nproc)" ARCH=powerpc CROSS_COMPILE=powerpc64le-linux- distclean powernv_defconfig zImage
   ...
   In file included from arch/powerpc/boot/../../../lib/decompress_unxz.c:234,
                    from arch/powerpc/boot/decompress.c:38:
   arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c: In function 'dec_main':
   arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c:586:4: error: 'fallthrough' undeclared (first use in this function)
     586 |    fallthrough;
         |    ^~~~~~~~~~~

   This will end up affecting distribution configurations such as Debian
   and OpenSUSE according to my testing. I am not sure what the solution
   is, the PowerPC wrapper does not set -D__KERNEL__ so I am not sure
   that compiler_attributes.h can be safely included."

In order to avoid these sort of problems, it seems that the best
solution is to use /* fall through */ comments instead of the
fallthrough pseudo-keyword macro in lib/, for now.

Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Fixes: df561f6688 ("treewide: Use fallthrough pseudo-keyword")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-and-tested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-08-24 14:17:44 -07:00
Gustavo A. R. Silva df561f6688 treewide: Use fallthrough pseudo-keyword
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 <gustavoars@kernel.org>
2020-08-23 17:36:59 -05:00
Andy Shevchenko 30d497a0e1 lib/vsprintf: Force type of flags value for gfp_t
Sparse is not happy about restricted type being assigned:
  lib/vsprintf.c:1940:23: warning: incorrect type in assignment (different base types)
  lib/vsprintf.c:1940:23:    expected unsigned long [assigned] flags
  lib/vsprintf.c:1940:23:    got restricted gfp_t [usertype]

Force type of flags value to make sparse happy.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20200731180825.30575-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
2020-08-01 12:52:57 +09:00
Andy Shevchenko 09ceb8d76e lib/vsprintf: Replace custom spec to print decimals with generic one
When printing phandle via %pOFp the custom spec is used. First of all,
it has a SMALL flag which makes no sense for decimal numbers. Second,
we have already default spec for decimal numbers. Use the latter in
the %pOFp case as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Joe Perches <joe@perches.com>
Cc: Grant Likely <grant.likely@arm.com>
Link: https://lore.kernel.org/r/20200731180825.30575-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
2020-08-01 12:52:36 +09:00
Andy Shevchenko b886690d1b lib/vsprintf: Replace hidden BUILD_BUG_ON() with static_assert()
First of all, there is no compile time check for the SMALL
to be ' ' (0x20, i.e. space). Second, for ZEROPAD the check
is hidden in the code.

For better maintenance replace BUILD_BUG_ON() with static_assert()
for ZEROPAD and move it closer to the definition. While at it,
introduce check for SMALL.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Link: https://lore.kernel.org/r/20200731180825.30575-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
2020-08-01 12:52:32 +09:00
Alexander A. Klimov 8eda94bde4 Replace HTTP links with HTTPS ones: vsprintf
Rationale:
Reduces attack surface on kernel devs opening the links for MITM
as HTTPS traffic is much harder to manipulate.

Deterministic algorithm:
For each file:
  If not .svg:
    For each line:
      If doesn't contain `\bxmlns\b`:
        For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`:
          If both the HTTP and HTTPS versions
          return 200 OK and serve the same content:
            Replace HTTP with HTTPS.

Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20200702200536.13389-1-grandmaster@al2klimov.de
2020-07-03 14:07:00 +02:00
Linus Torvalds ca1f5df23f Printk changes for 5.8
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEESH4wyp42V4tXvYsjUqAMR0iAlPIFAl7U1TIACgkQUqAMR0iA
 lPI0mQ//TcVlRJgts/iwv0M2Simje28t9tziOHgWmEeiyGwE7vwDPDzt8QFiKzBa
 IrJ5iTRMtCrEF+eapqeH4g+Ve4Npm5Cobl8/h9JEiVu3SNC48TuaiUzU3+Bfl1zV
 vcDfZtN9QD1/CdLGlyKO75xjkCOaJRCFnx5ToXnd3llshMKI2XebUCnEH4TDe6Fz
 NGTjJL4kCPwzmae++UhlMfKwkayBtNbqcLkaTb7d67Tw2DcuuIVixUER77oC9QPN
 SfxdS07s0UVc4C9bCVe3KtYZR5YU/riOjKNJNutzP3JDtQNugywrrtI0qBwEisqM
 puMJ3xLeLssTn10FJxRK9ewRlXy2zT9mmcCuaVU6LtiyGnHOuEwIU+Ewu0itiJGu
 JuFovsNqTvOiZqFP7+pkDktOjffF2hsY/a6NxHr6aof8CrdO2w9dmCAgzGvnwV1N
 /zlmmPSEigVLz47eeivIIdQrPUejrEV7g1wOYYApnIlNCmGjdkGnXKNaUrLGDehQ
 QIlpx1uvmhntjiw1hTSbOV7KOQxLGtuy6DWLYC7uHD3H3aGDQyQO8dZYXSfOY1Qu
 cvQ/K8ykW0Kq2JKEHjkwSRHKDpxhvbQg7N5JCHQA49ahdZD3O5bOfeTofw+7nFO0
 j9g2Qv6nWFjLbAIAFtqjh6wz0UtGNoTl2cqQswsS10wlDcsq8vs=
 =pUBG
 -----END PGP SIGNATURE-----

Merge tag 'printk-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux

Pull printk updates from Petr Mladek:

 - Benjamin Herrenschmidt solved a problem with non-matched console
   aliases by first checking consoles defined on the command line. It is
   a more conservative approach than the previous attempts.

 - Benjamin also made sure that the console accessible via /dev/console
   always has CON_CONSDEV flag.

 - Andy Shevchenko added the %ptT modifier for printing struct time64_t.
   It extends the existing %ptR handling for struct rtc_time.

 - Bruno Meneguele fixed /dev/kmsg error value returned by unsupported
   SEEK_CUR.

 - Tetsuo Handa removed unused pr_cont_once().

... and a few small fixes.

* tag 'printk-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
  printk: Remove pr_cont_once()
  printk: handle blank console arguments passed in.
  kernel/printk: add kmsg SEEK_CUR handling
  printk: Fix a typo in comment "interator"->"iterator"
  usb: pulse8-cec: Switch to use %ptT
  ARM: bcm2835: Switch to use %ptT
  lib/vsprintf: Print time64_t in human readable format
  lib/vsprintf: update comment about simple_strto<foo>() functions
  printk: Correctly set CON_CONSDEV even when preferred console was not registered
  printk: Fix preferred console selection with multiple matches
  printk: Move console matching logic into a separate function
  printk: Convert a use of sprintf to snprintf in console_unlock
2020-06-01 12:13:30 -07:00
Petr Mladek 8b390ab725 Merge branch 'for-5.8-printf-time64_t' into for-linus 2020-06-01 10:15:43 +02:00