Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp204353pxa; Fri, 21 Aug 2020 05:16:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgjY5DdKOxQaqS/lp8Y2dFYau9whai3U1ag6dBK1R0IF2dO9OYxQjZlcpLfnA7mdYGvA0y X-Received: by 2002:a17:906:aad2:: with SMTP id kt18mr2587027ejb.537.1598012214414; Fri, 21 Aug 2020 05:16:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598012214; cv=none; d=google.com; s=arc-20160816; b=0yrlak+5n0WnSC8Uvuxh4PzN+YL6sXH2RyoMQsX4Mu+iczNXpeEoE8QT2qvLAD5Tar KNiK78LOz7/2t/rW0ZjtY9m8kDgck8ByaPeicdNEyT0tQ7HRpD1mTA1CbLcfFiyKQPsW nIYlhQuA2t2LPHEzc8NDxmvPpAq5CkpqVdQ+X7YDk2BklIYrmLgrsvsg8cFzsEg8bUjt 1nVFT7NGGuSzdH1iwyNEXnjHAtc0qiEoki8Np0pqrOEVkIr+zNdN1gUlT0Sv3uFwyk5V 1ubvvbiyoqWk82VTQLu4APhDS8w/lGLTMeW7+wrHE3mo27D3+B1Lzh6acaK7Ov1L/UyV 8OOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=SgDeAg08mFvRbn4SjuUaCVJq4IHVZKTa47Sz3vQfoKs=; b=dEh55GRQhKZ8SDIezn4K64vry3nbYZ9SRj95zadwU9N1Q6SN/DwVA5P30KbsPmWKed Wam9z2wkOmjbM+1a4Dh3hNpxDLpKKeNte8Bzb8+5Slf7Th6ijdtbfhwp/y8R4yeVunLb /LPolouyF3o73i0yBnn6K9MCuKsq6iK8lR82ungUvXRWynKDTmzFlb9KdwMzzKfOuPp+ 48PTTSkem/Ye1aZpzbrfkty5k1K+zkSGawC5HXihJ2IsJOvLq3kp+JsvZTudeYcL6CWT MW5tkn1rCfzVrHR+EYMDgRFSUBdfbgZO6RtbrvoZI9fURManIUZF2zQjgAAAWiynn2dZ UD9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=r8x8INlm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ok21si1101384ejb.373.2020.08.21.05.16.30; Fri, 21 Aug 2020 05:16:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=r8x8INlm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727838AbgHUMPj (ORCPT + 99 others); Fri, 21 Aug 2020 08:15:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726257AbgHUMPJ (ORCPT ); Fri, 21 Aug 2020 08:15:09 -0400 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34C8AC061385; Fri, 21 Aug 2020 05:15:09 -0700 (PDT) Received: by mail-oi1-x242.google.com with SMTP id b22so1314262oic.8; Fri, 21 Aug 2020 05:15:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SgDeAg08mFvRbn4SjuUaCVJq4IHVZKTa47Sz3vQfoKs=; b=r8x8INlmyoCzm36Urkdb25+9EjQbty79MyCXhHD4WJgt8+yVVYQmfWfgAp1UDWhSUb +pBbuDrG96hyTxqhc+G82AEVHgcjUujjGYtSnpTHMG9eEKZiPMhVnVHusgJO2rSfBGuG rx0u1eNVG0UGKF7SxsYUFmx6CD/XZKxvflGTRPCuAoWd3b+sMhJaLZxUW+FZkhQALX5j W69WVCxXx7DkgC8AAvw6vhgkyBpuEjrBltShJgyLqNhI83ChtmwU3G8W7PASStp7FcOK NU0liX9OhQEgEq+skOTTXtxtq/61gS/Kq2TXt30gcDHL81J4zRy5gO3gTl3a5+3+FEBB fZhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SgDeAg08mFvRbn4SjuUaCVJq4IHVZKTa47Sz3vQfoKs=; b=ZPLjrjdzWfDEr+TT5QP1NAZOI3XnlUS/ep4IMq+ohcYYV3rmAkcb4i2Nw/EZdbZhq8 LQZSEudSqoDyaSpmXl8ZBc+O4KDfmKD+6I133WezLOtybF6pc3ESGzbL9Ap9MmGx6JlT BJBGCF3kyuOKM5v5K/T9MH4UpdFPTWM5c1hxmRkUZ4XduD1P+hVsBAAcn2tEUjS1I0pH xU+E1DwJLNPj0tpz6K0juw99FF7Cez1rvPZMy0jaSE/PGoeAzXEGPkx8gXDZAlo0TfCW g1NDP4jHSu18ka8YHezP0bCWcUQ+oII5KAJBqZq2F1q1arfkCkhkfmOrowtaDSpMjADy ubMg== X-Gm-Message-State: AOAM530Bd9SPEwE9CT3kjz/Zikm7HZ9Aj/5D2hEIm+EWBsuoIq2vi3lX 61AwkuBYeUjEdmM8qNNXzy3xrSYXFHZq1Zphgtc= X-Received: by 2002:a54:4817:: with SMTP id j23mr1532133oij.140.1598012108392; Fri, 21 Aug 2020 05:15:08 -0700 (PDT) MIME-Version: 1.0 References: <20200817170729.2605279-1-tweek@google.com> <20200817170729.2605279-4-tweek@google.com> <6730ec4a-d11b-5c05-b64f-380104a86dab@sony.com> In-Reply-To: From: Stephen Smalley Date: Fri, 21 Aug 2020 08:14:57 -0400 Message-ID: Subject: Re: [PATCH v3 3/3] selinux: add permission names to trace event To: Paul Moore Cc: peter enderborg , =?UTF-8?Q?Thi=C3=A9baud_Weksteen?= , Nick Kralevich , Steven Rostedt , Eric Paris , Ingo Molnar , Mauro Carvalho Chehab , "David S. Miller" , Rob Herring , linux-kernel , SElinux list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 20, 2020 at 10:22 PM Paul Moore wrote: > > On Tue, Aug 18, 2020 at 8:14 AM Stephen Smalley > wrote: > > On Tue, Aug 18, 2020 at 4:11 AM peter enderborg wrote: > > ... > > > > Is there any other things we need to fix? A part 1&2 now OK? > > > > They looked ok to me, but Paul should review them. > > Patches 1 and 2 look fine to me with the small nits that Stephen > pointed out corrected. I'm glad to see the information in string form > now, I think that will be a big help for people making use of this. > > Unfortunately, I'm a little concerned about patch 3 for the reason > Stephen already mentioned. While changes to the class mapping are > infrequent, they do happen, and I'm not very excited about adding it > to the userspace kAPI via a header. Considering that the tracing > tools are going to be running on the same system that is being > inspected, perhaps the tracing tools could inspect > /sys/fs/selinux/class at runtime to query the permission mappings? > Stephen, is there a libselinux API which does this already? There is a libselinux API but both it and the /sys/fs/selinux/class tree is exposing the policy values for classes/permissions, not the kernel-private indices. The dynamic class/perm mapping support introduced a layer of indirection between them. The tracepoint is in the avc and therefore dealing with the kernel-private values, not the policy values. The mapping occurs on entry/exit of the security server functions. So there is no way for userspace to read the kernel class/perm values. We'd just need to keep them in sync manually. And one is allowed to insert new classes or permissions before existing ones, thereby changing the values of existing ones, or even to remove them.