Skip to content

Commit

Permalink
selinux: change handling of invalid classes (Was: Re: 2.6.26-rc5-mm1 …
Browse files Browse the repository at this point in the history
…selinux whine)

On Mon, 2008-06-09 at 01:24 -0700, Andrew Morton wrote:
> Getting a few of these with FC5:
>
> SELinux: context_struct_compute_av:  unrecognized class 69
> SELinux: context_struct_compute_av:  unrecognized class 69
>
> one came out when I logged in.
>
> No other symptoms, yet.

Change handling of invalid classes by SELinux, reporting class values
unknown to the kernel as errors (w/ ratelimit applied) and handling
class values unknown to policy as normal denials.

Signed-off-by:  Stephen Smalley <[email protected]>
Acked-by: Eric Paris <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
stephensmalley authored and James Morris committed Jul 14, 2008
1 parent 89abd0a commit 22df4ad
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions security/selinux/ss/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,19 @@ static int context_struct_compute_av(struct context *scontext,
return 0;

inval_class:
printk(KERN_ERR "SELinux: %s: unrecognized class %d\n", __func__,
tclass);
return -EINVAL;
if (!tclass || tclass > kdefs->cts_len ||
!kdefs->class_to_string[tclass]) {
if (printk_ratelimit())
printk(KERN_ERR "SELinux: %s: unrecognized class %d\n",
__func__, tclass);
return -EINVAL;
}

/*
* Known to the kernel, but not to the policy.
* Handle as a denial (allowed is 0).
*/
return 0;
}

/*
Expand Down

0 comments on commit 22df4ad

Please sign in to comment.