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 A4F66C433EF for ; Tue, 5 Oct 2021 21:27:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 537CC61175 for ; Tue, 5 Oct 2021 21:27:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 537CC61175 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E72076B006C; Tue, 5 Oct 2021 17:27:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DFAD76B0071; Tue, 5 Oct 2021 17:27:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC2906B0073; Tue, 5 Oct 2021 17:27:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0233.hostedemail.com [216.40.44.233]) by kanga.kvack.org (Postfix) with ESMTP id BE0FA6B006C for ; Tue, 5 Oct 2021 17:27:48 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6CB64183D9803 for ; Tue, 5 Oct 2021 21:27:48 +0000 (UTC) X-FDA: 78663671016.29.E45CC81 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf03.hostedemail.com (Postfix) with ESMTP id 358213000204 for ; Tue, 5 Oct 2021 21:27:48 +0000 (UTC) Received: by mail-pf1-f177.google.com with SMTP id m14so602529pfc.9 for ; Tue, 05 Oct 2021 14:27:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kSjxsYY/n7+mi4kKCu/f0aGE8ROKNCwoOuOazhO16DQ=; b=DRhDies2QKFlxD45CRBQAzsejnf1+IyxYfsGJrmCWlbcHZyY5jq9hmWgba1uRAK/xy fESCwM/fNNWt40Em+i3FPt9WW9eWjZPp6hRap734jyNe/ZyrmEvkbaX55IC5W1YesnjN LN/yUvh95dzFhlkPUlpXruu0J8NQK+AKQWXWM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=kSjxsYY/n7+mi4kKCu/f0aGE8ROKNCwoOuOazhO16DQ=; b=DKVWmjzJlFxUUqDxwLpvuhonvwWbivzOFcI8PwebT3Yo0BWOhzRdkGK/f/BE5bNBOI jc6ybBEXL6Hw0TXM1P2GKaDuzuv23JkNxWPEAXqQQoy9P0uAe97S71eomfOQX8enWkaB I/8LXkVXQWJ1ioH5aQuLREa1nfknIN/S6gca2DGyRxnS25RBHXkx0DdQxEOI66dkwpTN S7Tqyg6c39ELDRg4vVhelfRErn+PvhAeZfP1Q9fgPcaCugii2qk9DSE2p8cLJMt7Em6t BFUhk8sGHhBrk1jEdC9iHkinc3nI93vqUjFGeojcSQhwglguGLYzXlzEQ47RTikIJCEU SKTQ== X-Gm-Message-State: AOAM5327V8+0itu0++bZz8du31IhEYRjTzTQiXt9ClOjFlBSs5YydUrl V42a0unldUircoz/pBagr4tt0w== X-Google-Smtp-Source: ABdhPJzUBCYsXZpJhiXL1iqDOeS+I4fV5+ChQ9I1UBjIiLBtjm6ZDALiApz0oVJbIywN1u5KByDwqQ== X-Received: by 2002:a05:6a00:23cb:b0:44b:95a5:36df with SMTP id g11-20020a056a0023cb00b0044b95a536dfmr34247372pfc.28.1633469267223; Tue, 05 Oct 2021 14:27:47 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e14sm18112300pga.23.2021.10.05.14.27.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Oct 2021 14:27:46 -0700 (PDT) Date: Tue, 5 Oct 2021 14:27:46 -0700 From: Kees Cook To: "Matthew Wilcox (Oracle)" Cc: linux-mm@kvack.org, Thomas Gleixner Subject: Re: [PATCH 0/3] Assorted improvements to usercopy Message-ID: <202110051426.11E5102F6@keescook> References: <20211004224224.4137992-1-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211004224224.4137992-1-willy@infradead.org> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 358213000204 X-Stat-Signature: jdmanyy9d6xmw6nk9urijddpi147ysko Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=DRhDies2; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf03.hostedemail.com: domain of keescook@chromium.org designates 209.85.210.177 as permitted sender) smtp.mailfrom=keescook@chromium.org X-HE-Tag: 1633469268-52188 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: On Mon, Oct 04, 2021 at 11:42:20PM +0100, Matthew Wilcox (Oracle) wrote: > 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 Thanks! This is a nice additional bit of checking. I wonder if the CMA and Reserved pieces should be extracted from the PAGESPAN check too? Probably that CONFIG should be renamed as well now. :P -Kees > > arch/x86/include/asm/highmem.h | 1 + > include/linux/highmem-internal.h | 10 ++++++++++ > mm/usercopy.c | 33 +++++++++++++++++++++----------- > 3 files changed, 33 insertions(+), 11 deletions(-) > > -- > 2.32.0 > -- Kees Cook