Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7680854rwb; Tue, 6 Dec 2022 08:35:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf7sR5o6ARi6j3+rECzW3/opXmWjhHm4epfo1TcK/lmkvqfIxhNwHk6w6yJprWTw+YOH2An2 X-Received: by 2002:a17:906:524b:b0:7ad:a030:485c with SMTP id y11-20020a170906524b00b007ada030485cmr71410780ejm.605.1670344519054; Tue, 06 Dec 2022 08:35:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670344519; cv=none; d=google.com; s=arc-20160816; b=GGK4/FTzJ3zlMB1ZYfiSEfBkHTWdeZcQxyHvvIAXlIxKkAv4Ak4DCDIpDwSZBPvmdJ 6CgZ8uyLUqhqUC1gfJjCoh9Z3h6qfyl0sXei1BtV8wbY9htIA/YKN6v9LasosHEAKQzg nxW2+vuyEUlW9tpjMzJ+mLzro3zuyLMKcvU0Cg2Su37RNdwDmzKs3EKOseBPjxPpVCAi JNe5Q+rKB0mr9ZaA9cBwcxKuTu9gRIOSHKfvVgbYF41nOzXh2zfqP/wZAJPvw+RA8DBY g6PC3oJRCCL28vn3FG+01dJFngson376cQlhcI2MHqQGZ1AJn4/BlcBer9os1J2+Q+qx P9Sg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DIs4qdJxwgUZZ8TYFxFEUujKTcC1aHKihMZ7v32qGRc=; b=B/+huLq4xOUzacykyKGwSRWWHZwfSukExlyK+vEUFFN9ZGRFZ49LFD+ybZtpmUaTr6 fG3KkvwJLfyZksxPP8KLI4fZ4whRSNnayzJvcTX4ZS3Io5BCHeXgG32FZDUcTLv8+UEQ GOw+rq+ikQ9tF8SaEEiVK2AoD+//BJA3F3Wx/7VKBIYBr/wYECfFgh47blqc/l59jctZ WweSR3J1XbwmHSzuU77nXMWUjopFAPUT7IzICrfi3LmE9DwX6FOJfbqC5MrtlN2+dG4u cex3UOg5nqzew3rqQdw/1ZYf8cQCWlCNdAtqYhOSr/U84jan0MIkbRH6+WJcDgkP//XL fOEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UF60dVUP; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c6-20020a056402100600b00461540620f1si2020226edu.169.2022.12.06.08.35.00; Tue, 06 Dec 2022 08:35:19 -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=@linuxfoundation.org header.s=korg header.b=UF60dVUP; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235432AbiLFQK2 (ORCPT + 78 others); Tue, 6 Dec 2022 11:10:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235422AbiLFQKB (ORCPT ); Tue, 6 Dec 2022 11:10:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8C7F3AC33; Tue, 6 Dec 2022 08:04:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7DDDD617A0; Tue, 6 Dec 2022 16:04:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41BE8C433C1; Tue, 6 Dec 2022 16:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1670342691; bh=gLpDTa+rhIH8NgaAcvNWyhQOtMSJQxHMPFZgL9hpIWI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UF60dVUP/aF9XqgJKVxVlccO8WHFfVB+F8TBKwO1Ir+7+A95I+cWjyQ/89GNogrrJ VjewJijvOODIWPYGIFOs0lvI2Xjz9XWsL/cq/ERPHHWGhU2LzvwfIVFdbj69IdQTl4 Fwr55ea12m70z4dZfL7YmtW0+dTRXkv3sN2AlY4A= Date: Tue, 6 Dec 2022 17:04:49 +0100 From: Greg KH To: jeffxu@chromium.org Cc: skhan@linuxfoundation.org, keescook@chromium.org, akpm@linux-foundation.org, dmitry.torokhov@gmail.com, dverkamp@chromium.org, hughd@google.com, jeffxu@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 Subject: Re: [PATCH v5 3/6] mm/memfd: add MFD_NOEXEC_SEAL and MFD_EXEC Message-ID: References: <20221206152358.1966099-1-jeffxu@google.com> <20221206152358.1966099-4-jeffxu@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221206152358.1966099-4-jeffxu@google.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Tue, Dec 06, 2022 at 03:23:55PM +0000, jeffxu@chromium.org wrote: > --- a/kernel/pid_namespace.c > +++ b/kernel/pid_namespace.c > @@ -110,6 +110,11 @@ static struct pid_namespace *create_pid_namespace(struct user_namespace *user_ns > ns->ucounts = ucounts; > ns->pid_allocated = PIDNS_ADDING; > > +#if defined(CONFIG_SYSCTL) && defined(CONFIG_MEMFD_CREATE) > + ns->memfd_noexec_scope = > + task_active_pid_ns(current)->memfd_noexec_scope; > +#endif .c files should never have #if in them. Can't you put this in a .h file properly so that this does not get really messy over time? > + > return ns; > > out_free_idr: > @@ -255,6 +260,45 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) > return; > } > > +#if defined(CONFIG_SYSCTL) && defined(CONFIG_MEMFD_CREATE) Same here. thanks, greg k-h