Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1793934pxb; Thu, 4 Mar 2021 22:59:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3W5G0smJ0ifiZNnmA8HHiO5jcOKU5kEPF+FdgGRw2RMV7Q/927vIwa6RcaGP4mIko39vk X-Received: by 2002:a5d:8d03:: with SMTP id p3mr6688037ioj.64.1614927592501; Thu, 04 Mar 2021 22:59:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614927592; cv=none; d=google.com; s=arc-20160816; b=sT7vlr2LFzqF+d30b+JcciZbkF/H9NToikAHnYE6BuGQMW4VejB1+mhJsJpnOmMXLB l+YvKAg+qjYw2RuBIeUPg+GadDrvLAthrozutuqf5tNWOD6idXC/qV3eCsRicFOoIL59 YpJqN7/TsGK1Kjh0mhM/9NiQwJUInm3cWXGyREhWW68N6YhDuBhSiIcOZINRSB96FzNV 9mHPnVe0c7UETcS4W8LIkAx7Ju/F8PRA7mO5X4Whdsy4EWiaic8T3iSbBVMeNjMOHLho IhUxzd/fIznUkSKj6jMRaSMmkBdqxf9FvAVGcuruFeSk0i2hcKUAOO+SXE3WBiZBo/S/ YgEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=crYkqKoqFwnrrrwH81ErvqWRB0f4RCkUiwcymzORnOU=; b=PtVxFdKwSUlNFBCSTUUqSWqgJS1vONMzsjQpqa+bIoGWezpgu4wC/Y8ABJxySoeC82 wOhu/ooH2U+Iajk+2pVbKqYOdvMpZrKvlzqugNhgnrF9qTXkMZeWHkTpnJqqvJi5/2YQ hWTgc5JyhC4rFgOi56yxXejhYINWWepyXzQ/QkAvJByUIYYsvRxBu1aLqXdsr6qb7T/+ g2PVQQJv8Pt6Hy5OMIYnz/0v4/aQyxj+SvsJMzK/+9r3tNbDiWV9hzkexX2mvv8BdxLi BzDvjeILCI5BFajKJb3s8L5Eqmq67E7zFO+XnnQFWXe3jsfnIvJQNR+KKx0dcId/08ZT 1vCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h6si1461210ili.15.2021.03.04.22.59.23; Thu, 04 Mar 2021 22:59:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229457AbhCEG6R (ORCPT + 99 others); Fri, 5 Mar 2021 01:58:17 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:33475 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbhCEG6R (ORCPT ); Fri, 5 Mar 2021 01:58:17 -0500 X-Originating-IP: 78.199.60.242 Received: from [192.168.1.150] (unknown [78.199.60.242]) (Authenticated sender: hadess@hadess.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id CAB75E0003; Fri, 5 Mar 2021 06:58:15 +0000 (UTC) Message-ID: <37f515403ea2c653154a8e1b7b8c4852e861327f.camel@hadess.net> Subject: Re: [PATCH 1/3] build: Add warnings for non-literal strings From: Bastien Nocera To: Luiz Augusto von Dentz Cc: "linux-bluetooth@vger.kernel.org" Date: Fri, 05 Mar 2021 07:58:15 +0100 In-Reply-To: References: <20210304124851.219154-1-hadess@hadess.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Thu, 2021-03-04 at 10:54 -0800, Luiz Augusto von Dentz wrote: > Hi Bastien, > > On Thu, Mar 4, 2021 at 10:46 AM Bastien Nocera > wrote: > > > > On Thu, 2021-03-04 at 10:35 -0800, Luiz Augusto von Dentz wrote: > > > Hi Bastien, > > > > > > On Thu, Mar 4, 2021 at 9:21 AM Bastien Nocera > > > wrote: > > > > > > > > --- > > > >  acinclude.m4 | 2 +- > > > >  1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/acinclude.m4 b/acinclude.m4 > > > > index 529848357..6ae34b8ae 100644 > > > > --- a/acinclude.m4 > > > > +++ b/acinclude.m4 > > > > @@ -21,7 +21,7 @@ AC_DEFUN([COMPILER_FLAGS], [ > > > >                 with_cflags="$with_cflags -Wredundant-decls" > > > >                 with_cflags="$with_cflags -Wcast-align" > > > >                 with_cflags="$with_cflags -Wswitch-enum" > > > > -               with_cflags="$with_cflags -Wformat -Wformat- > > > > security" > > > > +               with_cflags="$with_cflags -Wformat -Wformat- > > > > security > > > > -Wformat-nonliteral" > > > > > > Does it actually have any benefit of having the format as always > > > string literal? I'm not really a big fan of using pragmas. > > > > It's a security feature[1], so it's pretty important that we avoid > > using non-literals when some of the arguments are user controlled, > > especially in a networked daemon. We already enabled > > "-Wformat-security", so not that much of a difference. > > > > This warning is also enabled by default on Fedora's GCC, so I get > > to > > see it whether I want to or not. > > > > I'd be happy actually fixing those warnings if you don't want > > pragmas > > at all, it would just be more code movement. If we can get those > > patches in, I can do a follow-up. > > > > [1]: Quick search gave me this explanation: > > https://owasp.org/www-community/attacks/Format_string_attack > > You should probably add the above link in the patch description, > regarding the use of pragma. I'd say we need to convert to use > literals directly then since otherwise we are not actually fixing > anything We're presumably stopping new non-literals from being introduced... As I mentioned, I can do a follow-up, but I'm not going to do the work until this patch series is merged. I've sent it a number of times already and after 4 years, I'm not sure I want to do the work again only for it to rot in my repo. > just returning it back to ignore the error where we don't use > literals. > > > > >                 with_cflags="$with_cflags - > > > > DG_DISABLE_DEPRECATED" > > > >                 with_cflags="$with_cflags - > > > > DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_28" > > > >                 with_cflags="$with_cflags - > > > > DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32" > > > > -- > > > > 2.29.2 > > > > > > > > > > > > > > > >