Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1241786pxa; Thu, 13 Aug 2020 04:24:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyyThdOOp+qoDp88woT3ZUSz16Bsj/rEsCoD8N7AO4T5yvaw2fGclcyQheu+uxsdsZVXSX X-Received: by 2002:a17:906:cc47:: with SMTP id mm7mr4036912ejb.362.1597317878307; Thu, 13 Aug 2020 04:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597317878; cv=none; d=google.com; s=arc-20160816; b=cLKyWW4d33ZMWATcfLMPG04oFKlfI/RIwyisUTsRlVTp7sDrK8jrtZCbAzHK/tw0xA t2G36LDpkLsJfuaLJhNncDn76iCk6r6AI88YGK+fw9g+yjRxd3p/TgV3OBIjMWJuU7dN Z7kLeuR2b9R8dvySUkYOWxMM2EPzSOIk/7UhzR5j16UjPofjn8kEKb6PG+y+K4UBWnxH EEW5QIuQu0VEAiBbbxXteISLDllCDXInprHlNhILAMa3rWMYm4i91p7C/dZHpHo1ABeU az+GZFBhkG1wGe72UWMbrKzICQnqh+hexxO2uWBwMPluS0huVsv6CfH6pjVgY8xSSwXq Emaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=bMRBGcKt+bU8uAPr5Wn9gP6oItYBvFq1FIEisxr/UUQ=; b=rUwSAi6AMFBZK7AkLTz0hujoLXs3kKIzrbvp9BAcz2t+TGPsQzf8HWWZ5YDPq7gjy8 aeMRIpCIMbvgUAP0F+6ZaBXO27e5JxV7UgfObi7+fHbcXoMMaaCZP+JDM1hZpQD4o87M rYbwBZnJgG0ba656W6xsTgh6uhAMraP699saXlSF/LY3RZXFOsG+M52smoOJ409287r2 rJLL9pw/igzt0XnbNXCO3VwJ36qwFWVZFzgC7/eSzVWgYvK6dDvoqbWXLQZsa3bDPGYr F4e+g5R8WHDuhaU7p3qxb9aUVVGvC7cfVdsJjpeXvgV7k9r+7S9yTv1ZnpaWfY0mRxue G2qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=KZFE1eXd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 d15si3270810edp.439.2020.08.13.04.24.15; Thu, 13 Aug 2020 04:24:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=KZFE1eXd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726686AbgHMLXb (ORCPT + 99 others); Thu, 13 Aug 2020 07:23:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726427AbgHMLXa (ORCPT ); Thu, 13 Aug 2020 07:23:30 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BAC5C061757 for ; Thu, 13 Aug 2020 04:23:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=bMRBGcKt+bU8uAPr5Wn9gP6oItYBvFq1FIEisxr/UUQ=; b=KZFE1eXd1CWdppiZQ3jh6dA+N/ SImJmnPw5zL3u53vOECKyXOKHoCU0Im5fYnfmCdyg8cfXtRN7hfkQZCaWIWDHD2sj5EOKyAVlYE9m yaliy3/OfuiGAo5LJEDCwWt3BCjDlWPZhDE9d1enXhLTNBugDaGTITNUJz7kSxfj4lAcZFxhE60PI 0xs1RGe4iD72L+B1/kwLa/Px7iO5dQzVrXidtr/LFR2BtVLUapF8a4z26vOqQmM+O9OF4DjLTf9Vz plec0ktW0KvsTntw4Qj8134GCWIF1ZcFumdkm7IhMh9dOvzR+zNtJt3UY9yqtmoR9sGPuY79HbP+8 FE4fS7tQ==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6BKR-0001TK-E8; Thu, 13 Aug 2020 11:23:27 +0000 Date: Thu, 13 Aug 2020 12:23:27 +0100 From: Matthew Wilcox To: Kees Cook Cc: Rasmus Villemoes , "Gustavo A. R. Silva" , Jason Gunthorpe , Leon Romanovsky , linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: Re: [PATCH] overflow: Add __must_check attribute to check_*() helpers Message-ID: <20200813112327.GF17456@casper.infradead.org> References: <202008121450.405E4A3@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202008121450.405E4A3@keescook> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 12, 2020 at 02:51:52PM -0700, Kees Cook wrote: > +/* > + * Allows to effectively us apply __must_check to a macro so we can have > + * both the type-agnostic benefits of the macros while also being able to > + * enforce that the return value is, in fact, checked. > + */ > +static inline bool __must_check __must_check_bool(bool condition) > +{ > + return unlikely(condition); > +} I'm fine with the concept, but this is a weirdly-generically-named function that has a very specific unlikely() in it. So I'd call this __must_check_overflow() and then it's obvious that overflow is unlikely(), whereas it's not obvious that __must_check_bool() is going to be unlikely().