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] [day] [month] [year] [list]
Date:   Wed, 10 Oct 2018 17:21:29 +0900
From:   Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        zhe.he@...driver.com, rostedt@...dmis.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 4/4] printk: Give error on attempt to set log buffer
 length to over 4G

On (10/10/18 10:09), Petr Mladek wrote:
> > > +#define LOG_BUF_LEN_MAX (u32)(1 << 31)
> > [..]
> > > +	if (size > (u64)LOG_BUF_LEN_MAX) {
> > > +		size = (u64)LOG_BUF_LEN_MAX;
> > > +		pr_err("log_buf over 2G is not supported.\n");
> > > +	}
> > 
> > Why not INT_MAX?
> 
> INT_MAX is 0x7fffffff but we need 0x80000000. I did not find
> any predefined macro.

Hmm, OK. I need to think about it more.

> > > +	pr_info("log_buf_len: %u bytes\n", log_buf_len);
> > > +	pr_info("early log buf free: %u(%u%%)\n",
> > >  		free, (free * 100) / __LOG_BUF_LEN);
> > 
> > Can 'free * 100' overflow?
> 
> Good question. It uses the size of the static buffer. If I count
> correctly then we are on the safe side because LOG_BUF_SHIFT
> is limited by
> 
> 	range 12 25

I didn't know there was Kconfig "range" :)

$ echo $(((1<<25)*100))
3355443200

	-ss

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ