The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: [PATCH v3 10/14] selinux: validate symbols
       [not found] <20250511173055.406906-10-cgoettsche@seltendoof.de>
@ 2026-05-06 23:43 ` Paul Moore
  0 siblings, 0 replies; only message in thread
From: Paul Moore @ 2026-05-06 23:43 UTC (permalink / raw)
  To: Christian Göttsche, selinux
  Cc: Christian Göttsche, Stephen Smalley, Ondrej Mosnacek,
	linux-kernel, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
	Justin Stitt, llvm

On May 11, 2025 =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgoettsche@seltendoof.de> wrote:
> 
> Some symbol tables need to be validated after indexing, since during
> indexing their referenced entries might not yet have been indexed.
> 
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
> Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> ---
>  security/selinux/ss/policydb.c | 94 ++++++++++++++++++++++++++++++++++
>  1 file changed, 94 insertions(+)

...

> diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
> index f8d6e993ce89..4559c8918134 100644
> --- a/security/selinux/ss/policydb.c
> +++ b/security/selinux/ss/policydb.c
> @@ -765,6 +843,16 @@ static int policydb_index(struct policydb *p)
>  		if (rc)
>  			goto out;
>  	}
> +
> +	for (i = 0; i < SYM_NUM; i++) {
> +		if (!validate_f[i])
> +			continue;
> +
> +		rc = hashtab_map(&p->symtab[i].table, validate_f[i], p);
> +		if (rc)
> +			goto out;
> +	}

Is there a reason why we need a second loop to do the validation?  Can we
simply do the validation in the indexing loop above this?

  for (i = 0; i < SYM_NUM; i++) {
    p->table[i] = kvcalloc(...);

    hashtab_map(p->table, index_f[i]);

    if (validate_f[i])
      hashtab_map(p->table, validate_f[i]);
  }

--
paul-moore.com

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-06 23:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250511173055.406906-10-cgoettsche@seltendoof.de>
2026-05-06 23:43 ` [PATCH v3 10/14] selinux: validate symbols Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox