From patchwork Mon Sep 11 15:17:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksa Sarai X-Patchwork-Id: 13379420 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F75FEE7FF4 for ; Mon, 11 Sep 2023 15:17:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BAE996B02B1; Mon, 11 Sep 2023 11:17:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B5E7A6B02BA; Mon, 11 Sep 2023 11:17:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A271C6B02BB; Mon, 11 Sep 2023 11:17:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 92BF36B02B1 for ; Mon, 11 Sep 2023 11:17:42 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 618A180AA6 for ; Mon, 11 Sep 2023 15:17:42 +0000 (UTC) X-FDA: 81224671164.18.E29DB9B Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by imf03.hostedemail.com (Postfix) with ESMTP id 639BF2001E for ; Mon, 11 Sep 2023 15:17:39 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=cyphar.com header.s=MBO0001 header.b=STZMS4oF; spf=pass (imf03.hostedemail.com: domain of cyphar@cyphar.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=cyphar@cyphar.com; dmarc=pass (policy=reject) header.from=cyphar.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694445459; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=gY1nJx3RoS2vF3Fjoh906DwAWSZVPbGDZF1f+ci7yuU=; b=oPe2Go/zbNPfOlEe+djzyMRQPli7zeAFr9GusvDaOiG/BVSIgx59qsl0Ph9laOrEktiGBt M7AV9nEJC09G9nhtTsFbxLyXSYMkBsxIOCbm6RabABXWbgk/XK4VbI9hLBAmMyAPjwElrK LY1z7knVbfX0t8dso04M+QA+9O5p2MQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694445459; a=rsa-sha256; cv=none; b=LsRqgWttyrtn1RHGCMy42OXsvDfiOXyHCiMBv7t2Ta5Hi2fxmOtNCJ99T2yI44ciyO6ebS 3EfXnGpWqZioGfDCHlSYz/r0cdBBsGYWOv/rF+5wX73Y562B/tDEqFqSeitmlz9H/PoGrn YIZ4rRNZFoKpTWdbsko3n2/QStggJZA= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=cyphar.com header.s=MBO0001 header.b=STZMS4oF; spf=pass (imf03.hostedemail.com: domain of cyphar@cyphar.com designates 80.241.56.171 as permitted sender) smtp.mailfrom=cyphar@cyphar.com; dmarc=pass (policy=reject) header.from=cyphar.com Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4Rkr1R6YYfz9sc8; Mon, 11 Sep 2023 17:17:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cyphar.com; s=MBO0001; t=1694445451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gY1nJx3RoS2vF3Fjoh906DwAWSZVPbGDZF1f+ci7yuU=; b=STZMS4oF8i173H/rhhw6vbnQpSH8bsbHV+rUfblRBQ++BF5/jsY0XoSPWjed4KDW/2GqGo NteyTTl/MvlahVTfYgdIY3MO+7uCq4eBy1rU+Ff9Ez1+K9ObvuqrBHm1a3ZtJ5AJMTG6HI 8WVEbVhDl5lnMckLuA8u2PyWIv7LwQkItLr0sCoPRSm5RiiLNVyE24RM/NsmruwPTwfVaP W2mwXueTX/2iffaaEtBomYHBOIo45mpX20MCx+5EIr+HQ5aNeHwusJlCI76kHbtyK8SNsn 1xI9C0fPqcb7aubN/WHNMX9cGo0TrFzCvy6Cf7LPQpA6jWr9FOqIXG3RPiNkiQ== From: Aleksa Sarai Date: Tue, 12 Sep 2023 01:17:20 +1000 Subject: [PATCH v2] memfd: drop warning for missing exec-related flags MIME-Version: 1.0 Message-Id: <20230912-memfd-reduce-spam-v2-1-7d92a4964b6a@cyphar.com> X-B4-Tracking: v=1; b=H4sIAH8v/2QC/32NQQ7CIBREr9L8tRhKg4Kr3sN0gfARFhQCSmwa7 i72AGZWb5J5s0PB7LHAbdghY/XFx7UDOw2gnVqfSLzpDIyyiUp6IQGDNSSjeWskJalAxFUIq+l D8hGh71JG6z+H8750dr68Yt6Oizr+2n+2OpIeS83ErdJG8llvyal81jHA0lr7AkWNKjuzAAAA To: Andrew Morton Cc: Damian Tometzki , Aleksa Sarai , Christian Brauner , Daniel Verkamp , Jeff Xu , Kees Cook , Shuah Khan , linux-mm@kvack.org, linux-kernel@vger.kernel.org X-Developer-Signature: v=1; a=openpgp-sha256; l=2246; i=cyphar@cyphar.com; h=from:subject:message-id; bh=JMf8ODyrCEKqTx+r6DrssdOGDQzj1OoZpTMr8v6gUPg=; b=owGbwMvMwCWmMf3Xpe0vXfIZT6slMaT812/NzvC+oX0z6/9M/u2/D9zunjHJ5VNhs1rEfMF42 7ZzmzgOd5SyMIhxMciKKbJs8/MM3TR/8ZXkTyvZYOawMoEMYeDiFICJnFvI8Id3znQWUalHR5ba no8SL2xY61H5J8BxcfvBoKoP5bseOuUwMkw9KytlmxX5U5VNLCF43STZJcq/7zos89OU4Umsjng QyAMA X-Developer-Key: i=cyphar@cyphar.com; a=openpgp; fpr=C9C370B246B09F6DBCFC744C34401015D1D2D386 X-Rspamd-Queue-Id: 639BF2001E X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: g7dxyatnm5ni4bq1pt5fqaixhu36py35 X-HE-Tag: 1694445459-377778 X-HE-Meta: U2FsdGVkX19/58kFDhGIpIMVbfMMyVFto3WR0C5fDP0JPbuXh0KnZ548RvXokzh3IA/8w9qhZVF6SOTP0GHXiykHHnK01W7NkyYsTSNF+7QLXCqppULgZF6Sv1tctR1FO2Gdz/MJ9nV955H8/ILfqP+QnjEhD7Nz+xYO5yTGOZZ2p6Z2d83BSoPJnSpJKx17tKXo2ABy6f3gVQsXcOTf2ZTY5h9yJn2ee/qKcOzkV8+wrdVMTZvuWwt1G1de3wJuic/zMPnexpJzQc08XbR3/FZCJk9LIETx0FGRf6t/bQWwvmk8SDX28HO6IjWbwquXyNrN+Dc6zxD/LVaq/nQZjgWgcUP4lemJPkWzC1ij2odGcVnjCsL2xNXM4N8aORb1P8lb66pof0YOOeSWiUZ1ZiGga30dZ9BB7jg9/gVQF+orSlq7hvAaNlvxznTXb43wMljuCFfg7wVo6KTT8OAQLWzOX+BOw3zHkmyP6Qb1yWN8HwRPjyR64uT177DlX2Y+2nW6OMhOgTPS2fGUyp+nL/zH3uQ3dobYesKrMsjzK4R1f7zT52GTiMaZUmCz0tuADDbAfeP27t/bnkA8vBL01yj8Mp2chi71PZpGXhUDpVgdbqom7yJehoDQiEPxFpO+65B1RZkKUDLIJEqH0sEtcMfnLQL2LMOPzwf5TF2AU1Hdb4/Gx0A6TKZQC2516QvRSlx1pNPj3YBNXqoAjbUElzqKGh3YvYujHL/wvF9bTWb1zNo8c9v5XRxfiNu0m7hRGMX9aG/Y9Yk9oYjHL7CzPzKQWDJUFVJf7PmV0EZZ2J4AgWmePtlqHQ//hVVSVa8eTfNnHZGMcXIEOGi5J0I8lpw/s7c/IPlkvueHRDA4jsMsNmSs2KZP09ph2M/1CuM4VFeT9k0xR9ha6mPbbt+eMLnATFqL35IsSEeoeF7KO69BgIaSsaL1JTxN1CbDKbHSMK+4z9texk8sOYV5Z33 qzK02U5U tsVcBK+R9xPsLcMhqq5EBstMD3jHiiZiMi4u4Td76N2gJrMEitIk+MB5g1nO3yDxZQF2b1Qfy20x+wCSUhleZZb60GMelW35z5SAaRGrGcw8MHnDSZdNtU4oSkGQYA+gllqE7J3PAmArhN6062YmIRDz6z6NDLZotcKwECwwIuV/Kc65KGIOKK65PHlMtRRaqzhWKsBsyo9FzHqjatNOy0PTUmlGSl69fxCnag323H2d4Y0kmjKWbLMY7cMaic9ATrnNuGiNtuEZeoI5cj0lSfTFEmuaufHiivqn4jt8kFfxrZLZdBzJNF6sKUN2++ZpcB5z8/8Khdzo6DD0oU7QhYlkCDeP+PlpCXSAI X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Commit 434ed3350f57 ("memfd: improve userspace warnings for missing exec-related flags") attempted to make these warnings more useful (so they would work as an incentive to get users to switch to specifying these flags -- as intended by the original MFD_NOEXEC_SEAL patchset). Unfortunately, it turns out that even INFO-level logging is too extreme to enable by default and alternative solutions to the spam issue (such as doing more extreme rate-limiting per-task) are either too ugly or overkill for something as simple as emitting a log as a developer aid. Given that the flags are new and there is no harm to not specifying them (after all, we maintain backwards compatibility) we can just drop the warnings for now until some time in the future when most programs have migrated and distributions start using vm.memfd_noexec=1 (where failing to pass the flag would result in unexpected errors for programs that use executable memfds). Fixes: 434ed3350f57 ("memfd: improve userspace warnings for missing exec-related flags") Fixes: 2562d67b1bdf ("revert "memfd: improve userspace warnings for missing exec-related flags".") Reported-by: Damian Tometzki Reviewed-by: Christian Brauner Signed-off-by: Aleksa Sarai --- Changes in v2: - rebase on top mm-stable (in particular, commit 2562d67b1bdf) - v1: --- mm/memfd.c | 6 ------ 1 file changed, 6 deletions(-) --- base-commit: 6bc660278f11970e7c0c349f66c693e5dc5d85b6 change-id: 20230906-memfd-reduce-spam-8788fc0b951e Best regards, diff --git a/mm/memfd.c b/mm/memfd.c index 2dba2cb6f0d0..d3a1ba4208c9 100644 --- a/mm/memfd.c +++ b/mm/memfd.c @@ -315,12 +315,6 @@ SYSCALL_DEFINE2(memfd_create, if ((flags & MFD_EXEC) && (flags & MFD_NOEXEC_SEAL)) return -EINVAL; - if (!(flags & (MFD_EXEC | MFD_NOEXEC_SEAL))) { - pr_warn_once( - "%s[%d]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set\n", - current->comm, task_pid_nr(current)); - } - error = check_sysctl_memfd_noexec(&flags); if (error < 0) return error;