Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3115539rwb; Fri, 16 Dec 2022 10:14:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf7+ZsZ9T/+3eHc60cK8Y9SHsRUubjBORX63fAGaUcRAlPtfwlItq3GQbXqpvtkfd71QuSPp X-Received: by 2002:a17:902:8605:b0:186:5fa1:1eae with SMTP id f5-20020a170902860500b001865fa11eaemr28693635plo.48.1671214499647; Fri, 16 Dec 2022 10:14:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671214499; cv=none; d=google.com; s=arc-20160816; b=gIP9uACW7JNzL2FAkjvgXiLm7otKmNmEkLk/cK+FVAS+KGfUiQ4RlEIcAZayDLB+Ao EPjWGuncUrI66LvH/xJLmJ1U9ALVXhSfIkvc0/+m0ZwRPT1jXsVnbo4hI0pJVJt2yE6N Yras2OLTar/gsKVCFnMchMVyDdgtgDgR25o84je4Cira+e4ZNHBTQ/fHdaGMPX3hyC8M XI9DrRLZlSMH0nz6gNxDL8HxsVWwPGFFiK6cdn74iPqf3dPTLU+aZm+hxnQIjh/7oFZL VRGJKh8umTUja6d07v4rChBN4G/dKw8EAEVBBJ0pNNXFNVjyhA4IYG4BGSu8Y/g/RuZv D2+A== 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=1vFt+PxUURFiZfVHrvBsmq3MYjQQnliB4U9G0LtHwvo=; b=SEkjDaWFpCPtqNJZ0B3SwbMPioOuV6sc1G3HSRcZCi2b0lpLiMygVGWAa0YPSM/5g2 pjqW2+JIeJg9dThshwa5vjIed5Wr3iuQZs3tlESUV7JrrwbLpB5tgdhZzQhkR2kmyGMz 5/v/lM8gZKqcxK131bEJ9/s7ZOV+oFVzPCVaLFzYXndyYgj3QJUkctL1vYHkKUAQJoT9 5mrmwr3lSlXIYz8xEboc7GjDTgBlfQOZy9TUKlXgTogrIXbGApZvbXCWxmM9EYuy8//7 12EV4JDDwVuSwQBzmf7vL96E/nLO5avaCqkyKVvXUkKP3FPqsGXtpw4N3B/2KOzqk7Zn 2BYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=NzIXW8IP; 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 n12-20020a170903110c00b0018996404dd9si3420973plh.267.2022.12.16.10.14.51; Fri, 16 Dec 2022 10:14:59 -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=NzIXW8IP; 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 S231429AbiLPRQV (ORCPT + 68 others); Fri, 16 Dec 2022 12:16:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230449AbiLPRQT (ORCPT ); Fri, 16 Dec 2022 12:16:19 -0500 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2630101F5 for ; Fri, 16 Dec 2022 09:16:18 -0800 (PST) Received: by mail-pl1-x62a.google.com with SMTP id 17so3005094pll.0 for ; Fri, 16 Dec 2022 09:16:18 -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=1vFt+PxUURFiZfVHrvBsmq3MYjQQnliB4U9G0LtHwvo=; b=NzIXW8IPm6aqdfZVn8wF9pvH9EX2CYlT+NecBtjOLfEuyXc+cx2NKGt5J+FnKO1bjJ TrF0y0yo6mVxhuVq30y+t91fPsGX6xGd9sb28pCmi+59SPnJev9IpMY/dcGPJmgXxLzp uYMcp6cAQtYqy4jgdLA97Jt9m1/T5UmPMFJisqTII7KPitmCMZEDdbkzlV2rVl6bYHA4 cHbNfGO25NidGQjLdH+U6LTY95WHrEs/cMS3wJB4NiEqJbZc8YCuwLiuoX1snZ9fquUB 6TFyUQQ35fJyhZeTgW8uzcMzgbwY2W4AZcTPgGrzdmrUN5UHDplf+8ch5izUjtf2VG6v UsfA== 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=1vFt+PxUURFiZfVHrvBsmq3MYjQQnliB4U9G0LtHwvo=; b=BtIx6jsERMol8Bnjf0iqJWZQ5SIl2vjnvpQI0TXFjjCEjwlX5GI9TUXdOc0eXtER7Q DUluCgruBxEMhEdlM+TBJ5hOF+7kQQGK36M81KP5cqlPJXbNIHbWv0sc0k5muyuVtqet hAnrUIUWREa5zGrID1Nm+UvhwkH01m9mJZspw5KGFiDYDV+GL8DhZJSEouFRgzAgoelc laB4p2AzlLBz+UwOt73GjrgQR/x1p9i0SGKSfIzZZj/AaS/Kh5dPCv+0nioFHqgTcVus wBMKn0UZI5X1TgPyqbevL8Of3jxIkSEA80EvkQAYI69PTlPCLIiywcs8q7F2xq20jNGC QDBw== X-Gm-Message-State: AFqh2ko21p8eDQSwxdJjgJ4aaEujomiNgX/BF9VBVeH8OgOsUGAmagh4 P/V0FIBhDfx52DOSvxpb0C5C99Hb7LjXV14PrPvhmQ== X-Received: by 2002:a17:90a:69c7:b0:21a:8dc:1b5e with SMTP id s65-20020a17090a69c700b0021a08dc1b5emr653725pjj.26.1671210977931; Fri, 16 Dec 2022 09:16:17 -0800 (PST) MIME-Version: 1.0 References: <20221207154939.2532830-1-jeffxu@google.com> <20221207154939.2532830-4-jeffxu@google.com> <202212080821.5AE7EE99@keescook> In-Reply-To: From: Jeff Xu Date: Fri, 16 Dec 2022 09:15:40 -0800 Message-ID: Subject: Re: [PATCH v6 3/6] mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC To: Peter Xu Cc: Kees Cook , jeffxu@chromium.org, skhan@linuxfoundation.org, akpm@linux-foundation.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 7:47 AM Peter Xu wrote: > > Hi, Jeff, > > On Thu, Dec 08, 2022 at 02:55:45PM -0800, Jeff Xu wrote: > > > > + if (!(flags & (MFD_EXEC | MFD_NOEXEC_SEAL))) { > > [...] > > > > > + pr_warn_ratelimited( > > > > + "memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid=%d '%s'\n", > > > > + task_pid_nr(current), get_task_comm(comm, current)); > > This will be frequently dumped right now with mm-unstable. Is that what it > wanted to achieve? > > [ 10.822575] memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid=491 'systemd' > [ 10.824743] memfd_create() without MFD_EXEC nor MFD_NOEXEC_SEAL, pid=495 '(sd-executor)' > ... > > If there's already a sane default value (and also knobs for the user to > change the default) not sure whether it's saner to just keep it silent as > before? > Thanks for your comments. The intention is it is a reminder to adjust API calls to explicitly setting this bit. The sysctl vm.memfd_noexec = 0 1 is for transaction to the final state, and 2 depends on API call setting this bit. The log is ratelimited, and there is a rate limit setting: /proc/sys/kernel/printk_ratelimit /proc/sys/kernel/printk_ratelimit_burst Best regards, Jeff > -- > Peter Xu >