From patchwork Mon Oct 4 22:42:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12535075 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EF76C433F5 for ; Mon, 4 Oct 2021 22:43:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A167A61501 for ; Mon, 4 Oct 2021 22:43:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A167A61501 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id B798E940071; Mon, 4 Oct 2021 18:43:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B28B594000B; Mon, 4 Oct 2021 18:43:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3E8A940071; Mon, 4 Oct 2021 18:43:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id 9590794000B for ; Mon, 4 Oct 2021 18:43:39 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 599282CFFD for ; Mon, 4 Oct 2021 22:43:39 +0000 (UTC) X-FDA: 78660233358.17.4B7719A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id 0020C200282E for ; Mon, 4 Oct 2021 22:43:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=zKeQXBsFi+t1DFPnDZvEf88MDjkKHk19PfoJvH8/yZM=; b=wGIBZKO6U6SY5/pqk+BdO44vcJ aibJiih4LNv/nvKD7PibF7v2HqWom14/cxSvz+ECt5z5VyIxK0tsHeSwcWqGiotXMQn+G3QEDbPv8 s5Z5rQPtGnTYCyAWq92G24E13Bkvp0x55SUCZajOXydP8NxzHat/exxktUNsBn9ZdXT/kYZX3hMCm Qnf8B7bmP/qez5xo1i2ueNcoIVQ+H7ZEr9NTyHp4vZXgFgXKTiKO+1PxEuUIiarF4UAGRJdw+7Enu /F0fnrWzUT73H6Xw04FQvrwlj8LXexoDF1am4qPVA27R8Cvqpiq50zou6ro6l9a7EVLqqQQHV9eAl UB5XyqDw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXWfB-00HMUX-OT; Mon, 04 Oct 2021 22:42:33 +0000 From: "Matthew Wilcox (Oracle)" To: Kees Cook Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Thomas Gleixner Subject: [PATCH 0/3] Assorted improvements to usercopy Date: Mon, 4 Oct 2021 23:42:20 +0100 Message-Id: <20211004224224.4137992-1-willy@infradead.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 0020C200282E X-Stat-Signature: zg5f9xsfcnt7q9itc4spmwzqrwcunwke Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=wGIBZKO6; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1633387416-746005 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We must prohibit page boundary crossing for kmap() addresses. vmap() addresses are limited by the length of the mapping, and compound pages are limited by the size of the page. These should probably all have test cases? Matthew Wilcox (Oracle) (3): mm/usercopy: Check kmap addresses properly mm/usercopy: Detect vmalloc overruns mm/usercopy: Detect compound page overruns arch/x86/include/asm/highmem.h | 1 + include/linux/highmem-internal.h | 10 ++++++++++ mm/usercopy.c | 33 +++++++++++++++++++++----------- 3 files changed, 33 insertions(+), 11 deletions(-)