Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2543206imm; Thu, 7 Jun 2018 12:26:21 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIkLXWBt6K/IvSDWU0EoE0XjwhQdr9GRUgodHe2OQM+exyIFP3X5Bo3BZuaxIjP7+Icul06 X-Received: by 2002:a17:902:bd8a:: with SMTP id q10-v6mr3367887pls.389.1528399581596; Thu, 07 Jun 2018 12:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528399581; cv=none; d=google.com; s=arc-20160816; b=f7phuoFkAPj6bVLqabIoLCcMmO0BiaVTKvA049sLe+ttH8U6FIM0gTAg/2JK+dFVtN pp8zQIwBMSfOC1egiQ4nMRFXkC3QIuTcfUlfjC86eYxMcwxRVvoQBn7R3qwccTsG4xGw SVzLK2KUZF2VOG8YuarvIdq5ILc7T7rsnHS4CU9MjIcfR6rvHGp9PTrbjRYfoT0AQxLK Yoz81FgLHqPR5SwjGkPvKRpB7SC8rwbGmbQJtt6NsmMfFIkhw2nP8Klazi5p1+dWab06 ytAebs0mdcg8/PgkuxtdtcP82mcKVOHUAUBb7KUhApEiJiBcJe6JYx9SxQK52GTNboZs U1LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=AvR1kqhfs22TZmd8HUK/0h1P3g4Q4p3Bkf2ew2AhBbw=; b=0aAH5UWe5f+Fk2lSQQhC/t4odmiFl7eyIv+K23IxMcAbUYFx+bSQil96jNeJjaAKxd mnmB3UfUSDLTh4eyjhtAvLUnriM8+K4VRLDU3E3jzO1LKkEH9uMnivjfIYJ6Mn26DwuD 5gR8WPGSokn1o4LTY8EzfrBUCKhq9yC8VtviF8uKDaj64/aqPaBGZbV8gW23iVhl01VT BLOAxyssQCSpcVUzTNUvVrT3rLfl7uFZuIf7LuQunFQLw84nlOnWGt02l9ykCmH6Eh7x 9sgJgtbtIXngI+xMg1emkgm3q8BtflkNUxxh8LeqRO6KRnDpAFBRBU4BAemTxSWM1OaX BJ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=MRc1Z02U; 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 d13-v6si9193279pgu.207.2018.06.07.12.26.05; Thu, 07 Jun 2018 12:26:21 -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; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=MRc1Z02U; 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 S1753156AbeFGTZN (ORCPT + 99 others); Thu, 7 Jun 2018 15:25:13 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:51113 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752520AbeFGTZM (ORCPT ); Thu, 7 Jun 2018 15:25:12 -0400 Received: by mail-wm0-f42.google.com with SMTP id e16-v6so19938458wmd.0 for ; Thu, 07 Jun 2018 12:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=AvR1kqhfs22TZmd8HUK/0h1P3g4Q4p3Bkf2ew2AhBbw=; b=MRc1Z02UfdeAd1aPqiTHWb0L4gScFciekJ8ytDxUVqrgTpnaEtkR+WcrvZQIZASjQg Bk3Tk57kSh+MlnbVwFnGkjCkAgGOrogGVFQS2KIp7ywPVC6qdmW86gdC2KMHRA0Rkg9h QKgmzY0/QugYO4gGI+ranqwENzJnynJfGctOs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=AvR1kqhfs22TZmd8HUK/0h1P3g4Q4p3Bkf2ew2AhBbw=; b=go0dBK2+etqPAdC7tcIdrJ8QiAFqudyRk5kDPIzI+IjtQhb8P9H4i9IFzCJvT0IeY+ gm7EBW56RWZKysllwnl0HPP+B0AqVluIOapjaNNXf3xTFB7DU/5EHVAirt8wTs70CSGN iC1KYagiANNpXqkGl3fVZ/t8VxujTLZJ08EY1Cf1U5KM7GsdhdFhptDuJg7SbQQVNnQL 6IEjirNdsT8YiAXfh/gsjPDaMVMbGzOy+I/3VPWj81mjbtKbfs5haHLt1hXLj9DNYWl+ 3poC99n0mc4owg91U2g0jICCV9erABH7QMlyhSGBJHeHJevAsICcyMjP5xC5QrfyjrJo ypLw== X-Gm-Message-State: APt69E2Ec48xnogObKnfHz13kQslmzmDuqYFKfxdPtnb3EkbDVvfDgzX mm0bIuIHVVoUP+3bxSoGYpcfzqyEOko= X-Received: by 2002:a50:b0c3:: with SMTP id j61-v6mr3784921edd.249.1528399510941; Thu, 07 Jun 2018 12:25:10 -0700 (PDT) Received: from [192.168.0.189] (dhcp-5-186-126-104.cgn.ip.fibianet.dk. [5.186.126.104]) by smtp.gmail.com with ESMTPSA id s38-v6sm6262383edd.2.2018.06.07.12.25.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 12:25:10 -0700 (PDT) Subject: Re: sparse warnings in overflow.h To: Kees Cook , Miroslav Benes Cc: LKML References: From: Rasmus Villemoes Message-ID: <4d2aaa98-1655-3ab8-8ce8-bf4b9c7d2dbc@rasmusvillemoes.dk> Date: Thu, 7 Jun 2018 21:25:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-06-07 20:35, Kees Cook wrote: > On Thu, Jun 7, 2018 at 4:01 AM, Miroslav Benes wrote: >> >> Hi Kees, >> >> sparse (make C=1) gives me this warnings today... >> >> ./include/linux/overflow.h:254:13: error: undefined identifier '__builtin_mul_overflow' >> ./include/linux/overflow.h:254:13: error: incorrect type in conditional >> ./include/linux/overflow.h:254:13: got void >> ./include/linux/overflow.h:256:13: error: undefined identifier '__builtin_add_overflow' >> ./include/linux/overflow.h:256:13: error: incorrect type in conditional >> ./include/linux/overflow.h:256:13: got void >> >> This hunk obviously fixes it, but I'm really not sure if it is a proper >> fix. >> >> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h >> index f1a7492a5cc8..15e55b89e952 100644 >> --- a/include/linux/compiler-gcc.h >> +++ b/include/linux/compiler-gcc.h >> @@ -344,6 +344,6 @@ >> */ >> #define uninitialized_var(x) x = x >> >> -#if GCC_VERSION >= 50100 >> +#if GCC_VERSION >= 50100 && !defined(__CHECKER__) >> #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 >> #endif >> >> Any idea? > > Hi! Yeah, that's probably the correct approach. If the checker doesn't > have it, the builtins need to be disabled. :) IIRC, the problem is that sparse pretends to be the gcc sparse itself was built with, which is obviously entirely unrelated to the C dialect that that particular sparse version groks. Sigh. Ack to the fix above. Rasmus