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]
Message-ID: <CAGXu5jKFoTjvr-EHUYHn7TSgEfiwn2BJ1J4Dwu3FGOLmz+TxvA@mail.gmail.com>
Date:   Mon, 14 Jan 2019 17:07:16 -0800
From:   Kees Cook <keescook@...omium.org>
To:     Willy Tarreau <w@....eu>
Cc:     Silvio Cesare <silvio.cesare@...il.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Dan Carpenter <dan.carpenter@...cle.com>,
        Will Deacon <will.deacon@....com>, Greg KH <greg@...ah.com>
Subject: Re: [PATCH 1/8] lkdtm: change snprintf to scnprintf for possible overflow

On Mon, Jan 14, 2019 at 5:02 PM Kees Cook <keescook@...omium.org> wrote:
> On Sat, Jan 12, 2019 at 7:28 AM Willy Tarreau <w@....eu> wrote:
> > From: Silvio Cesare <silvio.cesare@...il.com>
> > Change snprintf to scnprintf. There are generally two cases where using
> > snprintf causes problems.
>
> (I didn't find a 0/8 cover letter, so I'm replying here...)

I forgot to mention: can we please get a Coccinelle rule added to
catch these cases in the future? (And make sure sfr is running it? :)
)

My attempt at it was:

@@
expression LEN, BUF, SIZE;
identifier FUNC;
@@

  LEN += snprintf(BUF + LEN, SIZE - LEN, ...);
  ... when != LEN &gt; SIZE
      when != LEN &gt;= SIZE
* FUNC(..., LEN, ...)

But this needs adjustment to deal with some false positives (like using min()).

--
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ