Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3489162rwb; Mon, 3 Oct 2022 16:12:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5wFB+CL3ycbdVGstdbKI2YYa2v0/danRzbJq6KGYVlzIk0+D0WZJgnzVyUoPxqUsmaBQEs X-Received: by 2002:a63:2215:0:b0:43b:e00f:7c7b with SMTP id i21-20020a632215000000b0043be00f7c7bmr20868356pgi.511.1664838763902; Mon, 03 Oct 2022 16:12:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664838763; cv=none; d=google.com; s=arc-20160816; b=nPP3VZpg1wqg7uO/4zP9zs9uvO+YccQVb/b9+CkzLZLOVY+SMbHrtNhC1axmoVh3fP UePtcxlkr3XmQ5f/0UBfCmSEMchbUULtZF9O8AaKlKalaTPJEB3yJcVnyUrGtrIHBewx qMBWxa45jBEIrPBJNoDRKrHOTmvZuz50X9BfvnOpLory8lftNgerX27jYMfsJmsL+TVn VQ/DoB2tF4/2ggV4+EkxurFsJDQrPWp2FUYmMIcK6OMFvjx59Y9nx3ho9ZbLDatNBYjB 9KjDVxSiQJhVfITQ+VXpq/g3aGVb/XElfEvn2mCqfbOHCmdR5b1opbXLJ+2jXE0zvQIc T+Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=w3P7y9h3VIo1wE5vcVcK1pkxBHCnCSgYW2QVUeCO0Co=; b=XcHjUZObZLaBeGCXHvAm7SpZeZm7g7vsGxit0kDlfG6RFyeFz/uRA36HziFfwfV8FN MXPvSDYK6AqfZgRvMVHWdTiORox+0bU90jOzqiHsHeyFheM4YcHyKNMp8pRY7c+mWbD/ r/T6x+aaRSevYBSEz3tftS8vUTlmkwRctP8W/X74IeSRcbs6qJ1WqqyDx3Zh98otwjBu WTGfcmSt7/IP0qlrl3DlAvWXkNkcgQW85zJ0hybvi5eKT1+qBDKa3zXIbBoT8kgfL6LZ AyqR9TkBrxNjsKu9q7XZ7kQ2JPG0VrNrscKgVtNaRjxjWlXvU66TplOeL/XLC+fS4f9n BvUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QLv5iS0E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e20-20020a170902e0d400b001786b70f913si9391405pla.164.2022.10.03.16.12.32; Mon, 03 Oct 2022 16:12:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QLv5iS0E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229529AbiJCWtb (ORCPT + 99 others); Mon, 3 Oct 2022 18:49:31 -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 X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.