All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	zhe.he@windriver.com, rostedt@goodmis.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 4/4] printk: Give error on attempt to set log buffer length to over 4G
Date: Tue, 9 Oct 2018 22:57:58 +0900	[thread overview]
Message-ID: <20181009135758.GA1419@tigerII.localdomain> (raw)
In-Reply-To: <20181009130538.7rtd3du2d7l6m63w@pathway.suse.cz>

On (10/09/18 15:05), Petr Mladek wrote:
> > 
> > Yeah, I think we gonna have problems even with a 4G logbuf and a 32-bit
> > user-space doing syslog(int len).
> > 
> > I agree on the "not motivated enough" part ;)
> 
> OK, I have pushed an updated patch that has the limit 2GB
> into printk.git, for-4.20 branch.
> 
> Note that it is slightly different than the yesterday's proposal.
> I made a mistake in testing and still compared with UNIT_MAX.
> 
> The pushed version can be seen at
> https://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk.git/commit/?h=for-4.20&id=e6fe3e5b7d16e8f146a4ae7fe481bc6e97acde1e


---

> +#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?


> +	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?

	-ss

  reply	other threads:[~2018-10-09 13:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-29 16:45 [PATCH v5 1/4] printk: Fix panic caused by passing log_buf_len to command line zhe.he
2018-09-29 16:45 ` [PATCH v5 2/4] printk: Correct wrong casting zhe.he
2018-10-02  5:50   ` Sergey Senozhatsky
2018-10-08 13:03     ` Petr Mladek
2018-09-29 16:45 ` [PATCH v5 3/4] printk: Add KBUILD_MODNAME and remove a redundant print prefix zhe.he
2018-10-02  5:52   ` Sergey Senozhatsky
2018-10-08 13:04   ` Petr Mladek
2018-09-29 16:45 ` [PATCH v5 4/4] printk: Give error on attempt to set log buffer length to over 4G zhe.he
2018-10-02  5:51   ` Sergey Senozhatsky
2018-10-08 13:59   ` Petr Mladek
2018-10-08 14:59     ` Sergey Senozhatsky
2018-10-09 13:05       ` Petr Mladek
2018-10-09 13:57         ` Sergey Senozhatsky [this message]
2018-10-10  8:09           ` Petr Mladek
2018-10-10  8:21             ` Sergey Senozhatsky
2018-10-08 16:30     ` He Zhe
2018-10-02  5:48 ` [PATCH v5 1/4] printk: Fix panic caused by passing log_buf_len to command line Sergey Senozhatsky
2018-10-08 13:01 ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181009135758.GA1419@tigerII.localdomain \
    --to=sergey.senozhatsky@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=zhe.he@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.