No description
Find a file
Daniel Jordan 2b1207801c padata: validate cpumask without removed CPU during offline
commit 894c9ef978 upstream.

Configuring an instance's parallel mask without any online CPUs...

  echo 2 > /sys/kernel/pcrypt/pencrypt/parallel_cpumask
  echo 0 > /sys/devices/system/cpu/cpu1/online

...makes tcrypt mode=215 crash like this:

  divide error: 0000 [#1] SMP PTI
  CPU: 4 PID: 283 Comm: modprobe Not tainted 5.4.0-rc8-padata-doc-v2+ #2
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20191013_105130-anatol 04/01/2014
  RIP: 0010:padata_do_parallel+0x114/0x300
  Call Trace:
   pcrypt_aead_encrypt+0xc0/0xd0 [pcrypt]
   crypto_aead_encrypt+0x1f/0x30
   do_mult_aead_op+0x4e/0xdf [tcrypt]
   test_mb_aead_speed.constprop.0.cold+0x226/0x564 [tcrypt]
   do_test+0x28c2/0x4d49 [tcrypt]
   tcrypt_mod_init+0x55/0x1000 [tcrypt]
   ...

cpumask_weight() in padata_cpu_hash() returns 0 because the mask has no
CPUs.  The problem is __padata_remove_cpu() checks for valid masks too
early and so doesn't mark the instance PADATA_INVALID as expected, which
would have made padata_do_parallel() return error before doing the
division.

Fix by introducing a second padata CPU hotplug state before
CPUHP_BRINGUP_CPU so that __padata_remove_cpu() sees the online mask
without @cpu.  No need for the second argument to padata_replace() since
@cpu is now already missing from the online mask.

Fixes: 33e5445068 ("padata: Handle empty padata cpumasks")
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Eric Biggers <ebiggers@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-08-08 08:54:30 +02:00
arch powerpc/pseries: Fix regression while building external modules 2021-08-04 12:23:47 +02:00
block bdi: use bdi_dev_name() to get device name 2021-08-08 08:54:29 +02:00
certs
crypto
Documentation
drivers Revert "watchdog: iTCO_wdt: Account for rebooting on second timeout" 2021-08-08 08:54:29 +02:00
firmware
fs bdi: use bdi_dev_name() to get device name 2021-08-08 08:54:29 +02:00
include padata: validate cpumask without removed CPU during offline 2021-08-08 08:54:30 +02:00
init
ipc
kernel padata: validate cpumask without removed CPU during offline 2021-08-08 08:54:30 +02:00
lib
LICENSES
mm bdi: add a ->dev_name field to struct backing_dev_info 2021-08-08 08:54:29 +02:00
net Revert "Bluetooth: Shutdown controller after workqueues are flushed or cancelled" 2021-08-08 08:54:29 +02:00
samples
scripts kbuild: mkcompile_h: consider timestamp if KBUILD_BUILD_TIMESTAMP is set 2021-07-28 11:13:43 +02:00
security
sound ASoC: tlv320aic31xx: fix reversed bclk/wclk master bits 2021-08-08 08:54:29 +02:00
tools Revert "perf map: Fix dso->nsinfo refcounting" 2021-08-04 12:23:47 +02:00
usr
virt KVM: Use kvm_pfn_t for local PFN variable in hva_to_pfn_remapped() 2021-07-28 11:13:51 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile Linux 4.19.201 2021-08-04 12:23:47 +02:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
See Documentation/00-INDEX for a list of what is contained in each file.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.