Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3703064rdb; Wed, 13 Sep 2023 23:05:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDBqdFOHzVjPa7qq+eC6KKgeWHGaKm3ixcmjPUBGnnJfYntgGsapdoF8iY9mfamt6VXTgu X-Received: by 2002:a05:6358:989a:b0:133:428:35dc with SMTP id q26-20020a056358989a00b00133042835dcmr4864444rwa.11.1694671511443; Wed, 13 Sep 2023 23:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694671511; cv=none; d=google.com; s=arc-20160816; b=deDc7YdIg7s+lkev5WpRCK8afrnVom1eic5FlSsKxST9U9w7sqUidQA0VseALC+KFP cY1JkbZquZpM5lKI6/6LqR0LWncqJfHwgDtRh1zTyF3XYUo/rouDOwp24KSi22r+yNBm oSc+8lqWHlVHBxYmps5ZHVeJD/rNw3RPVmxS8DFoh43DTlLRZOqkrJQYu/GXV1lrSR9B 3ZvlKaL9XWJqQFzVp7LrF8DasRLyRiBvODVHI7QBu3I9+iM497dDOLhil6jEya5YVTl/ 3C6oqovBPnfj/bhXgx8c7hvrbHLbs/EbH+M9gtE25oVatWzbtsnwQ2jxKXpdzp4sXZbl X1Jw== 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=uTQ+RRbRuRtpDn9v8bCeJP7NnnGIRM2PudB4oWDtzbc=; fh=QNshexqnSOBXYm3AOUGd2m7n4W484inTmyuTCHNUyjc=; b=ZScah/tLy1Ql03x4a3eMT+ZcWJJhn2jgjAcvpVY+94nLfH1yuhJcUiVDTxg2BxSb6T VZ5Jy/7AqpHlrMwo+csUcSsvHfujcy9Fo2x2FZctckSfNuTtPieWlITcbCLqeJ0S42pi gN7Nvod3QBHc59+LdrJnhiKEYtMdFXQGrgcjRb7xtaGxyDVAgzeWL6E6+sgk7vVnce+O T75A/yUIYh1PBTIkLJAuQkIht+TIT2QL55gDCV1kdsYelY6xzjMgbJHNmGXDJkdSU8oD 8ERUdDGEOYM5rLFrLmGw1WlQKe1dp7WT2w9ROPIDhX5sAW9fjkte1ZdF0VAN5LUIlkQT GHHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Mg9jfBBJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id x63-20020a636342000000b00565f4166f4bsi825582pgb.284.2023.09.13.23.05.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 23:05:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=Mg9jfBBJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-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 howler.vger.email (Postfix) with ESMTP id B3BA4834821B; Wed, 13 Sep 2023 11:03:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231466AbjIMSD0 (ORCPT + 99 others); Wed, 13 Sep 2023 14:03:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231272AbjIMSDZ (ORCPT ); Wed, 13 Sep 2023 14:03:25 -0400 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D12019BB; Wed, 13 Sep 2023 11:03:21 -0700 (PDT) Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-6bb07d274feso56370a34.0; Wed, 13 Sep 2023 11:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694628201; x=1695233001; 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=uTQ+RRbRuRtpDn9v8bCeJP7NnnGIRM2PudB4oWDtzbc=; b=Mg9jfBBJzqPFRd/LY71um27RaAwh+uTfOy3ePzLIRykrwv3Ia5zwkNaF5WIm8bCvVT IC7VcAi/eT4cVbKuxuOFud7OlvJH9lSLCeSbpevgun8hTu1pk2ZV2TK8HVSylc9JUZIH utk6aC4qJQUNdQ6wS6j+1PdiopGgHo6yxyrtSPTZpMMbbWhgWSAXnhMKu6eR9Z591LDu 2/G1EO/dndAMA/Jrq/lrw/ByGeIqJrW+8YhLnFYmEn+ijeRC9PCUJ3cfQLmvcYTCca+4 /fUUef/fGriHDz+9f8YYLyANc5O40Ojg2v0YR72ZBRME56NSIfwv3R19303G285PKyG7 1RGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694628201; x=1695233001; 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=uTQ+RRbRuRtpDn9v8bCeJP7NnnGIRM2PudB4oWDtzbc=; b=LuJugtLjBTtRA8YVzsLn+kB4odKEoIVmjK8pzOknNoyjLrz9MHjNjptRmSIKJFqrf0 EeEnx6VLd+ix8Uv3gDz1JsE/ctZyR2uKnDohKMX/NPvmWboW/E+FZi3v5jGCOXPJN6nE rZhGjV6zm16qtL45JsLS5zmJdsY/4z2F4p086k1Tv4Y/ba4oHKTqmgDtGnEvAolRaLSb z4+GVeBOu3vnudIe06r8uX/r9J/JYyjfLX9OCTlrdn4BvDn/UpvjLG+5p2o6ryHvP7T+ xE4iDltUECkaRfbsYEBoqNc00ozM7Mh3SiQnqhhVqgwV28+nBsOR4IMk2fNdxVQjgkGB eNlw== X-Gm-Message-State: AOJu0YwwLKQHX1bEfmf357D/jmKk8d81TbYhZ7mKwzfigrmXWcwrtQoU I3Ns0K/sL2XZPUkEjU3IWMx+sK8ajzUtIAkgLp8= X-Received: by 2002:a9d:6845:0:b0:6b8:9483:35ba with SMTP id c5-20020a9d6845000000b006b8948335bamr3641544oto.24.1694628200630; Wed, 13 Sep 2023 11:03:20 -0700 (PDT) MIME-Version: 1.0 References: <20230818151220.166215-1-cgzones@googlemail.com> In-Reply-To: From: Stephen Smalley Date: Wed, 13 Sep 2023 14:03:09 -0400 Message-ID: Subject: Re: [PATCH 2/6] selinux: dump statistics for more hash tables To: Paul Moore Cc: =?UTF-8?Q?Christian_G=C3=B6ttsche?= , selinux@vger.kernel.org, Eric Paris , Ondrej Mosnacek , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 11:03:29 -0700 (PDT) On Wed, Sep 13, 2023 at 12:12=E2=80=AFPM Paul Moore w= rote: > > On Thu, Sep 7, 2023 at 1:42=E2=80=AFPM Stephen Smalley > wrote: > > On Fri, Aug 18, 2023 at 11:12=E2=80=AFAM Christian G=C3=B6ttsche > > wrote: > > > > > > Dump in the SELinux debug configuration the statistics for the > > > conditional rules avtab, the role transition, and class and common > > > permission hash tables. > > > > > > Signed-off-by: Christian G=C3=B6ttsche > > > --- > > > > > diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/pol= icydb.c > > > index 84f02d4f8093..932e383bcad6 100644 > > > --- a/security/selinux/ss/policydb.c > > > +++ b/security/selinux/ss/policydb.c > > > @@ -1158,6 +1158,8 @@ static int common_read(struct policydb *p, stru= ct symtab *s, void *fp) > > > goto bad; > > > } > > > > > > + hash_eval(&comdatum->permissions.table, "common_permissions")= ; > > > + > > > rc =3D symtab_insert(s, key, comdatum); > > > if (rc) > > > goto bad; > > > @@ -1339,6 +1341,8 @@ static int class_read(struct policydb *p, struc= t symtab *s, void *fp) > > > goto bad; > > > } > > > > > > + hash_eval(&cladatum->permissions.table, "class_permissions"); > > > + > > > rc =3D read_cons_helper(p, &cladatum->constraints, ncons, 0, = fp); > > > if (rc) > > > goto bad; > > > > Do we want to embed the actual common and class keys in the output to > > distinguish among the multiple common and class permissions tables? > > That seems reasonable, were you thinking of just adding it to the > hash_eval()'s hash name string, e.g. "common_permissions[XXX]"? Yes, otherwise you get a bunch of common_permissions and class_permissions lines with no way to correlate.