[apparmor] [patch] fix disabling printk_ratelimit in aa-genprof

Seth Arnold seth.arnold at canonical.com
Mon Jun 9 18:36:57 UTC 2014


On Mon, Jun 09, 2014 at 08:33:28PM +0200, Christian Boltz wrote:
> Hello,
> 
> aa-genprof failed to set /proc/sys/kernel/printk_ratelimit to 0 
> (unlimited) because the "if not value:" check matches 0.
> 
> This patch replaces the check with "... is None".
> 
> 
> === modified file 'utils/aa-genprof'
> --- utils/aa-genprof    2014-05-21 19:42:43 +0000
> +++ utils/aa-genprof    2014-06-09 18:31:07 +0000
> @@ -33,7 +33,7 @@
>      return value
>  
>  def sysctl_write(path, value):
> -    if not value:
> +    if value is None:
>          return
>      with open(path, 'w') as f_out:
>          f_out.write(str(value))

Why do we even have the check? Wouldn't it make more sense to throw an
error condition if sysctl_write() is being used incorrectly? (either when
str(value) blows up, in usual-python-style, or with an explicit check of
expected value ranges?)

Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20140609/19f2582d/attachment.pgp>


More information about the AppArmor mailing list