2007-08-10 08:10:20

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: + sysctl-error-on-bad-sysctl-tables.patch added to -mm tree

On Thu, Aug 09, 2007 at 03:11:50PM -0700, [email protected] wrote:
> Subject: sysctl: Error on bad sysctl tables
> From: Eric W. Biederman <[email protected]>
>
> After going through the kernels sysctl tables several times it has become
> clear that code review and testing is just not effective in prevent
> problematic sysctl tables from being used in the stable kernel. I certainly
> can't seem to fix the problems as fast as they are introduced.
>
> Therefore this patch adds sysctl_check_table which is called when a sysctl
> table is registered and checks to see if we have a problematic sysctl table.
>
> The biggest part of the code is the table of valid binary sysctl entries, but
> since we have frozen our set of binary sysctls this table should not need to
> change, and it makes it much easier to detect when someone unintentionally
> adds a new binary sysctl value.
>
> As best as I can determine all of the several hundred errors spewed on boot up
> now are legitimate.

It gives false positive on kernel.pty.nr:

sysctl table check failed: /kernel/pty/nr .1.62.2 No data

However, ->data is set in unix98_pty_init().


2007-08-10 09:23:33

by Eric W. Biederman

[permalink] [raw]
Subject: Re: + sysctl-error-on-bad-sysctl-tables.patch added to -mm tree

Alexey Dobriyan <[email protected]> writes:

> It gives false positive on kernel.pty.nr:
>
> sysctl table check failed: /kernel/pty/nr .1.62.2 No data
>
> However, ->data is set in unix98_pty_init().

It's a race.

Data isn't set until after we enable the sysctl subsystem.

In practice I doubt it matters but I think would rather fix
that one case (by using register_sysctl_table) then not have
the check.

Eric