lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 13 Jun 2014 15:05:59 -0700
From:	"Luis R. Rodriguez" <mcgrof@...not-panic.com>
To:	Davidlohr Bueso <davidlohr@...com>
Cc:	hpa@...ux.intel.com, Andrew Morton <akpm@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Michal Hocko <mhocko@...e.cz>, Petr Mladek <pmladek@...e.cz>,
	Joe Perches <joe@...ches.com>,
	Arun KS <arunks.linux@...il.com>,
	Kees Cook <keescook@...omium.org>,
	Chris Metcalf <cmetcalf@...era.com>
Subject: Re: [PATCH v3] printk: allow increasing the ring buffer depending on
 the number of CPUs

On Fri, Jun 13, 2014 at 2:41 PM, Davidlohr Bueso <davidlohr@...com> wrote:
> On Fri, 2014-06-13 at 11:28 -0700, Luis R. Rodriguez wrote:
>> +     /*
>> +      * If you set log_buf_len=n kernel parameter LOG_CPU_MIN_BUF_SHIFT will
>> +      * be ignored. LOG_CPU_MIN_BUF_SHIFT is a proactive measure for large
>> +      * systems. With a LOG_BUF_SHIFT of 18 and LOG_CPU_MIN_BUF_SHIFT 12 at
>> +      * we'd require more than 64 CPUs to trigger an increase from the
>> +      * default.
>> +      */
>> +     if (!new_log_buf_len && (cpu_extra > __LOG_BUF_LEN / 2))
>              ^ that ! looks wrong.

That check is there so that we ignore the cpu_extra stuff if the
kernel parameter was passed, given that in that case new_log_buf_len
would be set.

> We should be checking for log_buf_len set instead.

When log_buf_len=n is set as a kernel parameter log_buf_len_setup()
will set new_log_buf_len to something, the sanity test to not update
the ring buffer unless the value passed is greater than the default
value is checked by log_buf_len_setup().

>> +             new_log_buf_len = __LOG_BUF_LEN + cpu_extra;
>
> You could also move the whole thing below the return statement, that way
> we can avoid double checking new_log_buf_len. Otherwise looks kinda
> weird.

If we did we'd be forcing the kernel parameter to be used to enable
this functionality, but we don't want that.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ