Skip to content
  1. Nov 10, 2021
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 59a2ceee
      Linus Torvalds authored
      Merge more updates from Andrew Morton:
       "87 patches.
      
        Subsystems affected by this patch series: mm (pagecache and hugetlb),
        procfs, misc, MAINTAINERS, lib, checkpatch, binfmt, kallsyms, ramfs,
        init, codafs, nilfs2, hfs, crash_dump, signals, seq_file, fork,
        sysvfs, kcov, gdb, resource, selftests, and ipc"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (87 commits)
        ipc/ipc_sysctl.c: remove fallback for !CONFIG_PROC_SYSCTL
        ipc: check checkpoint_restore_ns_capable() to modify C/R proc files
        selftests/kselftest/runner/run_one(): allow running non-executable files
        virtio-mem: disallow mapping virtio-mem memory via /dev/mem
        kernel/resource: disallow access to exclusive system RAM regions
        kernel/resource: clean up and optimize iomem_is_exclusive()
        scripts/gdb: handle split debug for vmlinux
        kcov: replace local_irq_save() with a local_lock_t
        kcov: avoid enable+disable interrupts if !in_task()
        kcov: allocate per-CPU memory on the relevant node
        Documentation/kcov: define `ip' in the example
        Documentation/kcov: include types.h in the example
        sysv: use BUILD_BUG_ON instead of runtime check
        kernel/fork.c: unshare(): use swap() to make code cleaner
        seq_file: fix passing wrong private data
        seq_file: move seq_escape() to a header
        signal: remove duplicate include in signal.h
        crash_dump: remove duplicate include in crash_dump.h
        crash_dump: fix boolreturn.cocci warning
        hfs/hfsplus: use WARN_ON for sanity check
        ...
      59a2ceee
    • Manfred Spraul's avatar
      ipc/ipc_sysctl.c: remove fallback for !CONFIG_PROC_SYSCTL · 0e9beb8a
      Manfred Spraul authored
      
      
      Compilation of ipc/ipc_sysctl.c is controlled by
      obj-$(CONFIG_SYSVIPC_SYSCTL)
      [see ipc/Makefile]
      
      And CONFIG_SYSVIPC_SYSCTL depends on SYSCTL
      [see init/Kconfig]
      
      An SYSCTL is selected by PROC_SYSCTL.
      [see fs/proc/Kconfig]
      
      Thus: #ifndef CONFIG_PROC_SYSCTL in ipc/ipc_sysctl.c is impossible, the
      fallback can be removed.
      
      Link: https://lkml.kernel.org/r/20210918145337.3369-1-manfred@colorfullife.com
      Signed-off-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Reviewed-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Acked-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0e9beb8a
    • Michal Clapinski's avatar
      ipc: check checkpoint_restore_ns_capable() to modify C/R proc files · 5563cabd
      Michal Clapinski authored
      
      
      This commit removes the requirement to be root to modify sem_next_id,
      msg_next_id and shm_next_id and checks checkpoint_restore_ns_capable
      instead.
      
      Since those files are specific to the IPC namespace, there is no reason
      they should require root privileges.  This is similar to ns_last_pid,
      which also only checks checkpoint_restore_ns_capable.
      
      [akpm@linux-foundation.org: ipc/ipc_sysctl.c needs capability.h for checkpoint_restore_ns_capable()]
      
      Link: https://lkml.kernel.org/r/20210916163717.3179496-1-mclapinski@google.com
      Signed-off-by: default avatarMichal Clapinski <mclapinski@google.com>
      Reviewed-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Reviewed-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5563cabd
    • SeongJae Park's avatar
      selftests/kselftest/runner/run_one(): allow running non-executable files · 303f8e2d
      SeongJae Park authored
      
      
      When running a test program, 'run_one()' checks if the program has the
      execution permission and fails if it doesn't.  However, it's easy to
      mistakenly lose the permissions, as some common tools like 'diff' don't
      support the permission change well[1].  Compared to that, making mistakes
      in the test program's path would only rare, as those are explicitly listed
      in 'TEST_PROGS'.  Therefore, it might make more sense to resolve the
      situation on our own and run the program.
      
      For this reason, this commit makes the test program runner function still
      print the warning message but to try parsing the interpreter of the
      program and to explicitly run it with the interpreter, in this case.
      
      [1] https://lore.kernel.org/mm-commits/YRJisBs9AunccCD4@kroah.com/
      
      Link: https://lkml.kernel.org/r/20210810164534.25902-1-sj38.park@gmail.com
      Signed-off-by: default avatarSeongJae Park <sjpark@amazon.de>
      Suggested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      303f8e2d
    • David Hildenbrand's avatar
      virtio-mem: disallow mapping virtio-mem memory via /dev/mem · 2128f4e2
      David Hildenbrand authored
      
      
      We don't want user space to be able to map virtio-mem device memory
      directly (e.g., via /dev/mem) in order to have guarantees that in a sane
      setup we'll never accidentially access unplugged memory within the
      device-managed region of a virtio-mem device, just as required by the
      virtio-spec.
      
      As soon as the virtio-mem driver is loaded, the device region is visible
      in /proc/iomem via the parent device region.  From that point on user
      space is aware of the device region and we want to disallow mapping
      anything inside that region (where we will dynamically (un)plug memory)
      until the driver has been unloaded cleanly and e.g., another driver might
      take over.
      
      By creating our parent IORESOURCE_SYSTEM_RAM resource with
      IORESOURCE_EXCLUSIVE, we will disallow any /dev/mem access to our device
      region until the driver was unloaded cleanly and removed the parent
      region.  This will work even though only some memory blocks are actually
      currently added to Linux and appear as busy in the resource tree.
      
      So access to the region from user space is only possible
      a) if we don't load the virtio-mem driver.
      b) after unloading the virtio-mem driver cleanly.
      
      Don't build virtio-mem if access to /dev/mem cannot be restricticted -- if
      we have CONFIG_DEVMEM=y but CONFIG_STRICT_DEVMEM is not set.
      
      Link: https://lkml.kernel.org/r/20210920142856.17758-4-david@redhat.com
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarDan Williams <dan.j.williams@intel.com>
      Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2128f4e2
    • David Hildenbrand's avatar
      kernel/resource: disallow access to exclusive system RAM regions · a9e7b8d4
      David Hildenbrand authored
      
      
      virtio-mem dynamically exposes memory inside a device memory region as
      system RAM to Linux, coordinating with the hypervisor which parts are
      actually "plugged" and consequently usable/accessible.
      
      On the one hand, the virtio-mem driver adds/removes whole memory blocks,
      creating/removing busy IORESOURCE_SYSTEM_RAM resources, on the other
      hand, it logically (un)plugs memory inside added memory blocks,
      dynamically either exposing them to the buddy or hiding them from the
      buddy and marking them PG_offline.
      
      In contrast to physical devices, like a DIMM, the virtio-mem driver is
      required to actually make use of any of the device-provided memory,
      because it performs the handshake with the hypervisor.  virtio-mem
      memory cannot simply be access via /dev/mem without a driver.
      
      There is no safe way to:
      a) Access plugged memory blocks via /dev/mem, as they might contain
         unplugged holes or might get silently unplugged by the virtio-mem
         driver and consequently turned inaccessible.
      b) Access unplugged memory blocks via /dev/mem because the virtio-mem
         driver is required to make them actually accessible first.
      
      The virtio-spec states that unplugged memory blocks MUST NOT be written,
      and only selected unplugged memory blocks MAY be read.  We want to make
      sure, this is the case in sane environments -- where the virtio-mem driver
      was loaded.
      
      We want to make sure that in a sane environment, nobody "accidentially"
      accesses unplugged memory inside the device managed region.  For example,
      a user might spot a memory region in /proc/iomem and try accessing it via
      /dev/mem via gdb or dumping it via something else.  By the time the mmap()
      happens, the memory might already have been removed by the virtio-mem
      driver silently: the mmap() would succeeed and user space might
      accidentially access unplugged memory.
      
      So once the driver was loaded and detected the device along the
      device-managed region, we just want to disallow any access via /dev/mem to
      it.
      
      In an ideal world, we would mark the whole region as busy ("owned by a
      driver") and exclude it; however, that would be wrong, as we don't really
      have actual system RAM at these ranges added to Linux ("busy system RAM").
      Instead, we want to mark such ranges as "not actual busy system RAM but
      still soft-reserved and prepared by a driver for future use."
      
      Let's teach iomem_is_exclusive() to reject access to any range with
      "IORESOURCE_SYSTEM_RAM | IORESOURCE_EXCLUSIVE", even if not busy and even
      if "iomem=relaxed" is set.  Introduce EXCLUSIVE_SYSTEM_RAM to make it
      easier for applicable drivers to depend on this setting in their Kconfig.
      
      For now, there are no applicable ranges and we'll modify virtio-mem next
      to properly set IORESOURCE_EXCLUSIVE on the parent resource container it
      creates to contain all actual busy system RAM added via
      add_memory_driver_managed().
      
      Link: https://lkml.kernel.org/r/20210920142856.17758-3-david@redhat.com
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarDan Williams <dan.j.williams@intel.com>
      Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a9e7b8d4
    • David Hildenbrand's avatar
      kernel/resource: clean up and optimize iomem_is_exclusive() · b78dfa05
      David Hildenbrand authored
      
      
      Patch series "virtio-mem: disallow mapping virtio-mem memory via /dev/mem", v5.
      
      Let's add the basic infrastructure to exclude some physical memory regions
      marked as "IORESOURCE_SYSTEM_RAM" completely from /dev/mem access, even
      though they are not marked IORESOURCE_BUSY and even though "iomem=relaxed"
      is set.  Resource IORESOURCE_EXCLUSIVE for that purpose instead of adding
      new flags to express something similar to "soft-busy" or "not busy yet,
      but already prepared by a driver and not to be mapped by user space".
      
      Use it for virtio-mem, to disallow mapping any virtio-mem memory via
      /dev/mem to user space after the virtio-mem driver was loaded.
      
      This patch (of 3):
      
      We end up traversing subtrees of ranges we are not interested in; let's
      optimize this case, skipping such subtrees, cleaning up the function a
      bit.
      
      For example, in the following configuration (/proc/iomem):
      
        00000000-00000fff : Reserved
        00001000-00057fff : System RAM
        00058000-00058fff : Reserved
        00059000-0009cfff : System RAM
        0009d000-000fffff : Reserved
           000a0000-000bffff : PCI Bus 0000:00
           000c0000-000c3fff : PCI Bus 0000:00
           000c4000-000c7fff : PCI Bus 0000:00
           000c8000-000cbfff : PCI Bus 0000:00
           000cc000-000cffff : PCI Bus 0000:00
           000d0000-000d3fff : PCI Bus 0000:00
           000d4000-000d7fff : PCI Bus 0000:00
           000d8000-000dbfff : PCI Bus 0000:00
           000dc000-000dffff : PCI Bus 0000:00
           000e0000-000e3fff : PCI Bus 0000:00
           000e4000-000e7fff : PCI Bus 0000:00
           000e8000-000ebfff : PCI Bus 0000:00
           000ec000-000effff : PCI Bus 0000:00
           000f0000-000fffff : PCI Bus 0000:00
             000f0000-000fffff : System ROM
        00100000-3fffffff : System RAM
        40000000-403fffff : Reserved
           40000000-403fffff : pnp 00:00
        40400000-80a79fff : System RAM
        ...
      
      We don't have to look at any children of "0009d000-000fffff : Reserved"
      if we can just skip these 15 items directly because the parent range is
      not of interest.
      
      Link: https://lkml.kernel.org/r/20210920142856.17758-1-david@redhat.com
      Link: https://lkml.kernel.org/r/20210920142856.17758-2-david@redhat.com
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarDan Williams <dan.j.williams@intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
      Cc: Hanjun Guo <guohanjun@huawei.com>
      Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b78dfa05
    • Douglas Anderson's avatar
      scripts/gdb: handle split debug for vmlinux · 3b294118
      Douglas Anderson authored
      This is related to two previous changes.  Commit dfe4529e
      ("scripts/gdb: find vmlinux where it was before") and commit da036ae1
      
      
      ("scripts/gdb: handle split debug").
      
      Although Chrome OS has been using the debug suffix for modules for a
      while, it has just recently started using it for vmlinux as well.  That
      means we've now got to improve the detection of "vmlinux" to also handle
      that it might end with ".debug".
      
      Link: https://lkml.kernel.org/r/20211028151120.v2.1.Ie6bd5a232f770acd8c9ffae487a02170bad3e963@changeid
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
      Cc: Jan Kiszka <jan.kiszka@siemens.com>
      Cc: Kieran Bingham <kbingham@kernel.org>
      Cc: Johannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3b294118
    • Sebastian Andrzej Siewior's avatar
      kcov: replace local_irq_save() with a local_lock_t · d5d2c51f
      Sebastian Andrzej Siewior authored
      
      
      The kcov code mixes local_irq_save() and spin_lock() in
      kcov_remote_{start|end}().  This creates a warning on PREEMPT_RT because
      local_irq_save() disables interrupts and spin_lock_t is turned into a
      sleeping lock which can not be acquired in a section with disabled
      interrupts.
      
      The kcov_remote_lock is used to synchronize the access to the hash-list
      kcov_remote_map.  The local_irq_save() block protects access to the
      per-CPU data kcov_percpu_data.
      
      There is no compelling reason to change the lock type to raw_spin_lock_t
      to make it work with local_irq_save().  Changing it would require to
      move memory allocation (in kcov_remote_add()) and deallocation outside
      of the locked section.
      
      Adding an unlimited amount of entries to the hashlist will increase the
      IRQ-off time during lookup.  It could be argued that this is debug code
      and the latency does not matter.  There is however no need to do so and
      it would allow to use this facility in an RT enabled build.
      
      Using a local_lock_t instead of local_irq_save() has the befit of adding
      a protection scope within the source which makes it obvious what is
      protected.  On a !PREEMPT_RT && !LOCKDEP build the local_lock_irqsave()
      maps directly to local_irq_save() so there is overhead at runtime.
      
      Replace the local_irq_save() section with a local_lock_t.
      
      Link: https://lkml.kernel.org/r/20210923164741.1859522-6-bigeasy@linutronix.de
      Link: https://lore.kernel.org/r/20210830172627.267989-6-bigeasy@linutronix.de
      Reported-by: default avatarClark Williams <williams@redhat.com>
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Acked-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarAndrey Konovalov <andreyknvl@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d5d2c51f
    • Sebastian Andrzej Siewior's avatar
      kcov: avoid enable+disable interrupts if !in_task() · 22036abe
      Sebastian Andrzej Siewior authored
      
      
      kcov_remote_start() may need to allocate memory in the in_task() case
      (otherwise per-CPU memory has been pre-allocated) and therefore requires
      enabled interrupts.
      
      The interrupts are enabled before checking if the allocation is required
      so if no allocation is required then the interrupts are needlessly enabled
      and disabled again.
      
      Enable interrupts only if memory allocation is performed.
      
      Link: https://lkml.kernel.org/r/20210923164741.1859522-5-bigeasy@linutronix.de
      Link: https://lore.kernel.org/r/20210830172627.267989-5-bigeasy@linutronix.de
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Acked-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarAndrey Konovalov <andreyknvl@gmail.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      22036abe
    • Sebastian Andrzej Siewior's avatar
      kcov: allocate per-CPU memory on the relevant node · 741ddd45
      Sebastian Andrzej Siewior authored
      
      
      During boot kcov allocates per-CPU memory which is used later if remote/
      softirq processing is enabled.
      
      Allocate the per-CPU memory on the CPU local node to avoid cross node
      memory access.
      
      Link: https://lkml.kernel.org/r/20210923164741.1859522-4-bigeasy@linutronix.de
      Link: https://lore.kernel.org/r/20210830172627.267989-4-bigeasy@linutronix.de
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Acked-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarAndrey Konovalov <andreyknvl@gmail.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      741ddd45
    • Sebastian Andrzej Siewior's avatar
      Documentation/kcov: define `ip' in the example · 6f1d34bd
      Sebastian Andrzej Siewior authored
      
      
      The example code uses the variable `ip' but never declares it.
      
      Declare `ip' as a 64bit variable which is the same type as the array
      from which it loads its value.
      
      Link: https://lkml.kernel.org/r/20210923164741.1859522-3-bigeasy@linutronix.de
      Link: https://lore.kernel.org/r/20210830172627.267989-3-bigeasy@linutronix.de
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Acked-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarAndrey Konovalov <andreyknvl@gmail.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6f1d34bd
    • Sebastian Andrzej Siewior's avatar
      Documentation/kcov: include types.h in the example · d687a9cc
      Sebastian Andrzej Siewior authored
      
      
      Patch series "kcov: PREEMPT_RT fixup + misc", v2.
      
      The last patch in series is follow-up to address the PREEMPT_RT issue
      within in kcov reported by Clark [1].  Patches 1-3 are smaller things that
      I noticed while staring at it.  Patch 4 is small change which makes
      replacement in #5 simpler / more obvious.
      
      [1] https://lkml.kernel.org/r/20210809155909.333073de@theseus.lan
      
      This patch (of 5):
      
      The first example code has includes at the top, the following two
      example share that part. The last example (remote coverage collection)
      requires the linux/types.h header file due its __aligned_u64 usage.
      
      Add the linux/types.h to the top most example and a comment that the
      header files from above are required as it is done in the second
      example.
      
      Link: https://lkml.kernel.org/r/20210923164741.1859522-1-bigeasy@linutronix.de
      Link: https://lore.kernel.org/r/20210830172627.267989-2-bigeasy@linutronix.de
      Link: https://lkml.kernel.org/r/20210923164741.1859522-2-bigeasy@linutronix.de
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Acked-by: default avatarMarco Elver <elver@google.com>
      Tested-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarAndrey Konovalov <andreyknvl@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Clark Williams <williams@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d687a9cc
    • Pavel Skripkin's avatar
      sysv: use BUILD_BUG_ON instead of runtime check · 7eb0e28c
      Pavel Skripkin authored
      There were runtime checks about sizes of struct v7_super_block and struct
      sysv_inode.  If one of these checks fail the kernel will panic.  Since
      these values are known at compile time let's use BUILD_BUG_ON(), because
      it's a standard mechanism for validation checking at build time
      
      Link: https://lkml.kernel.org/r/20210813123020.22971-1-paskripkin@gmail.com
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7eb0e28c
    • Ran Xiaokai's avatar
      kernel/fork.c: unshare(): use swap() to make code cleaner · ba1f70dd
      Ran Xiaokai authored
      
      
      Use swap() instead of reimplementing it.
      
      Link: https://lkml.kernel.org/r/20210909022046.8151-1-ran.xiaokai@zte.com.cn
      Signed-off-by: default avatarRan Xiaokai <ran.xiaokai@zte.com.cn>
      Cc: Gabriel Krisman Bertazi <krisman@collabora.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Alexey Gladkov <legion@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ba1f70dd
    • Muchun Song's avatar
      seq_file: fix passing wrong private data · 10a6de19
      Muchun Song authored
      DEFINE_PROC_SHOW_ATTRIBUTE() is supposed to be used to define a series
      of functions and variables to register proc file easily. And the users
      can use proc_create_data() to pass their own private data and get it
      via seq->private in the callback. Unfortunately, the proc file system
      use PDE_DATA() to get private data instead of inode->i_private. So fix
      it. Fortunately, there only one user of it which does not pass any
      private data, so this bug does not break any in-tree codes.
      
      Link: https://lkml.kernel.org/r/20211029032638.84884-1-songmuchun@bytedance.com
      Fixes: 97a32539
      
       ("proc: convert everything to "struct proc_ops"")
      Signed-off-by: default avatarMuchun Song <songmuchun@bytedance.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Florent Revest <revest@chromium.org>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      10a6de19
    • Andy Shevchenko's avatar
      seq_file: move seq_escape() to a header · 372904c0
      Andy Shevchenko authored
      
      
      Move seq_escape() to the header as inliner, for a small kernel text size
      reduction.
      
      Link: https://lkml.kernel.org/r/20211001122917.67228-1-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      372904c0
    • Ye Guojin's avatar
      signal: remove duplicate include in signal.h · f2666368
      Ye Guojin authored
      
      
      'linux/string.h' included in 'signal.h' is duplicated.
      it's also included at line 7.
      
      Link: https://lkml.kernel.org/r/20211019024934.973008-1-ye.guojin@zte.com.cn
      Signed-off-by: default avatarYe Guojin <ye.guojin@zte.com.cn>
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f2666368
    • Ye Guojin's avatar
      crash_dump: remove duplicate include in crash_dump.h · a10677a0
      Ye Guojin authored
      In crash_dump.h, header file <linux/pgtable.h> is included twice.  This
      duplication was introduced in commit 65fddcfc
      
      ("mm: reorder includes
      after introduction of linux/pgtable.h") where the order of the header
      files is adjusted, while the old one was not removed.
      
      Clean it up here.
      
      Link: https://lkml.kernel.org/r/20211020090659.1038877-1-ye.guojin@zte.com.cn
      Signed-off-by: default avatarYe Guojin <ye.guojin@zte.com.cn>
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Acked-by: default avatarBaoquan He <bhe@redhat.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: Changcheng Deng <deng.changcheng@zte.com.cn>
      Cc: Simon Horman <horms@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a10677a0
    • Changcheng Deng's avatar
      crash_dump: fix boolreturn.cocci warning · 5605f419
      Changcheng Deng authored
      
      
      ./include/linux/crash_dump.h: 119: 50-51: WARNING: return of 0/1 in
      function 'is_kdump_kernel' with return type bool
      
      Return statements in functions returning bool should use true/false
      instead of 1/0.
      
      Link: https://lkml.kernel.org/r/20211020083905.1037952-1-deng.changcheng@zte.com.cn
      Signed-off-by: default avatarChangcheng Deng <deng.changcheng@zte.com.cn>
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Acked-by: default avatarBaoquan He <bhe@redhat.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Mike Rapoport <rppt@linux.ibm.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: Ye Guojin <ye.guojin@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5605f419
    • Arnd Bergmann's avatar
      hfs/hfsplus: use WARN_ON for sanity check · 55d1cbbb
      Arnd Bergmann authored
      
      
      gcc warns about a couple of instances in which a sanity check exists but
      the author wasn't sure how to react to it failing, which makes it look
      like a possible bug:
      
        fs/hfsplus/inode.c: In function 'hfsplus_cat_read_inode':
        fs/hfsplus/inode.c:503:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          503 |                         /* panic? */;
              |                                     ^
        fs/hfsplus/inode.c:524:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          524 |                         /* panic? */;
              |                                     ^
        fs/hfsplus/inode.c: In function 'hfsplus_cat_write_inode':
        fs/hfsplus/inode.c:582:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          582 |                         /* panic? */;
              |                                     ^
        fs/hfsplus/inode.c:608:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          608 |                         /* panic? */;
              |                                     ^
        fs/hfs/inode.c: In function 'hfs_write_inode':
        fs/hfs/inode.c:464:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          464 |                         /* panic? */;
              |                                     ^
        fs/hfs/inode.c:485:37: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
          485 |                         /* panic? */;
              |                                     ^
      
      panic() is probably not the correct choice here, but a WARN_ON
      seems appropriate and avoids the compile-time warning.
      
      Link: https://lkml.kernel.org/r/20210927102149.1809384-1-arnd@kernel.org
      Link: https://lore.kernel.org/all/20210322223249.2632268-1-arnd@kernel.org/
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jan Kara <jack@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      55d1cbbb
    • Ryusuke Konishi's avatar
      nilfs2: remove filenames from file comments · 94ee1d91
      Ryusuke Konishi authored
      
      
      Remove filenames that are not particularly useful in file comments, and
      suppress checkpatch warnings
      
        WARNING: It's generally not useful to have the filename in the file
      
      Link: https://lkml.kernel.org/r/1635151862-11547-3-git-send-email-konishi.ryusuke@gmail.com
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: Qing Wang <wangqing@vivo.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      94ee1d91
    • Qing Wang's avatar
      nilfs2: replace snprintf in show functions with sysfs_emit · 3bcd6c5b
      Qing Wang authored
      
      
      Patch series "nilfs2 updates".
      
      This patch (of 2):
      
      coccicheck complains about the use of snprintf() in sysfs show functions.
      
      Fix the coccicheck warning:
      
        WARNING: use scnprintf or sprintf.
      
      Use sysfs_emit instead of scnprintf or sprintf makes more sense.
      
      Link: https://lkml.kernel.org/r/1635151862-11547-1-git-send-email-konishi.ryusuke@gmail.com
      Link: https://lkml.kernel.org/r/1634095759-4625-1-git-send-email-wangqing@vivo.com
      Link: https://lkml.kernel.org/r/1635151862-11547-2-git-send-email-konishi.ryusuke@gmail.com
      Signed-off-by: default avatarQing Wang <wangqing@vivo.com>
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3bcd6c5b
    • Jan Harkes's avatar
      coda: bump module version to 7.2 · 98d5b61e
      Jan Harkes authored
      
      
      Helps with tracking which patches have been propagated upstream and if
      users are running the latest known version.
      
      Link: https://lkml.kernel.org/r/20210908140308.18491-10-jaharkes@cs.cmu.edu
      Signed-off-by: default avatarJan Harkes <jaharkes@cs.cmu.edu>
      Cc: Alex Shi <alex.shi@linux.alibaba.com>
      Cc: Jing Yangyang <jing.yangyang@zte.com.cn>
      Cc: Xin Tan <tanxin.ctf@gmail.com>
      Cc: Xiyu Yang <xiyuyang19@fudan.edu.cn>
      Cc: Zeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      98d5b61e
    • Jing Yangyang's avatar
      coda: use vmemdup_user to replace the open code · 118b7ee1
      Jing Yangyang authored
      
      
      vmemdup_user is better than duplicating its implementation, So just
      replace the open code.
      
        fs/coda/psdev.c:125:10-18:WARNING:opportunity for vmemdup_user
      
      The issue is detected with the help of Coccinelle.
      
      Link: https://lkml.kernel.org/r/20210908140308.18491-9-jaharkes@cs.cmu.edu
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarJing Yangyang <jing.yangyang@zte.com.cn>
      Signed-off-by: default avatarJan Harkes <jaharkes@cs.cmu.edu>
      Cc: Alex Shi <alex.shi@linux.alibaba.com>
      Cc: Xin Tan <tanxin.ctf@gmail.com>
      Cc: Xiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      118b7ee1
    • Xiyu Yang's avatar
      coda: convert from atomic_t to refcount_t on coda_vm_ops->refcnt · 1077c285
      Xiyu Yang authored
      
      
      refcount_t type and corresponding API can protect refcounters from
      accidental underflow and overflow and further use-after-free situations.
      
      Link: https://lkml.kernel.org/r/20210908140308.18491-8-jaharkes@cs.cmu.edu
      Signed-off-by: default avatarXiyu Yang <xiyuyang19@fudan.edu.cn>
      Signed-off-by: default avatarXin Tan <tanxin.ctf@gmail.com>
      Signed-off-by: default avatarJan Harkes <jaharkes@cs.cmu.edu>
      Cc: Alex Shi <alex.shi@linux.alibaba.com>
      Cc: Jing Yangyang <jing.yangyang@zte.com.cn>
      Cc: Zeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1077c285
    • Jan Harkes's avatar
      coda: avoid doing bad things on inode type changes during revalidation · 5a646fb3
      Jan Harkes authored
      
      
      When Coda discovers an inconsistent object, it turns it into a symlink.
      However we can't just follow this change in the kernel on an existing file
      or directory inode that may still have references.
      
      This patch removes the inconsistent inode from the inode hash and
      allocates a new inode for the symlink object.
      
      Link: https://lkml.kernel.org/r/20210908140308.18491-7-jaharkes@cs.cmu.edu
      Signed-off-by: default avatarJan Harkes <jaharkes@cs.cmu.edu>
      Cc: Alex Shi <alex.shi@linux.alibaba.com>
      Cc: Jing Yangyang <jing.yangyang@zte.com.cn>
      Cc: Xin Tan <tanxin.ctf@gmail.com>
      Cc: Xiyu Yang <xiyuyang19@fudan.edu.cn>
      Cc: Zeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5a646fb3
    • Jan Harkes's avatar
      coda: avoid hidden code duplication in rename · b2e36228
      Jan Harkes authored
      
      
      We were actually fixing up the directory mtime in both branches after the
      negative dentry test, it was just that one branch was only flagging the
      directory inodes to refresh their attributes while the other branch used
      the optional optimization to set mtime to the current time and not go back
      to the Coda client.
      
      Link: https://lkml.kernel.org/r/20210908140308.18491-6-jaharkes@cs.cmu.edu
      Signed-off-by: default avatarJan Harkes <jaharkes@cs.cmu.edu>
      Cc: Alex Shi <alex.shi@linux.alibaba.com>
      Cc: Jing Yangyang <jing.yangyang@zte.com.cn>
      Cc: Xin Tan <tanxin.ctf@gmail.com>
      Cc: Xiyu Yang <xiyuyang19@fudan.edu.cn>
      Cc: Zeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b2e36228
    • Jan Harkes's avatar
      coda: avoid flagging NULL inodes · 76097eb7
      Jan Harkes authored
      
      
      Somehow we hit a negative dentry in coda_rename even after checking with
      d_really_is_positive.  Maybe something raced and turned the new_dentry
      negative while we were fixing up directory link counts.
      
      Link: https://lkml.kernel.org/r/20210908140308.18491-5-jaharkes@cs.cmu.edu
      Signed-off-by: default avatarJan Harkes <jaharkes@cs.cmu.edu>
      Cc: Alex Shi <alex.shi@linux.alibaba.com>
      Cc: Jing Yangyang <jing.yangyang@zte.com.cn>
      Cc: Xin Tan <tanxin.ctf@gmail.com>
      Cc: Xiyu Yang <xiyuyang19@fudan.edu.cn>
      Cc: Zeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      76097eb7
    • Alex Shi's avatar
      coda: remove err which no one care · b1deb685
      Alex Shi authored
      
      
      No one care 'err' in func coda_release, so better remove it.
      
      Link: https://lkml.kernel.org/r/20210908140308.18491-4-jaharkes@cs.cmu.edu
      Signed-off-by: default avatarAlex Shi <alex.shi@linux.alibaba.com>
      Signed-off-by: default avatarJan Harkes <jaharkes@cs.cmu.edu>
      Cc: Jing Yangyang <jing.yangyang@zte.com.cn>
      Cc: Xin Tan <tanxin.ctf@gmail.com>
      Cc: Xiyu Yang <xiyuyang19@fudan.edu.cn>
      Cc: Zeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b1deb685
    • Jan Harkes's avatar
      coda: check for async upcall request using local state · 3d8e72d9
      Jan Harkes authored
      
      
      Originally flagged by Smatch because the code implicitly assumed outSize
      is not NULL for non-async upcalls because of a flag that was (not) set in
      req->uc_flags.
      
      However req->uc_flags field is in shared state and although the current
      code will not allow it to be changed before the async request check the
      code is more robust when it tests against the local outSize variable.
      
      Link: https://lkml.kernel.org/r/20210908140308.18491-3-jaharkes@cs.cmu.edu
      Signed-off-by: default avatarJan Harkes <jaharkes@cs.cmu.edu>
      Cc: Alex Shi <alex.shi@linux.alibaba.com>
      Cc: Jing Yangyang <jing.yangyang@zte.com.cn>
      Cc: Xin Tan <tanxin.ctf@gmail.com>
      Cc: Xiyu Yang <xiyuyang19@fudan.edu.cn>
      Cc: Zeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3d8e72d9
    • Jan Harkes's avatar
      coda: avoid NULL pointer dereference from a bad inode · 18319cb4
      Jan Harkes authored
      
      
      Patch series "Coda updates for -next".
      
      The following patch series contains some fixes for the Coda kernel module
      I've had sitting around and were tested extensively in a development
      version of the Coda kernel module that lives outside of the main kernel.
      
      This patch (of 9):
      
      Avoid accessing coda_inode_info from a dentry with a bad inode.
      
      Link: https://lkml.kernel.org/r/20210908140308.18491-1-jaharkes@cs.cmu.edu
      Link: https://lkml.kernel.org/r/20210908140308.18491-2-jaharkes@cs.cmu.edu
      Signed-off-by: default avatarJan Harkes <jaharkes@cs.cmu.edu>
      Cc: Alex Shi <alex.shi@linux.alibaba.com>
      Cc: Jing Yangyang <jing.yangyang@zte.com.cn>
      Cc: Xin Tan <tanxin.ctf@gmail.com>
      Cc: Xiyu Yang <xiyuyang19@fudan.edu.cn>
      Cc: Zeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      18319cb4
    • Andrew Halaney's avatar
      init: make unknown command line param message clearer · 8bc2b3dc
      Andrew Halaney authored
      The prior message is confusing users, which is the exact opposite of the
      goal.  If the message is being seen, one of the following situations is
      happening:
      
       1. the param is misspelled
       2. the param is not valid due to the kernel configuration
       3. the param is intended for init but isn't after the '--'
          delineator on the command line
      
      To make that more clear to the user, explicitly mention "kernel command
      line" and also note that the params are still passed to user space to
      avoid causing any alarm over params intended for init.
      
      Link: https://lkml.kernel.org/r/20211013223502.96756-1-ahalaney@redhat.com
      Fixes: 86d1919a
      
       ("init: print out unknown kernel parameters")
      Signed-off-by: default avatarAndrew Halaney <ahalaney@redhat.com>
      Suggested-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Borislav Petkov <bp@suse.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8bc2b3dc
    • yangerkun's avatar
      ramfs: fix mount source show for ramfs · 0858d7da
      yangerkun authored
      
      
      ramfs_parse_param does not parse key "source", and will convert
      -ENOPARAM to 0. This will skip vfs_parse_fs_param_source in vfs_parse_fs_param, which
      lead always "none" mount source for ramfs.
      
      Fix it by parsing "source" in ramfs_parse_param like cgroup1_parse_param
      does.
      
      Link: https://lkml.kernel.org/r/20210924091756.1906118-1-yangerkun@huawei.com
      Signed-off-by: default avataryangerkun <yangerkun@huawei.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0858d7da
    • Kefeng Wang's avatar
      alpha: use is_kernel_text() helper · 2d93a583
      Kefeng Wang authored
      
      
      Use is_kernel_text() helper to simplify code.
      
      Link: https://lkml.kernel.org/r/20210930071143.63410-12-wangkefeng.wang@huawei.com
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2d93a583
    • Kefeng Wang's avatar
      microblaze: use is_kernel_text() helper · 4b5ef1e1
      Kefeng Wang authored
      
      
      Use is_kernel_text() helper to simplify code.
      
      Link: https://lkml.kernel.org/r/20210930071143.63410-11-wangkefeng.wang@huawei.com
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Acked-by: default avatarMichal Simek <michal.simek@xilinx.com>
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4b5ef1e1
    • Kefeng Wang's avatar
      powerpc/mm: use core_kernel_text() helper · 843a1ffa
      Kefeng Wang authored
      
      
      Use core_kernel_text() helper to simplify code, also drop etext, _stext,
      _sinittext, _einittext declaration which already declared in section.h.
      
      Link: https://lkml.kernel.org/r/20210930071143.63410-10-wangkefeng.wang@huawei.com
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      843a1ffa
    • Kefeng Wang's avatar
      extable: use is_kernel_text() helper · 808b6456
      Kefeng Wang authored
      
      
      The core_kernel_text() should check the gate area, as it is part of kernel
      text range, use is_kernel_text() in core_kernel_text().
      
      Link: https://lkml.kernel.org/r/20210930071143.63410-9-wangkefeng.wang@huawei.com
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      808b6456
    • Kefeng Wang's avatar
      mm: kasan: use is_kernel() helper · 3298cbe8
      Kefeng Wang authored
      
      
      Directly use is_kernel() helper in kernel_or_module_addr().
      
      Link: https://lkml.kernel.org/r/20210930071143.63410-8-wangkefeng.wang@huawei.com
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Reviewed-by: default avatarAlexander Potapenko <glider@google.com>
      Reviewed-by: default avatarAndrey Konovalov <andreyknvl@gmail.com>
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3298cbe8
    • Kefeng Wang's avatar
      sections: provide internal __is_kernel() and __is_kernel_text() helper · 8f6e42e8
      Kefeng Wang authored
      
      
      An internal __is_kernel() helper which only check the kernel address
      ranges, and an internal __is_kernel_text() helper which only check text
      section ranges.
      
      Link: https://lkml.kernel.org/r/20210930071143.63410-7-wangkefeng.wang@huawei.com
      Signed-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8f6e42e8