The source for the Linux kernel used in Windows Subsystem for Linux 2 (WSL2)
Перейти к файлу
Mikulas Patocka d4252071b9 add barriers to buffer_uptodate and set_buffer_uptodate
Let's have a look at this piece of code in __bread_slow:

	get_bh(bh);
	bh->b_end_io = end_buffer_read_sync;
	submit_bh(REQ_OP_READ, 0, bh);
	wait_on_buffer(bh);
	if (buffer_uptodate(bh))
		return bh;

Neither wait_on_buffer nor buffer_uptodate contain any memory barrier.
Consequently, if someone calls sb_bread and then reads the buffer data,
the read of buffer data may be executed before wait_on_buffer(bh) on
architectures with weak memory ordering and it may return invalid data.

Fix this bug by adding a memory barrier to set_buffer_uptodate and an
acquire barrier to buffer_uptodate (in a similar way as
folio_test_uptodate and folio_mark_uptodate).

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-08-09 15:03:02 -07:00
Documentation NFSD 6.0 Release Notes 2022-08-09 14:56:49 -07:00
LICENSES
arch Fixes include: 2022-08-09 09:39:25 -07:00
block block: convert to advancing variants of iov_iter_get_pages{,_alloc}() 2022-08-08 22:37:22 -04:00
certs
crypto iov_iter stuff, part 2, rebased 2022-08-08 20:04:35 -07:00
drivers iov_iter stuff, part 2, rebased 2022-08-08 20:04:35 -07:00
fs NFSD 6.0 Release Notes 2022-08-09 14:56:49 -07:00
include add barriers to buffer_uptodate and set_buffer_uptodate 2022-08-09 15:03:02 -07:00
init Modules updates for 6.0 2022-08-08 14:12:19 -07:00
io_uring
ipc Updates to various subsystems which I help look after. lib, ocfs2, 2022-08-07 10:03:24 -07:00
kernel remoteproc updates for v5.20 2022-08-08 15:16:29 -07:00
lib iov_iter stuff, part 2, rebased 2022-08-08 20:04:35 -07:00
mm memblock updates for v5.20 2022-08-09 09:48:30 -07:00
net NFSD 6.0 Release Notes 2022-08-09 14:56:49 -07:00
samples Tracing updates for 5.20 / 6.0 2022-08-05 09:41:12 -07:00
scripts Modules updates for 6.0 2022-08-08 14:12:19 -07:00
security
sound sound updates for 6.0-rc1 2022-08-06 10:19:51 -07:00
tools memblock updates for v5.20 2022-08-09 09:48:30 -07:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap Updates to various subsystems which I help look after. lib, ocfs2, 2022-08-07 10:03:24 -07:00
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS 12 server fixes, including for oopses, memory leaks and adding a channel lock 2022-08-08 20:15:13 -07:00
Makefile
README

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.

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.