Received: by 10.213.65.68 with SMTP id h4csp584226imn; Sat, 17 Mar 2018 15:56:45 -0700 (PDT) X-Google-Smtp-Source: AG47ELtDNi4XVjFbuazmmN1QT5OApxOD8JKuEG3njQ/7S6LNbZb0SgGsDYZAW02z2Xku7+GWiMHM X-Received: by 10.99.150.2 with SMTP id c2mr5364415pge.352.1521327405026; Sat, 17 Mar 2018 15:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521327404; cv=none; d=google.com; s=arc-20160816; b=sBLBY7Rp/FwYu4soD4Hxv3VOVc5u3KzJ/qD+N+ha4treduTxgrpsBVyzrRdCLT9Y2c 3otNFoZZ2lsWT+eW33sE29JqsndFHNOpEqfgXEsDL7tUgmXZByfYiOYXjcY3Il8mzI5b v8FD+Px3IXo0wHNeQtzE41WPGaeporYWP4SDfgbmU7fsVeOVxYTpv0qeynH2IfZb9+ga VSTkAo5ZFWa/Mi1sIkj+romfM4CbMqYKgXBsITnfkyP+QF/5a4uNrJZ8MQqf/kCQBNa8 LxL0klSmTcsNU++Q1SxL8RaeHVABb0oVERS7c5ZGmrGUEOvU23yHSbAu3LhHFKrll7gb 4dNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=axO1CHEoQB4zFM15EMLRl+Ov+TyIwfRxpOreeF1NtK4=; b=VtWXCzwJGrGKL4KPDtBPgh2fgsPBBXpYPfY79KWo5R/wAbE0Iq9nEnxVuHt3bzguSm Ty6QMLlvYoQlsxgg1TY4u6+PDVbYViVVarhAKgWlgNNZQQHblu1B7AfMTGvmmCVPc+Dt 1qDeYMUMMmW+dw/KNrGQSpcGBAteH0rjL/MkBoF+HIDF32gdnutEveClqyzlsl3QNGy6 HM38FpCa1U6A3gbAP/af65eLd6LVNjMjdktZNHu/q1Txc5ROU0AWNPY14KdqsadsWUJg MNX80nxFjsfP52C2eASpt/qkdbKgHSjFlDjiC9pD7q+EVadHOi3VVF+ajq5sIcc0S7OY yYHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4-v6si8891634plr.598.2018.03.17.15.56.30; Sat, 17 Mar 2018 15:56:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753222AbeCQWzb (ORCPT + 99 others); Sat, 17 Mar 2018 18:55:31 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53574 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752295AbeCQWz1 (ORCPT ); Sat, 17 Mar 2018 18:55:27 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C3440427096C; Sat, 17 Mar 2018 22:55:26 +0000 (UTC) Received: from treble (ovpn-120-167.rdu2.redhat.com [10.10.120.167]) by smtp.corp.redhat.com (Postfix) with ESMTP id CAC3D2166BAE; Sat, 17 Mar 2018 22:55:24 +0000 (UTC) Date: Sat, 17 Mar 2018 17:55:24 -0500 From: Josh Poimboeuf To: Kees Cook Cc: Linus Torvalds , Al Viro , Florian Weimer , Andrew Morton , Rasmus Villemoes , Randy Dunlap , Miguel Ojeda , Ingo Molnar , David Laight , Ian Abbott , linux-input , linux-btrfs , Network Development , Linux Kernel Mailing List , Kernel Hardening Subject: Re: [PATCH v5 0/2] Remove false-positive VLAs when using max() Message-ID: <20180317225524.vy7vpopgiwjcp2sa@treble> References: <1521174359-46392-1-git-send-email-keescook@chromium.org> <20180316175502.GE30522@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Sat, 17 Mar 2018 22:55:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Sat, 17 Mar 2018 22:55:26 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jpoimboe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 17, 2018 at 01:07:32PM -0700, Kees Cook wrote: > On Sat, Mar 17, 2018 at 11:52 AM, Linus Torvalds > wrote: > > So the above is completely insane, bit there is actually a chance that > > using that completely crazy "x -> sizeof(char[x])" conversion actually > > helps, because it really does have a (very odd) evaluation-time > > change. sizeof() has to be evaluated as part of the constant > > expression evaluation, in ways that "__builtin_constant_p()" isn't > > specified to be done. > > > > But it is also definitely me grasping at straws. If that doesn't work > > for 4.4, there's nothing else I can possibly see. > > No luck! :( gcc 4.4 refuses to play along. And, hilariously, not only > does it not change the complaint about __builtin_choose_expr(), it > also thinks that's a VLA now. > > ./include/linux/mm.h: In function ‘get_mm_hiwater_rss’: > ./include/linux/mm.h:1567: warning: variable length array is used > ./include/linux/mm.h:1567: error: first argument to > ‘__builtin_choose_expr’ not a constant > > 6.8 is happy with it (of course). > > I do think the earlier version (without the > sizeof-hiding-builting_constant_p) provides a template for a > const_max() that both you and Rasmus would be happy with, though! I thought we were dropping support for 4.4 (for other reasons). Isn't it 4.6 we should be looking at? -- Josh