Go to file
Gao Xiang be617d2193 erofs: fix unsafe pagevec reuse of hooked pclusters
There are pclusters in runtime marked with Z_EROFS_PCLUSTER_TAIL
before actual I/O submission. Thus, the decompression chain can be
extended if the following pcluster chain hooks such tail pcluster.

As the related comment mentioned, if some page is made of a hooked
pcluster and another followed pcluster, it can be reused for in-place
I/O (since I/O should be submitted anyway):
 _______________________________________________________________
|  tail (partial) page |          head (partial) page           |
|_____PRIMARY_HOOKED___|____________PRIMARY_FOLLOWED____________|

However, it's by no means safe to reuse as pagevec since if such
PRIMARY_HOOKED pclusters finally move into bypass chain without I/O
submission. It's somewhat hard to reproduce with LZ4 and I just found
it (general protection fault) by ro_fsstressing a LZMA image for long
time.

I'm going to actively clean up related code together with multi-page
folio adaption in the next few months. Let's address it directly for
easier backporting for now.

Call trace for reference:
  z_erofs_decompress_pcluster+0x10a/0x8a0 [erofs]
  z_erofs_decompress_queue.isra.36+0x3c/0x60 [erofs]
  z_erofs_runqueue+0x5f3/0x840 [erofs]
  z_erofs_readahead+0x1e8/0x320 [erofs]
  read_pages+0x91/0x270
  page_cache_ra_unbounded+0x18b/0x240
  filemap_get_pages+0x10a/0x5f0
  filemap_read+0xa9/0x330
  new_sync_read+0x11b/0x1a0
  vfs_read+0xf1/0x190

Link: https://lore.kernel.org/r/20211103182006.4040-1-xiang@kernel.org
Fixes: 3883a79abd ("staging: erofs: introduce VLE decompression support")
Cc: <stable@vger.kernel.org> # 4.19+
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: Ieecf1f9ac4d2b2e1d285b7c157d9f37feddb79f7
2022-11-12 11:24:45 +00:00
android
arch arm64: config: enable exfat 2022-11-12 11:24:42 +00:00
block fs: ext4: fsync: optimize double-fsync() a bunch 2022-11-12 11:24:44 +00:00
certs
crypto crypto: move Jitter RNG header include dir 2022-11-12 11:23:16 +00:00
Documentation UPSTREAM: locking/lockdep: Add explanation to lock usage rules in lockdep design doc 2022-11-12 11:23:42 +00:00
drivers erofs: move from drivers/staging/ to fs/ 2022-11-12 11:24:45 +00:00
firmware
fs erofs: fix unsafe pagevec reuse of hooked pclusters 2022-11-12 11:24:45 +00:00
include erofs: move from drivers/staging/ to fs/ 2022-11-12 11:24:45 +00:00
init dma_buf: use kmem_cache pool for struct sync_file 2022-11-12 11:24:40 +00:00
ipc vm_ops: rename .split() callback to .may_split() 2022-11-12 11:21:26 +00:00
kernel do accept() in LIFO order for cache efficiency 2022-11-12 11:24:43 +00:00
lib HACK: lib: Compile out nmi_backtrace for ARM64 2022-11-12 11:24:32 +00:00
LICENSES
mm mm: Don't hog the CPU and zone lock in rmqueue_bulk() 2022-11-12 11:24:20 +00:00
net do accept() in LIFO order for cache efficiency 2022-11-12 11:24:43 +00:00
samples
scripts lto: Add Link Time Optimization support for GCC 2022-11-12 11:24:06 +00:00
security selinux: Avoid dynamic memory allocation for INITCONTEXTLEN buffers 2022-11-12 11:24:13 +00:00
sound ALSA: control_compat: Don't dynamically allocate single-use structs 2022-11-12 11:24:10 +00:00
techpack techpack: display: add some bp hints to hot paths 2022-11-12 11:24:41 +00:00
tools UPSTREAM: selftests/damon: support watermarks 2022-11-12 11:22:55 +00:00
usr
virt mm: treewide: remove unused address argument from pte_alloc functions 2022-11-12 11:21:18 +00:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore .gitignore: remove dts vendor 2022-11-12 11:19:05 +00:00
.gitmodules mkdtimg: Bundle upstream python rewrite as submodule 2022-11-12 11:19:02 +00:00
.mailmap
AndroidKernel.mk
build.config.aarch64
build.config.allmodconfig
build.config.allmodconfig.aarch64
build.config.allmodconfig.arm
build.config.allmodconfig.x86_64
build.config.arm
build.config.common
build.config.gki
build.config.gki_kasan
build.config.gki_kasan.aarch64
build.config.gki_kasan.x86_64
build.config.gki_kprobes
build.config.gki_kprobes.aarch64
build.config.gki_kprobes.x86_64
build.config.gki-debug.aarch64
build.config.gki-debug.x86_64
build.config.gki.aarch64
build.config.gki.x86_64
build.config.goldfish.arm
build.config.goldfish.arm64
build.config.goldfish.mips
build.config.goldfish.mips64
build.config.goldfish.x86
build.config.goldfish.x86_64
build.config.x86_64
COPYING
CREDITS
gen_headers_arm64.bp net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
gen_headers_arm.bp net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
Kbuild
Kconfig
kernel_headers.py
MAINTAINERS BACKPORT: trace: events: add devfreq trace event file 2022-11-12 11:24:24 +00:00
Makefile Makefile: Enable opaque pointers mode 2022-11-12 11:24:35 +00:00
OWNERS
README
verity_dev_keys.x509

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.