Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp64910rdb; Wed, 18 Oct 2023 18:39:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEn2I+byzeDbuiGyMrDdRz/wkSlJtI8STPObSM1D96/WuWnMXQhfRUp9gonyyX83AK+d3QE X-Received: by 2002:a05:6a20:8f1e:b0:169:cd02:65e9 with SMTP id b30-20020a056a208f1e00b00169cd0265e9mr936414pzk.33.1697679571280; Wed, 18 Oct 2023 18:39:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697679571; cv=none; d=google.com; s=arc-20160816; b=CQE7RQ/+Zm8VGHKVgTGgGuacG0rekyXLxev7wDQon18mvIn7Q0m2+s0J0uApUtdZ9j HxFOnwJsBGN8XLooG83w1AZWuybJp/PujShd+6uxaFzubKwn15GwntY3UQqA/6EBPhpU 0qd/+dPyGrHMaJg9uhgIM/57WywHhz4taT30PAwy9uONX8xY28Ybso0TbndXoroXLrVo X3KBPbzDJWWbR2iRe/AbHxpxB849E6AZ+RsS5ap9+a/5UjpO5AKpN22ks1Rn3jL1GZzn fOCsaMNVTBJ9rIpfD2eq2weltQJFsZLDUXM4oY5UX/SZlipep4FSoitzpG1pHfPjIb0F anoQ== 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=vX68/OE0qLrF3A1/NDlCjZF1ajE8ZMP/wy8PcFgCC1k=; fh=pudsf+qNLqbB7SSmaR9v/6tx0l8FMgDTPXd8BF60lhk=; b=SZzM3V8jm/vp9O4x8xgzbVp8p7oPA6klStTJ/MUyQv8X8RxALwUqkD96XHjJBFmYkh ZHx9M3t38bmSXqpWTHsYMRjE+xOeIHZphp/qCGe0oWI7QzahMUFnDxucChj50Hk1emWL 3msUIgDmR6apo9l3LvyqDCkJmlx2LU/70y3YVimGaDhcvAhznScQ/lVr2ZKVL/gBiFzI 9YiegL3Vdjb7z0KyvqA1k35xRSlylICPPO/YNeU6xZek4OsE0Jpo0SZERMBJ2k74vV9g kxHqRyqzT3lejxJ6V74GtCCnfMmMVsrD1MHOVjxtSVaOyIx9R1qpLX4SRh05xiStXaUi ja+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b="B/hriZb/"; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id mi12-20020a17090b4b4c00b0027d18475bd3si1089734pjb.168.2023.10.18.18.39.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 18:39:31 -0700 (PDT) Received-SPF: pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b="B/hriZb/"; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 5E674822A486; Wed, 18 Oct 2023 18:39:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229688AbjJSBj0 (ORCPT + 22 others); Wed, 18 Oct 2023 21:39:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjJSBjZ (ORCPT ); Wed, 18 Oct 2023 21:39:25 -0400 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9A44EA for ; Wed, 18 Oct 2023 18:39:21 -0700 (PDT) Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-d9b9adaf291so4823276276.1 for ; Wed, 18 Oct 2023 18:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; t=1697679561; x=1698284361; 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=vX68/OE0qLrF3A1/NDlCjZF1ajE8ZMP/wy8PcFgCC1k=; b=B/hriZb/a5usUFTona5xSSGqFGx7M7E+IQoS3ZNjotoDDqZoV2dWm77wY8kONdLpMi N1XfykBCX1djn41p8RS7XMmDUowa3OP5AGT0mp4MQbIQZ6RRVQgB8apci73hwTR4ETbG p0fUcSOar50eWTrlnQjWQmv+TuMa8nhx/RAoIK9QlbtHYk8066iD5kEeRtTJXtijmwLn 2TnHslHatbWcO+iatBIhBDSXlPgZbIA10sVt6AgKHuk4YlXxeRSCceqeBiDHOdMUvbxP zAKAJNby7R85c1iq1QJtEkEGUMIsh3vYjRTAfnoYpeUj4DgnNMDe2dL1SQvgapZKCN7k zWYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697679561; x=1698284361; 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=vX68/OE0qLrF3A1/NDlCjZF1ajE8ZMP/wy8PcFgCC1k=; b=ZscvSvos8tlDMhI/bCMxXalklQRGQnNkoJYWSjyIEsWqvQlEY9OuipuYZ89c8BvskV AIbPUDahuQMKn4sCAg5oRweYDfh5QGty+Eq17tQVSr2QweMpQLwXwLzJWUVQDmCJNdZa y2SOCgFgxaT90EPEYnagANO+C/YNCX7pYntalMOvbD6S9WTWu3Srs3M7CZOuJDRqfx73 fPH6kVE2cdLwyq4bNHN4vBj5vfb6xNVO44sPMSZNA4yvK/fawxaepT9aYG2YYASEiYm1 cvcE035AB1ZSC41XtldEObdpsYTh+0K6Fs1A3FWDSLs1oHUm3FdDG9kszTZaHgXIpZkr CgPA== X-Gm-Message-State: AOJu0Yx8jgRhiyNt67wBYUJmmbC3ZkcpdHBifScR8Ckc5nAS9V6l+hmr 6ZWpjvrUfrfbmKTUMzC5SFvxhF8tUSuE8utZdIqq X-Received: by 2002:a25:ada4:0:b0:d9a:4da4:b793 with SMTP id z36-20020a25ada4000000b00d9a4da4b793mr1172039ybi.62.1697679561081; Wed, 18 Oct 2023 18:39:21 -0700 (PDT) MIME-Version: 1.0 References: <20231016220835.GH800259@ZenIV> <20231018043532.GS800259@ZenIV> In-Reply-To: <20231018043532.GS800259@ZenIV> From: Paul Moore Date: Wed, 18 Oct 2023 21:39:10 -0400 Message-ID: Subject: Re: [PATCH][RFC] selinuxfs: saner handling of policy reloads To: Al Viro Cc: 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.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 morse.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 (morse.vger.email [0.0.0.0]); Wed, 18 Oct 2023 18:39:26 -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... Thanks for the smoke testing, the tests should run clean, but if you didn't adjust the Kconfig you're likely correct that it is the source of the failures. I'll build a kernel with the patch and give it a test. From what I can see, it doesn't look like this is a candidate for stable, correct? --=20 paul-moore.com