Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2690010imm; Tue, 4 Sep 2018 08:29:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ1y0Rz2zef3kJzzgeo1ORlLeunOFQgBXSeFqaJ+Kbh6eT3M0x8pQID+IbqyHbLE/WAr7Gz X-Received: by 2002:a62:2483:: with SMTP id k3-v6mr35857692pfk.195.1536074945802; Tue, 04 Sep 2018 08:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536074945; cv=none; d=google.com; s=arc-20160816; b=TWmKEmaM3Yuo+EqXKCgE81Jf2dIqwQ7mz7PiyNdmLGZEhbNM+EVTs/NmDBCtVAy9oB 4fu73XWbe6lUGhD8aaf1+Nf9XHVcQhjM/TL6CP/LEOsi2cqazO9+/9BECg7oJKjb7LH6 YvyZUskD7Z7NNBwu42dsSOhF4Bob0Y3uellUHn93Nn87T0M5phj/cjJKqTKuWM1ZqWk+ x961MYHlhW6k0wkzuzPc+8MveNI1+gYR2JKZyty7/ENvFzTnddLwKm7OYkRzkGFBk2ZO vIUN6Lst/DtiEGtCfCZ/ycv+/o9PlvG5coUMrk+sFr88rCprTFlykj6F/3B11PxGIoC0 zfAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-phdr :arc-authentication-results; bh=oJk5D5L+4ttU3h8LzmACKMtaD3++pyDu3BvdkK+lOPk=; b=udyW67XknKpqi1HaUNXLk/BTu7AmRoVf6S+P1zfOtaDRL7iNnEQ6A/a+zGYYJF48dR 2DvbiEQWPMFvC5xmxSGhxyisNcfJPw/gDtFeAaR1LkHgJhunvrFBzgo59wk9YeR5g4n9 rIks+zJTesYexsIgwBmfU4ckkA403MJ/4BskPpXVT77CQf0ckuxs8HQ1AOYkimK7VVdp eXQxuoAVEhteNVlwwv9tHfuMvriBR3+runsx4VALcMmWouLoB8Mgte7ZPT1jZORojsMS qkImWMKMOLcpLHekIt2LNSM2aB4L7z1Fzly+xOMcB5q6tPkoxCd/l3NqRcb8zF/JFQHt rg0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d16-v6si21366052pfe.267.2018.09.04.08.28.50; Tue, 04 Sep 2018 08:29:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727686AbeIDTwg (ORCPT + 99 others); Tue, 4 Sep 2018 15:52:36 -0400 Received: from uhil19pa09.eemsg.mail.mil ([214.24.21.82]:62028 "EHLO uhil19pa09.eemsg.mail.mil" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726304AbeIDTwf (ORCPT ); Tue, 4 Sep 2018 15:52:35 -0400 X-EEMSG-check-008: 311772770|UHIL19PA09_EEMSG_MP7.csd.disa.mil Received: from emsm-gh1-uea11.ncsc.mil ([214.29.60.3]) by uhil19pa09.eemsg.mail.mil with ESMTP/TLS/DHE-RSA-AES256-SHA256; 04 Sep 2018 15:26:52 +0000 X-IronPort-AV: E=Sophos;i="5.53,329,1531785600"; d="scan'208";a="17757831" IronPort-PHdr: =?us-ascii?q?9a23=3AQ66kGBGzNAYyJuSR/HwwmJ1GYnF86YWxBRYc79?= =?us-ascii?q?8ds5kLTJ76oM24bnLW6fgltlLVR4KTs6sC17KJ9fi4EUU7or+5+EgY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TfbF340bzPGC0QuISSzxjFe7vcDznYBFZTcSEnCjxijjAY5bfr?= =?us-ascii?q?dycpoTCWeyP823wc1zh4XtWn9Z916sHVcG2Mu3dhqIdlDyxhBQ1UsMoXG8li?= =?us-ascii?q?u4yDt0kz4trqWB0yzO2ePidAcfOm5QXmVtkVDsIY2shdAAQEeodxQplAei5U?= =?us-ascii?q?vixahUuqp/L2fNQUpTcCj2KGZiUqS0trWcecJA9JQosSBPWuSmfV+aUqL9ow?= =?us-ascii?q?cd0y77BWte2Ss7dyq0tZX9mxx3k36SLHFwrHXHY8F83wvQ5NvZRfJLxDUGWT?= =?us-ascii?q?FyiSPLCVikI9mp4dKUmo/YveC/WGKhUZtTfDL2woyeryS75HdlARulk/C0gN?= =?us-ascii?q?3nHlty7Siu+9xrST/Z5Cjtf4rsyezuPfx2Y0pvGnfz7M11How4mYw10sI+w3?= =?us-ascii?q?8f066J8GIHnGG7CtBS3abzfTJZXjIQ68LE6wjinkt4JzSGwJyvBSbV+ddoe9?= =?us-ascii?q?TvOjBe4Sk69c0fTfrL4Q=3D=3D?= X-IPAS-Result: =?us-ascii?q?A2ALBQAQo45b/wHyM5BaEwEBBwEBAQQBAQoBAYMkgQ9tE?= =?us-ascii?q?iiDcohxjBwBAQEBAQEGgRAleIdriHKGUjCEAUYCg1Y3FQECAQEBAQEBAgFsH?= =?us-ascii?q?AyCNSSCXgEBAQECASMVQRALDgoCAiYCAlcGDQYCAQEQB4JHPwGBdAUID6M1g?= =?us-ascii?q?S6ELgE9hQwFgQuJZHmBB4ESJwyCKjWDAhkBAQIYhEiCVwKNcY1lCYY0iT8GF?= =?us-ascii?q?4FAhDeIYiuKfIoVIjSBISsIAhgIIQ87gmwfggYXg0WFFIVaIzABCY0kAQE?= Received: from tarius.tycho.ncsc.mil (HELO tarius.infosec.tycho.ncsc.mil) ([144.51.242.1]) by emsm-gh1-uea11.NCSC.MIL with ESMTP; 04 Sep 2018 15:26:49 +0000 Received: from moss-pluto.infosec.tycho.ncsc.mil (moss-pluto.infosec.tycho.ncsc.mil [192.168.25.131]) by tarius.infosec.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id w84FQbV4001506; Tue, 4 Sep 2018 11:26:37 -0400 Subject: Re: WARNING in apparmor_secid_to_secctx To: Dmitry Vyukov Cc: Paul Moore , syzbot , tyhicks@canonical.com, John Johansen , James Morris , LKML , linux-security-module@vger.kernel.org, Serge Hallyn , syzkaller-bugs , Jeffrey Vander Stoep , SELinux , "russell@coker.com.au" , Laurent Bigonville References: <000000000000c178e305749daba4@google.com> <37aec45f-69ad-9705-21f1-64ee4ce4a772@tycho.nsa.gov> <9537a6ff-daf4-d572-bf93-68230909b68e@tycho.nsa.gov> <4b37e892-4d79-aefb-92ab-7753b89b8963@tycho.nsa.gov> <1ea19628-3bbe-2073-d623-824337c15ed6@tycho.nsa.gov> From: Stephen Smalley Message-ID: Date: Tue, 4 Sep 2018 11:28:38 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/04/2018 11:02 AM, Dmitry Vyukov wrote: > On Tue, Sep 4, 2018 at 2:57 PM, Stephen Smalley wrote: >>>>>>>> wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> Hello, >>>>>>>>> >>>>>>>>> syzbot found the following crash on: >>>>>>>>> >>>>>>>>> HEAD commit: 817e60a7a2bb Merge branch 'nfp-add-NFP5000-support' >>>>>>>>> git tree: net-next >>>>>>>>> console output: >>>>>>>>> https://syzkaller.appspot.com/x/log.txt?x=1536d296400000 >>>>>>>>> kernel config: >>>>>>>>> https://syzkaller.appspot.com/x/.config?x=531a917630d2a492 >>>>>>>>> dashboard link: >>>>>>>>> https://syzkaller.appspot.com/bug?extid=21016130b0580a9de3b5 >>>>>>>>> compiler: gcc (GCC) 8.0.1 20180413 (experimental) >>>>>>>>> >>>>>>>>> Unfortunately, I don't have any reproducer for this crash yet. >>>>>>>>> >>>>>>>>> IMPORTANT: if you fix the bug, please add the following tag to the >>>>>>>>> commit: >>>>>>>>> Reported-by: syzbot+21016130b0580a9de3b5@syzkaller.appspotmail.com >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Hi John, Tyler, >>>>>>>> >>>>>>>> I've switched syzbot from selinux to apparmor as we discussed on lss: >>>>>>>> >>>>>>>> >>>>>>>> https://github.com/google/syzkaller/commit/2c6cb254ae6c06f61e3aba21bb89ffb05b5db946 >>>>>>> >>>>>>> >>>>>>> >>>>>>> Sorry, does this mean that you are no longer testing selinux via >>>>>>> syzbot? >>>>>>> That seems unfortunate. SELinux is default-enabled and used in >>>>>>> Fedora, RHEL and all derivatives (e.g. CentOS), and mandatory in >>>>>>> Android >>>>>>> (and seemingly getting some use in ChromeOS now as well, at least for >>>>>>> the Android container and possibly wider), so it seems unwise to drop >>>>>>> it >>>>>>> from your testing altogether. I was under the impression that you >>>>>>> were >>>>>>> just going to add apparmor to your testing matrix, not drop selinux >>>>>>> altogether. >>>>>> >>>>>> >>>>>> >>>>>> It is also important to note that testing with SELinux enabled but no >>>>>> policy loaded is not going to be very helpful (last we talked that is >>>>>> what syzbot is/was doing). While syzbot did uncover some issues >>>>>> relating to the enabled-no-policy case, those are much less >>>>>> interesting and less relevant than the loaded-policy case. >>>>> >>>>> >>>>> >>>>> I had thought that they had switched over to at least loading a policy >>>>> but >>>>> possibly left it in permissive mode because the base distribution didn't >>>>> properly support SELinux out of the box. But I may be mistaken. >>>>> Regardless, the right solution is to migrate to testing with a policy >>>>> loaded not to stop testing altogether. >>>>> >>>>> Optimally, they'd test on at least one distribution/OS where SELinux is >>>>> in >>>>> fact supported out of the box, e.g. CentOS, Android, and/or ChromeOS. >>>> >>>> >>>> >>>> Or Fedora, of course. >>> >>> >>> Hi, >>> >>> Yes, we switched from selinux to apparmor. The thing is that we >>> effectively did not test selinux lately, so it's more like just >>> enabling apparmor rather than disabling selinux. >>> >>> The story goes as follows. >>> We enabled selinux, but did not have policy and selinux wasn't enabled. >>> Then Paul (I think) pointer that out. After some debugging I figured >>> out that our debian wheezy actually has a policy, it's just that >>> selinux utilities were not installed, so init could not load the >>> policy. >>> I installed the tools, and we started loading policy. >>> But then it turned out that wheezy policy does not allows mounting >>> cgroup2 fs and maybe some others even in non-enforcing mode. As far as >>> I understand that's because the policy does not have definition for >>> the fs, and so loading bails out with an error. >>> We need cgroup2 both for testing and for better sandboxing (no other >>> way to restrict e.g. memory consumption). Moreover, we did not test >>> any actual interesting interactions with selinux (there must be some? >>> but I don't know what are they). >>> So I had to uninstall the tool and policy is not loaded again. >>> I investigated building a newer debian image with debootstrap (which >>> should have newer policy I guess). But they don't work, some cryptic >>> errors in init. Other people reported the same. >>> So that's we are. I don't have any ideas left... >> >> >> So why not ask for help from the SELinux community? I've cc'd the selinux >> list and a couple of folks involved in Debian selinux. I see a couple of >> options but I don't know your constraints for syzbot: >> >> 1) Run an instance of syzbot on a distro that supports SELinux enabled out >> of the box like Fedora. Then you don't have to fight with SELinux and can >> just focus on syzbot, while still testing SELinux enabled and enforcing. >> >> 2) Report the problems you are having with enabling SELinux on newer Debian >> to the selinux list and/or the Debian selinux package maintainers so that >> someone can help you resolve them. >> >> 3) Back-port the cgroup2 policy definitions to your wheezy policy, rebuild >> it, and install that. We could help provide guidance on that. I think >> you'll need to rebuild the base policy on wheezy; in distributions with >> modern SELinux userspace, one could do it just by adding a CIL module >> locally. > > Thanks, Stephen! > > I would like to understand first if failing mount(2) for unknown fs is > selinux bug or not. Because if it is and it is fixed, then it would > resolve the problem without actually doing anything (well, at least on > our side :)). Yes, I think that's a selinux kernel regression, previously reported here: https://lkml.org/lkml/2017/10/6/658 Unfortunately I don't think it has been fixed upstream. Generally people using SELinux with a newer kernel are also using a newer policy. That said, I agree it is a regression and ought to be fixed. >> As for exercising SELinux, you'll exercise SELinux just by enabling it and >> loading a policy, since it will perform permission checking on all object >> accesses. But you can get more extensive coverage by running the >> selinux-testsuite. We only test that on Fedora and RHEL however, so getting >> it to work on Debian might take some effort. > > That's good. > I just thought that there is some potential in making the policy > interact more with what the fuzzer does. With respect to fs accesses, > it works within own temp directory, and I guess the policy is actually > all the same for everything it does in that directory. There also may > be something related to extended attributes, context changes, etc? Yes, by default, your fuzzer is going to just run in a single security context and all files it creates will have a single security context. So the policy side of things won't be interesting and probably everything will be allowed (if it runs in the unconfined context), but you'll still exercise many code paths. The selinux-testsuite would trigger many process context changes and create files under varying contexts, so that would be more complete in its coverage.