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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 20 Jan 2022 15:09:32 -0800
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Sergei Trofimovich <slyich@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] objtool: check: give big enough buffer for pv_ops

On Thu, Jan 20, 2022 at 02:58:13PM -0800, Josh Poimboeuf wrote:
> On Fri, Jan 14, 2022 at 09:53:07AM +0100, Peter Zijlstra wrote:
> > On Fri, Jan 14, 2022 at 07:57:56AM +0000, Sergei Trofimovich wrote:
> > > On gcc-12 build fails flagging possible buffer overflow:
> > > 
> > >     check.c: In function 'validate_call':
> > >     check.c:2865:58: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 9 [-Werror=format-truncation=]
> > >      2865 |                 snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx);
> > >           |                                                          ^~
> > > 
> > > I think it's a valid warning:
> > > 
> > >     static char pvname[16];
> > >     int idx;
> > >     ...
> > >     idx = (rel->addend / sizeof(void *));
> > >     snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx);
> > > 
> > > we have only 7 chars for %d while it could take up to 9.
> > 
> > Right, very unlikely to have that many pv_ops, but it doesn't hurt to
> > fix this.
> > 
> > Thanks!
> 
> Alternatively, 'idx' could just be unsigned char, since pv_ops only has
> about ~80 entries max, but either way works for me.  I'll queue it up.

Sergei, can you send a v2 with a valid Signed-off-by tag?

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ