Catalin Marinas 0e39aa9d50 UPSTREAM: arm64: Validate tagged addresses in access_ok() called from kernel threads
(Upstream commit df325e05a682e9c624f471835c35bd3f870d5e8c).

__range_ok(), invoked from access_ok(), clears the tag of the user
address only if CONFIG_ARM64_TAGGED_ADDR_ABI is enabled and the thread
opted in to the relaxed ABI. The latter sets the TIF_TAGGED_ADDR thread
flag. In the case of asynchronous I/O (e.g. io_submit()), the
access_ok() may be called from a kernel thread. Since kernel threads
don't have TIF_TAGGED_ADDR set, access_ok() will fail for valid tagged
user addresses. Example from the ffs_user_copy_worker() thread:

	use_mm(io_data->mm);
	ret = ffs_copy_to_iter(io_data->buf, ret, &io_data->data);
	unuse_mm(io_data->mm);

Relax the __range_ok() check to always untag the user address if called
in the context of a kernel thread. The user pointers would have already
been checked via aio_setup_rw() -> import_{single_range,iovec}() at the
time of the asynchronous I/O request.

Fixes: 63f0c6037965 ("arm64: Introduce prctl() options to control the tagged user addresses ABI")
Cc: <stable@vger.kernel.org> # 5.4.x-
Cc: Will Deacon <will@kernel.org>
Reported-by: Evgenii Stepanov <eugenis@google.com>
Tested-by: Evgenii Stepanov <eugenis@google.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Change-Id: Icfb58d6e03a85409b98a97bb570c8608cac4a3b1
Bug: 135692346
2019-12-11 17:15:20 +00:00
2019-12-01 09:36:51 +01:00
2018-09-10 09:21:07 +02:00
2019-12-05 15:48:19 +01:00
2019-12-05 15:48:19 +01:00
2019-08-06 19:15:25 +02:00
2019-12-05 15:48:19 +01:00
2019-12-05 15:48:19 +01:00
2019-12-05 15:48:19 +01:00
2019-12-05 15:38:34 +01:00
2019-12-01 09:36:51 +01:00
2018-02-13 12:53:38 +01:00
2019-12-05 15:48:19 +01:00

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.
Description
No description provided
Readme 1.4 GiB
Languages
C 98.1%
Assembly 1.2%
Makefile 0.3%