From patchwork Thu Dec 16 21:53:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12682803 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E813EC433F5 for ; Thu, 16 Dec 2021 21:54:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 499C36B0074; Thu, 16 Dec 2021 16:54:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 441E06B0071; Thu, 16 Dec 2021 16:54:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22C0C6B0071; Thu, 16 Dec 2021 16:54:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0254.hostedemail.com [216.40.44.254]) by kanga.kvack.org (Postfix) with ESMTP id F379B6B0071 for ; Thu, 16 Dec 2021 16:54:07 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BE585180ABF4A for ; Thu, 16 Dec 2021 21:53:57 +0000 (UTC) X-FDA: 78925010514.06.52428A7 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf08.hostedemail.com (Postfix) with ESMTP id 48B2D160017 for ; Thu, 16 Dec 2021 21:53:53 +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=OLGRXuT0pDEzu7k+efSS+/dptga/8chhdLo/ynoHfRo=; b=ZM06qomPpfAx1Amg4RR29uGEkY 7AC45IvPUjCy9BUf3HzspVcicOujadOzVbkQtjeahZVARrOUJe8rMrXDK3qKRZWVPeJO2GZn4vxrZ uSdFmcwoiJutFSSFmGugIl0PZy/EvqJ93qfIEfBXEa9jY46GnPOprug9YIjEaDtl80Q7Ydsn9mWRu ezqYVMJFp3xy7VmZgKyEUvSu8TCOrFL5PBUrBnK/zdQw+mF2IM3dqEVMQJSe3VGS3y4KrNrzAPkJH JxFj2rXYS3dy4+F/frOGX/TedTr5CtbgvPVAK4wJPGoxoCDmZGPI/3/FVjbslRDbYRbRsDMXovTFF QVVGpuFQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxyhE-00FzY4-J5; Thu, 16 Dec 2021 21:53:52 +0000 From: "Matthew Wilcox (Oracle)" To: Kees Cook Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-hardening@vger.kernel.org Subject: [PATCH v4 0/4] Assorted improvements to usercopy Date: Thu, 16 Dec 2021 21:53:47 +0000 Message-Id: <20211216215351.3811471-1-willy@infradead.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ZM06qomP; dmarc=none; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 48B2D160017 X-Stat-Signature: ar9q7xcpnin5sig8nkchwfr7ii5z1zkr X-HE-Tag: 1639691633-926058 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: The HARDENED_USERCOPY_PAGESPAN config option is hard to turn on because much of the kernel uses non-compound high-order page allocations. This patchset extracts the valuable parts of HARDENED_USERCOPY_PAGESPAN and then removes the remainder. v4: - Add the fourth patch to remove HARDENED_USERCOPY_PAGESPAN v3: - Remove a now-unused variable v2: - Prevent a NULL pointer dereference when a vmalloc-range pointer doesn't have an associated allocation (me) - Report better offsets than "0" (Kees) Matthew Wilcox (Oracle) (4): mm/usercopy: Check kmap addresses properly mm/usercopy: Detect vmalloc overruns mm/usercopy: Detect compound page overruns usercopy: Remove HARDENED_USERCOPY_PAGESPAN arch/x86/include/asm/highmem.h | 1 + include/linux/highmem-internal.h | 10 ++++ mm/usercopy.c | 98 +++++++++----------------------- security/Kconfig | 13 +---- 4 files changed, 40 insertions(+), 82 deletions(-)