Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1322101rwd; Tue, 16 May 2023 15:35:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5m0Nz2S26XWGeBs+OSTBIgmQs+3mu2gwbHCNW9uxtnDrIp5r+OjbbRb+jIey7Qc2M2sRiS X-Received: by 2002:a05:6a21:3298:b0:104:beb4:da38 with SMTP id yt24-20020a056a21329800b00104beb4da38mr18930851pzb.35.1684276547712; Tue, 16 May 2023 15:35:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684276547; cv=none; d=google.com; s=arc-20160816; b=FfFTRZl8pq3lvbji2glvyWUVhi+9EXktBa28LHpTS7fVDFs9on25yVWd5JssZr/aDj nUXaqhs9J/LxvnGSRjfioVcBkMkBi9XbmLM117A7fh4n3DIHwunYAKCS8UUOPtJW1lz8 sY9LIMPDXdTKRkCPvqiACzxV8Qhlo+saqqhOZ5m9AjJMtusuv3FTysSBEdLeDhuWMULD AiBVLRnwPWGPRez7Ln+TF0NqrQHt4mVkK9g3SB8PPMa+FoiET4+h0M1u5Suiih0KYDPM QbSMJolx/nZ0CoDpLQutf9DRaGqaK86GTz/FARaRNiDfysY4syWOBP/633xQQhyMtfkD W1bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=AU+G8+xjWKVQ5QpMo/ZQtkQQPbKk/ob+AkurzetYB3A=; b=u6KHNHC5sGX9ri7SQ0oAe6AdXmt8NH92QADVrkeBkeZq1KGe8ZLYfvYqJVTCmY/uhf iUvm2gi5R9hp66aQ4RKwsimh15qBUzckqFpORVR7VJcd60X5vRwpShiYDzJQwr1V0POs sXV/iOgLhzdVLMVWfhaS8WFNHUcf3qXQs+YxfRvBxeAlgck77itRgQARmfNhugjltA3r jnsjg1rmplC8YaQv8OYS3rEQfWsYAHymWNAz8+JnIBf+rL5T6yiesfu816WoqH146eMF UTffdEPB+5gQE6dnAnB5IHgQmSvNksxqZQcmE1Sryp0I0Z/3mJYX1+y8AeqY7LHEEbFR QfeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=I+12tB8k; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n6-20020aa79846000000b0063f1582c50bsi21021524pfq.338.2023.05.16.15.35.34; Tue, 16 May 2023 15:35:47 -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=@google.com header.s=20221208 header.b=I+12tB8k; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230310AbjEPWY0 (ORCPT + 99 others); Tue, 16 May 2023 18:24:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229635AbjEPWYY (ORCPT ); Tue, 16 May 2023 18:24:24 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D1495BA0 for ; Tue, 16 May 2023 15:24:23 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-4d9b2045e1cso182a12.1 for ; Tue, 16 May 2023 15:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684275861; x=1686867861; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=AU+G8+xjWKVQ5QpMo/ZQtkQQPbKk/ob+AkurzetYB3A=; b=I+12tB8k6cmWXNu4K8IeyT6yX//Q7Lt11e1U3ivqkeeNZeBZsEkMyNEb257HXDCD/2 PIc8KE7K+G3HfXqeTtrQkxcylFnF/5nD16KKO7uUQseU9uhkiM3IOhP6SCc+F1aiSGF1 It+znTfuWuEtYPBXDJOi6/4iyA12Ty+0Puwk6l9QPMWjarCK5iqt0Fu+nr2+yFa1KLIJ z4LiEzTYlGNUBPhjuD6IMeJApIbg/QQMMOEGIRtIEJPAx3GLRnyGc+ZBOWrMAZblt0gX kfIk249OUMEGX3hdhtiR6QOY4uHtIbwdJ2mm+8Dqb109gAESymSqAXrAvsrF4sSSRZSf Od+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684275861; x=1686867861; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AU+G8+xjWKVQ5QpMo/ZQtkQQPbKk/ob+AkurzetYB3A=; b=VEvpKv4gVX8k3c0wdt51NOMHTO9zcU1GxbquylnnU69P5BVreMbgKUeOdNjISzrcOc w2FXPmCmrpRcZ0P/n4gHr6++A6pmXGDA4n2Q9Ty1Y907kvL62ghSOPvshfTpMtn5vdgG bnLLJJt6IYiRaQkQgo4Dk8mlVcyX/Cco4BfOeJYFht9TTJqS8PVirY8y8fHkTvTPv5Fq q0aav9pGbDW/G1Q2z8t2vXpkthAn9Ky22oJZDmbdWJGjmn0WXwPmVNHyFoyxWwqPAWz5 nmHGC0lAFojs7XTdj9CAD0I8jcn5oJe2A5TTEMER9eN0EdM/ZExqOLkK0frYQeEN1oTg E+XQ== X-Gm-Message-State: AC+VfDzL0KEDQooiYMoOoHpKiGro1rcw1mMsQs0vYHW2/HrFJ3SV/FwR VmBLffDl308Pz+eetHEy2R5ujHLbqHintNMMztEF/A== X-Received: by 2002:a50:99d3:0:b0:505:863:d85f with SMTP id n19-20020a5099d3000000b005050863d85fmr43123edb.4.1684275861049; Tue, 16 May 2023 15:24:21 -0700 (PDT) MIME-Version: 1.0 References: <20230515130553.2311248-1-jeffxu@chromium.org> <20230515130553.2311248-4-jeffxu@chromium.org> <202305161307.77B29D261@keescook> In-Reply-To: <202305161307.77B29D261@keescook> From: Jeff Xu Date: Tue, 16 May 2023 15:23:44 -0700 Message-ID: Subject: Re: [PATCH 3/6] PKEY: Apply PKEY_ENFORCE_API to mprotect To: Kees Cook Cc: jeffxu@chromium.org, dave.hansen@intel.com, luto@kernel.org, jorgelo@chromium.org, groeck@chromium.org, jannh@google.com, sroettger@google.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Tue, May 16, 2023 at 1:07=E2=80=AFPM Kees Cook w= rote: > > On Mon, May 15, 2023 at 01:05:49PM +0000, jeffxu@chromium.org wrote: > > From: Jeff Xu > > > > This patch enables PKEY_ENFORCE_API for the mprotect and > > mprotect_pkey syscalls. > > All callers are from userspace -- this change looks like a no-op? > Yes. All callers are from user space now. I am thinking about the future when someone adds a caller in kernel code and may miss the check. This is also consistent with munmap and other syscalls I plan to change. There are comments on do_mprotect_pkey() to describe how this flag is used. > -Kees > > -- > Kees Cook