From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: 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: Wed, 10 Oct 2018 10:09:32 +0200 [thread overview]
Message-ID: <20181010080932.h6nln2qsgg4oef4l@pathway.suse.cz> (raw)
In-Reply-To: <20181009135758.GA1419@tigerII.localdomain>
On Tue 2018-10-09 22:57:58, Sergey Senozhatsky wrote:
> 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?
INT_MAX is 0x7fffffff but we need 0x80000000. I did not find
any predefined macro.
>
> > + 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
Best Regards,
Petr
next prev parent reply other threads:[~2018-10-10 8:09 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
2018-10-10 8:09 ` Petr Mladek [this message]
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=20181010080932.h6nln2qsgg4oef4l@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).