Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3480919rwb; Fri, 16 Dec 2022 15:59:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf5f6mq/NUUyrHYWpx7bSHxCvNhKsUMSY962Q6TrXq1UBh7eTn7iTwwQv0mKeTGeonwX7/0E X-Received: by 2002:a05:6402:2026:b0:46d:6af2:44b5 with SMTP id ay6-20020a056402202600b0046d6af244b5mr30899419edb.39.1671235155163; Fri, 16 Dec 2022 15:59:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671235155; cv=none; d=google.com; s=arc-20160816; b=CqXMlY/HtuFC9+/iFe+JvPTTCCPL4+pd7mEiEeIoKXSKe5Qe4w/Z9EH0whhx4fFjD6 qATfdtg/Hzgd6Er8j0vJINvmanj4FWlfMwuK8UDOG7GCBKF5EDY6HdtYsH9qPRxENWp4 7zJbaymcyby+t22p9T6s8X+UvMmUVS5VrqHaDiYezfnvcVOLu0VJnkzEXcoqV69Ay8JO mzv7gvFfg61+l/NdLNXCoKmdPch7xoS8PyHKk+905qYDo8bx2/b3oc9rjSHUwKxyp3F4 LJJKrzoWGkKHjfioQ1Dme4euTfjWFi7DA+5IEpzOLAt0AKVLxR/L4A28qKtODpradEqE m91g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=qP9LUFiQr+YzMaH2ADs5X+hQzeakrlDwPsVjntwjyKc=; b=rnGSdKGx5xHoFTI28KUkk3sN4rr0TrVB6u6btuH8qY8C0WmA5WVvHqJ0N1uUIncwXu KKkQOTmD3xUtx8WLBI67EdSu4Hc7XHc3vVLuLDxT7b2zzjf78IJOBkk6VRp7CjDFzrOR NkslZKz+Q+GNC2fvbfmbXew7ZoTFpabcDXTyM1VHXIuKPeTlYMgnXZ8PUGG93ivnk/vX bPCUibjKhYuz+i3RpHYabKHaGgyNLBRCCK85cm1+kZI3eGkT2vBoOBd4wLfPM+En0tvw wMsXdsrVzB8mZ337E3kS27jfIl/8FLlt5/vXDMxsuDDY377dPXpMI+FGuGZiPo8AL1o6 TEOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=QHKlHgQ1; 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 b18-20020aa7d492000000b0047381ef74c7si3116892edr.222.2022.12.16.15.58.58; Fri, 16 Dec 2022 15:59:15 -0800 (PST) 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=20210112 header.b=QHKlHgQ1; 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 S230194AbiLPXkp (ORCPT + 68 others); Fri, 16 Dec 2022 18:40:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230145AbiLPXkm (ORCPT ); Fri, 16 Dec 2022 18:40:42 -0500 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B54662E9 for ; Fri, 16 Dec 2022 15:40:39 -0800 (PST) Received: by mail-pj1-x102a.google.com with SMTP id gt4so3939886pjb.1 for ; Fri, 16 Dec 2022 15:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=qP9LUFiQr+YzMaH2ADs5X+hQzeakrlDwPsVjntwjyKc=; b=QHKlHgQ1SzOIzUJocmAx5UWtJH/8UTsiopsrrQZvH1zE7NKYBI7QA1k69C3WspE3EB cAqpZjDgJFTiNFWtE6zxGdaN+tOzQzzwkdgWMVbn1bEL9HKTH/s4j497z/nwE/CcRcLB +Q2wumAjgS0yMxfGDA2LGAm12Y1hqhdwlnmZEC+VanIJeCME5xkm6+FK7stiHSX/9FnK AL9shkX2H3c0Kt1HCPn3P32sufLL8+IsdFCeHNp3aqlRk+FsDlnTD9CnVcqy5StZXAO4 O+scEOSYPiSRG7sxcIfrwfwBKnz7YVYfAEzeB06iw9tNKiFkNqraNV3hUkX0Ed9kiNgr fRzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=qP9LUFiQr+YzMaH2ADs5X+hQzeakrlDwPsVjntwjyKc=; b=n2MC5cGbyJ69izwTVFRhdW64knWQmSAVIdl16O4Z0PTykaGC5Nmaluhtz108YdtWCC PlWfwkFxWX5TXrRuFCki1/64tB7UJMBFjL8/OkhZCqSChmtPcDjcrgEoRTGWupIq7+t7 herA2ycLV7/X9z2Y2gT1k86DYg9+VT/IAo5kr50Tr3aPBtGKKkex39mpRMpxA42PeQ8e ewkNZUsCDslIcSRH2+ojPA6dsjx0HpJtdmXIynhGJdzTm33Af+lsAdVR/RhuaL4G98GD m8B26Mgs70jZ3lCiZy20pq+ZScC8N/k3q1yJsGYToVEDTUcKK2vvzj5SIuWqIziEugEX i+Yw== X-Gm-Message-State: AFqh2kqgnitJgfhx5VARMxks9vzpPinF3Cx06l4eu8QWOC0E5wxUAXjq l53q5EsSLLU/51sa/eE7RNGAN8vdgwhym9gNh+TTog== X-Received: by 2002:a17:90a:4612:b0:219:a43b:1006 with SMTP id w18-20020a17090a461200b00219a43b1006mr1290642pjg.195.1671234038717; Fri, 16 Dec 2022 15:40:38 -0800 (PST) MIME-Version: 1.0 References: <20221207154939.2532830-1-jeffxu@google.com> <20221207154939.2532830-4-jeffxu@google.com> <202212080821.5AE7EE99@keescook> <20221216094259.bec91e4abd6cf54a05ce2813@linux-foundation.org> <202212161233.85C9783FB@keescook> <20221216140641.bf6e47b7c4f5a53f34c8cf9a@linux-foundation.org> In-Reply-To: <20221216140641.bf6e47b7c4f5a53f34c8cf9a@linux-foundation.org> From: Jeff Xu Date: Fri, 16 Dec 2022 15:40:00 -0800 Message-ID: Subject: Re: [PATCH v6 3/6] mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC To: Andrew Morton Cc: Kees Cook , Peter Xu , jeffxu@chromium.org, skhan@linuxfoundation.org, dmitry.torokhov@gmail.com, dverkamp@chromium.org, hughd@google.com, jorgelo@chromium.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, jannh@google.com, linux-hardening@vger.kernel.org, kernel test robot Content-Type: text/plain; charset="UTF-8" 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, 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 Fri, Dec 16, 2022 at 2:06 PM Andrew Morton wrote: > > On Fri, 16 Dec 2022 13:46:58 -0800 Jeff Xu wrote: > > > On Fri, Dec 16, 2022 at 12:35 PM Kees Cook wrote: > > > > > > On Fri, Dec 16, 2022 at 10:11:44AM -0800, Jeff Xu wrote: > > > > Once per boot seems too little, it would be nice if we can list all processes. > > > > I agree ratelimited might be too much. > > > > There is a feature gap here for logging. > > > > > > > > Kees, what do you think ? > > > > > > I agree once per boot is kind of frustrating "I fixed the one warning, > > > oh, now it's coming from a different process". But ratelimit is, in > > > retrospect, still too often. > > > > > > Let's go with per boot -- this should be noisy "enough" to get the > > > changes in API into the callers without being too much of a hassle. > > > > > Agreed. Let's go with per boot. > > > > Hi Andrew, what is your preference ? I can send a patch or you > > directly fix it in mm-unstable ? > > Like this? > Yes. Thanks! > --- a/mm/memfd.c~mm-memfd-add-mfd_noexec_seal-and-mfd_exec-fix-3 > +++ a/mm/memfd.c > @@ -308,7 +308,7 @@ SYSCALL_DEFINE2(memfd_create, > flags |= MFD_NOEXEC_SEAL; > break; > default: > - pr_warn_ratelimited( > + pr_warn_once( > "memfd_create(): MFD_NOEXEC_SEAL is enforced, pid=%d '%s'\n", > task_pid_nr(current), get_task_comm(comm, current)); > return -EINVAL; > @@ -316,7 +316,7 @@ SYSCALL_DEFINE2(memfd_create, > #else > flags |= MFD_EXEC; > #endif > - pr_warn_ratelimited( > + pr_warn_once( > "memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid=%d '%s'\n", > task_pid_nr(current), get_task_comm(comm, current)); > } > _ >