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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BB18C433F5 for ; Sat, 26 Feb 2022 00:02:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8B1E78D0002; Fri, 25 Feb 2022 19:02:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 861CC8D0001; Fri, 25 Feb 2022 19:02:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 729508D0002; Fri, 25 Feb 2022 19:02:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id 60BCE8D0001 for ; Fri, 25 Feb 2022 19:02:03 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 242529878C for ; Sat, 26 Feb 2022 00:02:03 +0000 (UTC) X-FDA: 79182978126.19.A1D5B6A Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf23.hostedemail.com (Postfix) with ESMTP id 655F3140017 for ; Sat, 26 Feb 2022 00:02:01 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B68FCB833BF; Sat, 26 Feb 2022 00:01:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30787C340E7; Sat, 26 Feb 2022 00:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1645833718; bh=BooAGY/hhrBDZBSySQP/8P16m40+4PwEwwvGBs0SX8A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gEEIn0s5wBSEY2vhiOTZBAmbSkuLlHV/NRyR/Ow4IyirgPycAL6SEEekKPtmUZ2cJ QJFTrZbM28gkQL49MGfHQv6yabdQ0W+uMnXpOffr+8R8HGlGgt0CDNw83JJSs62A9W 5y5I1B/Y/mmocuqyUOijNkX1xbn5zzr4qvByDbH4= Date: Fri, 25 Feb 2022 16:01:57 -0800 From: Andrew Morton To: Kees Cook Cc: Matthew Wilcox , Josh Poimboeuf , linux-mm@kvack.org, Muhammad Usama Anjum , David Laight , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v3] usercopy: Check valid lifetime via stack depth Message-Id: <20220225160157.680ecdea21ce81183059bb63@linux-foundation.org> In-Reply-To: <20220225173345.3358109-1-keescook@chromium.org> References: <20220225173345.3358109-1-keescook@chromium.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 655F3140017 X-Stat-Signature: kjnedozhgnq97x9ft14zp37w3pe55mco Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=gEEIn0s5; spf=pass (imf23.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1645833721-765319 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, 25 Feb 2022 09:33:45 -0800 Kees Cook wrote: > Under CONFIG_HARDENED_USERCOPY=y, when exact stack frame boundary checking > is not available (i.e. everything except x86 with FRAME_POINTER), check > a stack object as being at least "current depth valid", in the sense > that any object within the stack region but not between start-of-stack > and current_stack_pointer should be considered unavailable (i.e. its > lifetime is from a call no longer present on the stack). > > Introduce ARCH_HAS_CURRENT_STACK_POINTER to track which architectures > have actually implemented the common global register alias. > > Additionally report usercopy bounds checking failures with an offset > from current_stack_pointer, which may assist with diagnosing failures. > > The LKDTM USERCOPY_STACK_FRAME_TO and USERCOPY_STACK_FRAME_FROM tests > (once slightly adjusted in a separate patch) will pass again with > this fixed. Again, what does this actually do? > Reported-by: Muhammad Usama Anjum A link to that report would shed some light. But actually describing the user-visible impact right there in the changelog is preferable. It sounds like a selftest is newly failing, which makes it a userspace-visible regression, perhaps? If so, do we have a Fixes: and is a cc:stable warranted?