Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1196374rwd; Tue, 16 May 2023 13:18:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7HJYPIaI3AktVDZ65WbtGY3O47pdWPhkq6gtar10E4cOkfQ9AIZ7jDbFBvVkxm/diTPY1y X-Received: by 2002:a17:902:ba86:b0:1a6:bd5c:649d with SMTP id k6-20020a170902ba8600b001a6bd5c649dmr35718581pls.56.1684268287277; Tue, 16 May 2023 13:18:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684268287; cv=none; d=google.com; s=arc-20160816; b=qGx2/SdrihEX/dsknQX9DRgq+kHVDdp0BHLqIVOnBCXKtU5j2qvQzFppb7uoVyq7nS qSwX339/hGnbEMnGNgFGw9BorsCOp9Vell+OS1a8x9lGzqYrIa7sbfdZ4uW2FbIUfk1e yFDjqJTIardAWYBsmrszvRqbF6mes51kmGkBQZmy9aMTjHt0s0uDSXnPShY4KbyD8l20 I537niPWOW97aSdC/qCSETFjb4c0wLcKxXTyWbj+NoU4XnpmXrYirnsHoi2X3PbSPW2V CJCjqnSQdk4IEenTbUC7ry4m/9uHto/lwzRXdzqKC4MhPWF97K17KXilfRtPF0NIU4Vl iv8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=u/V262qUw8XfF74g/94L9IkQoQb0N+5s9JpBNYIOMEA=; b=UX8h4dfw/3a9sqkLn4daSQOg8cQXyBlNhQtoGw+M2jkQzdHmUGLckX7qPh8o15qL33 iPoQFRmPVEI1/Wb526074Fx88rQc6ATVyKZ/HARiJ1bucVbdyi7wn1cpoEREDvHbH8H7 tf2FAOvdM3/7ATtGxj4ifFAjGraC65ezKMlTmvF4AcCSnUI8T1njx/20qVFW+kNGDwXY YpO6k7GshJ9txu3bV0LDZWYQoG6WuaS/QQap9auXXOMM5IDmFMkpt2DEeKK8JHwKKrlj N3alMduGlibzGuyOELOo+3x7O9hv3ut7hM+gaZtxxu2K4a/w3HRFlUFnp+TyPk1ssjbf fckQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bnALCqwx; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a13-20020a170902eccd00b001ac5896c746si20655899plh.329.2023.05.16.13.17.52; Tue, 16 May 2023 13:18:07 -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=@chromium.org header.s=google header.b=bnALCqwx; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229957AbjEPUIt (ORCPT + 99 others); Tue, 16 May 2023 16:08:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbjEPUIr (ORCPT ); Tue, 16 May 2023 16:08:47 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E8DE6EB5 for ; Tue, 16 May 2023 13:08:45 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2533d74895bso78470a91.0 for ; Tue, 16 May 2023 13:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684267725; x=1686859725; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=u/V262qUw8XfF74g/94L9IkQoQb0N+5s9JpBNYIOMEA=; b=bnALCqwxahspYiDsnD2PGqKtgwldIRdNo0VP23zL3wOvjH/is3DvQ9CoNkXBPWId9S NoVsQmQhLs4CWxtdpZ1ESPDhZotmLPf7b6pt0ngExFaKxyE3s/NaYNMXxrovY94oSM/h bLxopQw8iITqoQAiG/LEFjSNUhdlf6rH6bGqA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684267725; x=1686859725; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=u/V262qUw8XfF74g/94L9IkQoQb0N+5s9JpBNYIOMEA=; b=Hajk/iDQg1kdbdtQ217wIiAGcRqdrV7CICUfXltUJT0HK10P8BdlpoJDG/StW5jB/2 7ef5LfFp6nJY0jINLM9OUWUhwP2Dtd1vrrO1OCQ0Et3NLUyg72W5SlbRqQX1/1CPVre2 7TqZaernRcC2srq9Xmg4rkba+XznpvQ3p/foHABiuJ4sM/M6tzanqxLIqXGvCh7HZGAj u9qkv7S0mlo3Tg+k7/aZmRuZmr2a+lwqADn/e1rr4BRm3ffSg4ccE3dR5H7mWDLWR0u6 Qa6TCYCMRWC4g8xXYcktj3zz7eSecSvsfyIZgEKTbJBdzASdHhd/j1CCfdjNM/yQ5Lyp B2yg== X-Gm-Message-State: AC+VfDx4573CaaVex90oUVvNc0aP/GNCsDHbuwfeVzDeuUk/KAqQzYaT OaZPzmUgfSr4nBdcKKPSI0pXtg== X-Received: by 2002:a17:90b:234f:b0:250:2d63:7b79 with SMTP id ms15-20020a17090b234f00b002502d637b79mr39485711pjb.43.1684267725084; Tue, 16 May 2023 13:08:45 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id c6-20020a170902c1c600b001a194df5a58sm15983487plc.167.2023.05.16.13.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 13:08:44 -0700 (PDT) Date: Tue, 16 May 2023 13:08:44 -0700 From: Kees Cook To: jeffxu@chromium.org Cc: dave.hansen@intel.com, luto@kernel.org, jorgelo@chromium.org, groeck@chromium.org, jannh@google.com, sroettger@google.com, akpm@linux-foundation.org, jeffxu@google.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 0/6] Memory Mapping (VMA) protection using PKU - set 1 Message-ID: <202305161307.4A16BB6A47@keescook> References: <20230515130553.2311248-1-jeffxu@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230515130553.2311248-1-jeffxu@chromium.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Mon, May 15, 2023 at 01:05:46PM +0000, jeffxu@chromium.org wrote: > This patch introduces a new flag, PKEY_ENFORCE_API, to the pkey_alloc() > function. When a PKEY is created with this flag, it is enforced that any > thread that wants to make changes to the memory mapping (such as mprotect) > of the memory must have write access to the PKEY. PKEYs created without > this flag will continue to work as they do now, for backwards > compatibility. > > Only PKEY created from user space can have the new flag set, the PKEY > allocated by the kernel internally will not have it. In other words, > ARCH_DEFAULT_PKEY(0) and execute_only_pkey won’t have this flag set, > and continue work as today. Cool! Yeah, this looks like it could become quite useful. I assume V8 folks are on board with this API, etc? > This set of patch covers mprotect/munmap, I plan to work on other > syscalls after this. Which ones are on your list currently? -- Kees Cook