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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B81BAC433FE for ; Mon, 3 Oct 2022 22:49:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229639AbiJCWt3 (ORCPT ); Mon, 3 Oct 2022 18:49:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229525AbiJCWt2 (ORCPT ); Mon, 3 Oct 2022 18:49:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBD341FCD2; Mon, 3 Oct 2022 15:49:27 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 8299461211; Mon, 3 Oct 2022 22:49:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E595C433C1; Mon, 3 Oct 2022 22:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664837366; bh=599phx3z//XkaqQjtagJzQ7sjVck2S3daFrsAp1kj9Y=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=QLv5iS0E6SRGs4sM9XRL0BBZLUhIfUxSR8v33w/0yNOjsS7/zaa/J5pRp02CjSW1X BJMmIOfTmxPEIqnjt+aqWykwg2+4xJbqMPdPXKyfUuQrLlVT1ZhT3mb/MXcsAfkSte j3jI7s5J5kSjDMCX5HEe/KOsS15VJT/TyubjkJG/I3/JGhaYvBsglab9Og9m+jnu0U Ql9W4Szdv0tI0KTMxSVIa2tkETjjmq+WAulpSZ3QbGTRtw0VEe3Qa7dnlLKTq7/fnw 8nibutltZhCHc6zp6nAtolnV5KXm5a6jRN7mxWkvh9XL3C9OVbLEuzmZ4UpZubrtXQ x+CKQnZ2NO2dg== Message-ID: Date: Mon, 3 Oct 2022 15:49:18 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v2 22/39] mm: Don't allow write GUPs to shadow stack memory Content-Language: en-US To: Kees Cook , Rick Edgecombe Cc: x86@kernel.org, "H . Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H . J . Lu" , Jann Horn , Jonathan Corbet , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V . Shankar" , Weijiang Yang , "Kirill A . Shutemov" , joao.moreira@intel.com, John Allen , kcc@google.com, eranian@google.com, rppt@kernel.org, jamorris@linux.microsoft.com, dethoma@microsoft.com References: <20220929222936.14584-1-rick.p.edgecombe@intel.com> <20220929222936.14584-23-rick.p.edgecombe@intel.com> <202210031134.B0B6B37@keescook> From: Andy Lutomirski In-Reply-To: <202210031134.B0B6B37@keescook> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On 10/3/22 11:39, Kees Cook wrote: > On Thu, Sep 29, 2022 at 03:29:19PM -0700, Rick Edgecombe wrote: >> [...] >> Still allow FOLL_FORCE to write through shadow stack protections, as it >> does for read-only protections. > > As I asked in the cover letter: why do we need to add this for shstk? It > was a mistake for general memory. :P For debuggers, which use FOLL_FORCE, quite intentionally, to modify text. And once a debugger has ptrace write access to a target, shadow stacks provide exactly no protection -- ptrace can modify text and all registers. But /proc/.../mem may be a different story, and I'd be okay with having FOLL_PROC_MEM for legacy compatibility via /proc/.../mem and not allowing that to access shadow stacks. This does seem like it may not be very useful, though.