uprobes: Fix handle_swbp() vs. unregister() + register() race once more
Andrea Parri authored
commit 09d3f015 upstream.

Commit:

  142b18dd

 ("uprobes: Fix handle_swbp() vs unregister() + register() race")

added the UPROBE_COPY_INSN flag, and corresponding smp_wmb() and smp_rmb()
memory barriers, to ensure that handle_swbp() uses fully-initialized
uprobes only.

However, the smp_rmb() is mis-placed: this barrier should be placed
after handle_swbp() has tested for the flag, thus guaranteeing that
(program-order) subsequent loads from the uprobe can see the initial
stores performed by prepare_uprobe().

Move the smp_rmb() accordingly.  Also amend the comments associated
to the two memory barriers to indicate their actual locations.
Signed-off-by: default avatarAndrea Parri <andrea.parri@amarulasolutions.com>
Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: ...
8d3ab1cc
Name Last commit Last update
Documentation x86/speculation: Provide IBPB always command line options
arch ARM: dts: rockchip: Remove @0 from the veyron memory node
block SCSI: fix queue cleanup race before queue initialization is done
certs Replace magic for trusting the secondary keyring with #define
crypto crypto: simd - correctly take reqsize of wrapped skcipher into account
drivers iser: set sector for ambiguous mr status errors
firmware License cleanup: add SPDX GPL-2.0 license identifier to files with no license
fs kernfs: Replace strncpy with memcpy
include x86/speculation: Add prctl() control for indirect branch speculation
init init: rename and re-order boot_cpu_state_init()
ipc ipc/sem.c: prevent queue.status tearing in semop
kernel uprobes: Fix handle_swbp() vs. unregister() + register() race once more
lib kobject: Replace strncpy with memcpy
mm mm: use swp_offset as key in shmem_replace_page()
net ip_tunnel: Fix name string concatenate in __ip_tunnel_create()
samples samples/bpf: Check the error of write() and read()
scripts unifdef: use memcpy instead of strncpy
security ima: re-initialize iint->atomic_flags
sound ALSA: intel_hdmi: Use strlcpy() instead of strncpy()
tools tools/power/cpupower: fix compilation with STATIC=true
usr initramfs: fix initramfs rebuilds w/ compression after disabling
virt KVM: arm64: Fix caching of host MDCR_EL2 value
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore Add hch to .get_maintainer.ignore
.gitattributes .gitattributes: set git diff driver for C source code files
.gitignore kbuild: rpm-pkg: keep spec file until make mrproper
.mailmap .mailmap: Add Maciej W. Rozycki's Imagination e-mail address
COPYING [PATCH] update FSF address in COPYING
CREDITS MAINTAINERS: update TPM driver infrastructure changes
Kbuild License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Kconfig License cleanup: add SPDX GPL-2.0 license identifier to files with no license
MAINTAINERS MAINTAINERS: Add Sasha as a stable branch maintainer
Makefile disable stringop truncation warnings for now
README README: add a new README file, pointing to the Documentation/
Linux kernel
============

This file was moved to Documentation/admin-guide/README.rst

Please notice that there are several guides for kernel developers and users.
These guides can be rendered in a number of formats, like HTML and PDF.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.

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.