Received: by 10.192.165.148 with SMTP id m20csp3423320imm; Mon, 23 Apr 2018 06:24:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+9jViNa4Nk2KFwAK93aD6vGgOXGaL76ixmvx7jMyoClkHQks80NDW/vniCpBGS++z4UtIi X-Received: by 2002:a17:902:ba94:: with SMTP id k20-v6mr20984409pls.193.1524489887178; Mon, 23 Apr 2018 06:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524489887; cv=none; d=google.com; s=arc-20160816; b=CmXxFhO2v4WqpxwNwuK2MijCdtFOu+cbajsrE6Tk1nORm4GLS/lYacvaWsc5LsLnex VAf/DZMeoEulvspCCgTxxKDkaAXkHKae3Z1AvJMprHArcc5ARNPrhW7phl0fUnGshO3j wXZSwhetZH1NuVf+bQuPdVq9Fl98RxS2Ed5aCwf0Si15ZjYRD2kjm7k0H477LbCFNd7s smMD5QgerlqMvWDzZsTHneXTm/By271dMEzLHB4K09/tRxSzCUkiRMkLppzK2U3LjdlK k4b8d8kK9kh+aoQB6HAFJG+eBG/TAcRqLpI3nN6EqTslVD+/NKKqyFuzzA0Oy2Lw+yak tHmg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=5lEbqc1OPzPzQVViowW1rVD1S9YK0TUPvoeEkf0vKu8=; b=lIdR3ZDBYnNHQ0l6Cfats73rg/E7lfuwntwVXcFhmYVUkTfJmT4+EDei4mlVox14jV JQJjxN24qPu8shkYjypSMpH/4eCQVPySUlJUGCiFx7nTlv6s9/vixZJ2ORroCpasTB56 ZWb//hGHFGCJRtWgbk0on0YeGrfB4ML7i1KCF9iUYmMklxgdGuKObGOa4Wp7fitlBIj1 D+SsU2ll9B/K6N0iXet7x8zunbyYGsL4XeUSOYzPsmm+nGTHasugbvbbEiaCNfVlnebF 9DE4Mknvyy8IVUu94cEpRZmanBx0lK2DDo89MhJs1Q71mfnFYJml1BHTIefYUR4lvKXF 8IJQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si9381223pgs.556.2018.04.23.06.24.33; Mon, 23 Apr 2018 06:24:47 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755292AbeDWNWw (ORCPT + 99 others); Mon, 23 Apr 2018 09:22:52 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:40878 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755273AbeDWNWt (ORCPT ); Mon, 23 Apr 2018 09:22:49 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 073791435; Mon, 23 Apr 2018 06:22:49 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1C4773F4FF; Mon, 23 Apr 2018 06:22:47 -0700 (PDT) Date: Mon, 23 Apr 2018 14:22:43 +0100 From: Mark Rutland To: Dan Carpenter Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , "Gustavo A. R. Silva" Subject: Re: Smatch check for Spectre stuff Message-ID: <20180423132242.iwpltjacdk3xyktf@lakrids.cambridge.arm.com> References: <20180419051510.GA21898@mwanda> <20180420124750.fgwrsyhuqd26mj34@lakrids.cambridge.arm.com> <20180423125307.fpqn5shjq3rpsyx3@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180423125307.fpqn5shjq3rpsyx3@mwanda> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 23, 2018 at 03:53:07PM +0300, Dan Carpenter wrote: > On Fri, Apr 20, 2018 at 01:47:51PM +0100, Mark Rutland wrote: > > > What the test does is it looks at array accesses where the user controls > > > the offset. It asks "is this a read?" and have we used the > > > array_index_nospec() macro? If the answers are yes, and no respectively > > > then print a warning. > > > > > > http://repo.or.cz/smatch.git/blob/HEAD:/check_spectre.c > > > > I just built this and threw it at v4.17-rc1, but I'm having problems > > with the build_kernel_data.sh step. > > > > I get an error: > > > > DBD::SQLite::db do failed: unrecognized token: "'end + strlen(" > > " at ../smatch/smatch_scripts/../smatch_data/db/fill_db_sql.pl line 32, line 294127. > > > > ... in my smatch_warns.txt I see that I have the lines: > > > > net/netfilter/nf_conntrack_sip.c:1524 sip_help_tcp() SQL: insert or ignore into constraints (str) values('end + strlen("^M > > ^M > > ")'); > > > > ... and the corresponding line in that file is: > > > > for (; end + strlen("\r\n\r\n") <= dptr + datalen; end++) { > > > > ... so I guess there's some dodgy escaping somewhere? > > > > I only see a small number of potential spectre issues reported: > > Yeah... Sorry. I will fix that. It doesn't affect anything unless > someone starts to add SQL injection strings to the kernel but it's not > the right thing. Good to know! As long as that's not affecting the results, I'll ignore that for now. As an aside, it looks like smatch_data/db/constraints_required.schema is missing a trailing semicolon, as the other schema files have. On one of my machines, the distro's sqlite doesn't seem happy without it. [...] > The thing is say we get user data in one function then pass it to the > next and the next down the call tree... Smatch is only building one > layer of the call tree when you build the DB. So you have to rebuild a > bunch of time (like 3 or maybe 5) each time you rebuild the DB. > > Normally, I rebuild the DB every day so it just accretes. Ah, I see. I'll run that in a loop to build my local db. Thanks for the help! Thanks, Mark