Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp338858rdb; Thu, 19 Oct 2023 06:10:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFrPzRnUHhQl6XfAhYTCOqfcDwtkNQuzirkVFd9g17tyu5rxTXbRXTjZofVNaHbYNloqy7 X-Received: by 2002:a05:6e02:692:b0:34f:c7f7:18b with SMTP id o18-20020a056e02069200b0034fc7f7018bmr2136612ils.2.1697721051663; Thu, 19 Oct 2023 06:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697721051; cv=none; d=google.com; s=arc-20160816; b=kPsFvw0DufxEMfZIw4t5bzwmT78GUDbdP6v120KlwfFMcGKb4S2oZMH7S2FgFUgI41 q7016HT0lPkVspq5MFovHimHKCC24V2/mMyxps+4THeJUgnE77O/Z2KJ5jattD0xUbxw 5fipszk8cYmdwY6qKAPvZcPTYJpWJMOiscDZ/LJALF3Hkt5PxzhwC6lY7QQLVdKqUG74 EX03e1IOqplerM93rAPKMSRVqRebWZx+M28sNgLM/nCZgMyaNOnYR0ySQg1waF1A2lPF DLOUmRlXHW2tPcp+V5s5Ao+/IxMcobbKdqZGhJI98h8nZR+oj66c6yf84q/dv13dbT6m yYgA== 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=ye6vMdiBk6fCMdBWCFZSgU3VdZTZqteq+5mpIGl0jX0=; fh=m11bZXatUfNRnTGcEbmQkJxN6foChJz8sJofcCxBVeg=; b=gkhZtSa4HrGWDz3xQnspNHw6vQKkiMY24pYiz2EA97L6zgmBwB5jBsuQVG4e+AAOUI /3dM7G0rDlCty+qf4GjPorH0hMvJG4gETILlhRsZ5DB2/qs7Ca7f/rLvc2rl4GUBtH6p 36Le0ucpYFNSiQRHz1cqrEqp79QwzJwaYLiOucOpxmF3CPzjCTQ+N9LNQGGsiWv1q8qd XKCmxWqH6+jFYk9sTTP1LCBiYAHP4GcS8UQoVgmFQhBsTFlIkIpH3ur19cRtgIIbVERh 1haUbmjgjjckegouDM2hLiN70l/KTR4s6HbyfPQqoSlXzkAboEA0nnYsh7ap1RM61A5G gE+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GJMDnDkR; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id s18-20020aa78bd2000000b006b61871ae27si5902772pfd.367.2023.10.19.06.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 06:10:51 -0700 (PDT) Received-SPF: pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GJMDnDkR; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0E1EC829A044; Thu, 19 Oct 2023 06:10:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235365AbjJSNKs (ORCPT + 22 others); Thu, 19 Oct 2023 09:10:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235369AbjJSNKq (ORCPT ); Thu, 19 Oct 2023 09:10:46 -0400 Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A90DF106; Thu, 19 Oct 2023 06:10:42 -0700 (PDT) Received: by mail-ot1-x32f.google.com with SMTP id 46e09a7af769-6ce2bcb131fso278987a34.1; Thu, 19 Oct 2023 06:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697721042; x=1698325842; darn=vger.kernel.org; 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=ye6vMdiBk6fCMdBWCFZSgU3VdZTZqteq+5mpIGl0jX0=; b=GJMDnDkRA3X+lbF/YFuSc90319T3zD8e2x4zLjyrbCeSZOGZds6lXBIv1LNe7hZcFY o7xcjEa4EUFHNrfw3gs7M8ad5IPiNrJ6zg4Ch1GrcdiX8tJRarTQZwKferBJFvREX9Z2 HtXHpbV7VXKHw/9le78JMkWXqwpdSudeOk6AVK2/xLtDwnN5ZOGdpROJcbjzPeoVQ8gb LS4DDLR1b7VWA2Z0yBH5mLxxnYc+E+nKZpFXlQTTBixjHDh9kT2Deo75NkV3jbkz3nmm d6U6aoYhSKlJ0p/JcEFbuW7CPeaZTnaiqCoaIE/bAvshqK68QQFZc59yJYQj1IRsK9Y6 0AHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697721042; x=1698325842; 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=ye6vMdiBk6fCMdBWCFZSgU3VdZTZqteq+5mpIGl0jX0=; b=q9tx9/Fyptyxf0tDuFe868wp4a3k6IAcqX6UVXH3qUKWNJL0Bn9KyrOOkW3J2lae3G 4iVaj04lzpJkeevhe9sorkD/EXrGlM7WtPhUgXxEltwydC45oL77z+AiIAL7E0R/D6Gw wgQ3/YcIY/aULh0sysOn49WL+kshpPYRLQWwGir+octQAORJq4N7k4WfgruXmwoM04Ma dGanl0O65etF3sFcQ6gm7/hI/wj3PCTVGYMetOq5+DbQY/gddhkfOele6iD1KqWFL7f2 2ZCPPp6uWdBxQA1uTPd54qHsgPylMTpc89PYY6QINcmX/inXyt7m2UWkwp3GMoCZ10Ym JrUQ== X-Gm-Message-State: AOJu0YzEZ3ptHYOtZKUQIKwt124wZ3aiWZcOqaU8DP6SR6qPrjGhxCVt txQnyaLARA4rFN22Oe8rL+G6WuICehOMRJoGGxuVoQsc X-Received: by 2002:a05:6830:1d43:b0:6bc:fdbd:ccb8 with SMTP id p3-20020a0568301d4300b006bcfdbdccb8mr2267424oth.13.1697721041742; Thu, 19 Oct 2023 06:10:41 -0700 (PDT) MIME-Version: 1.0 References: <20231016220835.GH800259@ZenIV> <20231018043532.GS800259@ZenIV> In-Reply-To: <20231018043532.GS800259@ZenIV> From: Stephen Smalley Date: Thu, 19 Oct 2023 09:10:30 -0400 Message-ID: Subject: Re: [PATCH][RFC] selinuxfs: saner handling of policy reloads To: Al Viro Cc: Paul Moore , selinux@vger.kernel.org, linux-fsdevel@vger.kernel.org, Linus Torvalds , Christian Brauner , selinux-refpolicy@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 19 Oct 2023 06:10:48 -0700 (PDT) On Wed, Oct 18, 2023 at 12:35=E2=80=AFAM Al Viro = wrote: > > On Tue, Oct 17, 2023 at 04:28:53PM -0400, Paul Moore wrote: > > Thanks Al. > > > > Giving this a very quick look, I like the code simplifications that > > come out of this change and I'll trust you on the idea that this > > approach is better from a VFS perspective. > > > > While the reject_all() permission hammer is good, I do want to make > > sure we are covered from a file labeling perspective; even though the > > DAC/reject_all() check hits first and avoids the LSM inode permission > > hook, we still want to make sure the files are labeled properly. It > > looks like given the current SELinux Reference Policy this shouldn't > > be a problem, it will be labeled like most everything else in > > selinuxfs via genfscon (SELinux policy construct). I expect those > > with custom SELinux policies will have something similar in place with > > a sane default that would cover the /sys/fs/selinux/.swapover > > directory but I did add the selinux-refpol list to the CC line just in > > case I'm being dumb and forgetting something important with respect to > > policy. > > > > The next step is to actually boot up a kernel with this patch and make > > sure it doesn't break anything. Simply booting up a SELinux system > > and running 'load_policy' a handful of times should exercise the > > policy (re)load path, and if you want a (relatively) simple SELinux > > test suite you can find one here: > > > > * https://github.com/SELinuxProject/selinux-testsuite > > > > The README.md should have the instructions necessary to get it > > running. If you can't do that, and no one else on the mailing list is > > able to test this out, I'll give it a go but expect it to take a while > > as I'm currently swamped with reviews and other stuff. > > It does survive repeated load_policy (as well as semodule -d/semodule -e, > with expected effect on /booleans, AFAICS). As for the testsuite... > No regressions compared to clean -rc5, but then there are (identical) > failures on both - "Failed 8/76 test programs. 88/1046 subtests failed." > Incomplete defconfig, at a guess... All tests passed for me using the defconfig fragment from the selinux-tests= uite.