From mboxrd@z Thu Jan 1 00:00:00 1970 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 3224DC433EF for ; Wed, 6 Oct 2021 12:43:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C145F61163 for ; Wed, 6 Oct 2021 12:43:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C145F61163 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 23849900002; Wed, 6 Oct 2021 08:43:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E7D36B0071; Wed, 6 Oct 2021 08:43:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0FF14900002; Wed, 6 Oct 2021 08:43:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0004.hostedemail.com [216.40.44.4]) by kanga.kvack.org (Postfix) with ESMTP id 002C46B006C for ; Wed, 6 Oct 2021 08:43:31 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A312E8249980 for ; Wed, 6 Oct 2021 12:43:31 +0000 (UTC) X-FDA: 78665978622.38.72A6084 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf14.hostedemail.com (Postfix) with ESMTP id 4C38A60037E5 for ; Wed, 6 Oct 2021 12:43:31 +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=SndI8mbN0sOnE3iDkNAWgoLxFDOHVcrnKdCKJdLyAJA=; b=JlqwGGaEoVJOQSRwDSnI0mC+RJ EoLmdMHR+JARTFsrFTUoRydWTkh1+3A1K9+1iEvkRqORQ1xn0+SnA8MxYTRSmCPqxxp7P+a6bWHoA 08z5sWtJWzepb18XT4oS6+sbzjKDm6ccgUfITZ5xsPh2l0pOZ9DMjfkGQxnV5WZiosM3lCj3+uvcX hGYINz4r3ObtMpsnAJruxJm6gp9CnPsqlLi4e8g2Ht+41cCPifG0ZOAlhbzs0gTuRIZ0lcBTvOxVC V8d4sZhRkbntYEcTniFOKjdbn6FlH9tGE9QwGOS0Tymabw7/Z+AnEQxAgJAddNSrgOpLq6IG2bmve 5HwvodVw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mY6Fg-000sVb-5Z; Wed, 06 Oct 2021 12:42:35 +0000 From: "Matthew Wilcox (Oracle)" To: Kees Cook Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Thomas Gleixner Subject: [PATCH v2 0/3] Assorted improvements to usercopy Date: Wed, 6 Oct 2021 13:42:23 +0100 Message-Id: <20211006124226.209484-1-willy@infradead.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=JlqwGGaE; spf=none (imf14.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-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4C38A60037E5 X-Stat-Signature: k6bxg1rgu1fxja9khj87catjs5b87isi X-HE-Tag: 1633524211-840051 Content-Transfer-Encoding: quoted-printable 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? 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) (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 | 42 +++++++++++++++++++++++--------- 3 files changed, 42 insertions(+), 11 deletions(-) --=20 2.32.0