Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp827599pxa; Wed, 5 Aug 2020 13:52:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBzWK0AdtVFQhrFxvgwsm9Nhq51rMqDxtdY+5BKPQMd0luvJM/aAc9Dsz4JfQfmhjp9kY0 X-Received: by 2002:aa7:ce98:: with SMTP id y24mr1144533edv.76.1596660733156; Wed, 05 Aug 2020 13:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596660733; cv=none; d=google.com; s=arc-20160816; b=YDwWLeRH2RnN7OOStmfGq5fumuM0ZvMMlGWsr4zSGKT+cNaA5P2gnspNBLjxs8zQWi wpUFyxbqQ4gBeo4R4KXoMC8RYZEO4zbhpBZ/G6fc0JcmCpFebmhCybshDFx64GseG2ba 1EF9ieEkCkvI6lG592Rz/S3oloitBE5GUzVUOBTX/kAXHfXjfuy8KUHoaqwaV9F4GlXF ImCpHG6vjtFYJzgRKXldPxO2rF+CAwa+LW1WmB5nJMOyXG0WItncSteaj9mgctODA13D GMLqSSk6YrSHWfV9QTsy6tsJhj7AJw/yXc6+lFchXqZtjAyghgc+IjnNWUSSgFNQFOLJ FXAQ== 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=IX9XrPUzOcyKkpmBN/wRczSmpUnTjA2wU4ML+y9lkZ8=; b=wSeVUFlQQIv0CLPz2JWiMBYQ8QOhZhUN2w4yQBARToGh92phgy4qTRuBkUBvZhe7Mf /90JigqNZxeXMFJVhYkXF6FwiSEgk3a9FY0VTZGT4GSNP2FVbucIadzht+TqR+HBfLid mZft7z2AcvVaGhhwuxVV/fIYXmpFAKAh4ZaLbVMHx/vSQRpmR015n5P55a4iggufDg3Y ILuQaODFqR6RCU7JHrSVke14fvNy6P+aBrR300Mf6wuqhQ5rnwbHtN1JS2/NofE72Nvc Ge/hSPOT/ceGVvmgh7uKzLuNt8CE079hX0uGYZYBBHmz2f6fgJ7H+ZN9BUw1RnxcTKsp s1cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AMi6K8LK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v25si1918342ejg.91.2020.08.05.13.51.50; Wed, 05 Aug 2020 13:52:13 -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=pass header.i=@chromium.org header.s=google header.b=AMi6K8LK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726891AbgHEUu2 (ORCPT + 99 others); Wed, 5 Aug 2020 16:50:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbgHEUu1 (ORCPT ); Wed, 5 Aug 2020 16:50:27 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DCCBC061575 for ; Wed, 5 Aug 2020 13:50:27 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id i92so3679191pje.0 for ; Wed, 05 Aug 2020 13:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=IX9XrPUzOcyKkpmBN/wRczSmpUnTjA2wU4ML+y9lkZ8=; b=AMi6K8LKX1VQCBDo+8/FHHEO12L0113YiFMtxUoRuvYnMXNOau5IOsAMJBeoHyUPvz syaxTLjdh0s5hixSX2+615yeJbMX/icq96mS0El/s59+/3aYS6wjSZ9cpm/gCZWiUtLP wCNGlh9BDMAoEeOqKiBE7ODo4wL8f+Cmx1wIQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IX9XrPUzOcyKkpmBN/wRczSmpUnTjA2wU4ML+y9lkZ8=; b=Fxs347Iz8wFvTrAk+iMYftFmZ/dN0Yp6G3/CeRI/hX7dpYbCuSLx8Q1mCATSJV8yLH 9JchNjsb338bli/Wdx1d3fkcJOjtmeHjLOlmsDYpqy0gL84Vn9MHA0KqD0HNRomkzdpZ KqyU3QAuKYTPejUQOR9AiHdhl2BvUmWLEs/jUVn/pBFjajL1bCCVUO9cadvn5OVf6yEq pqbU5x5fujX+uDuimhZwiHzRCA65Vj/jbQGqu/J8hdtObbQHrMWIHfGRTd+nZvXi6/tE Tv8N56ifYiMBKoLeFKfaeR9RCl09lw6TgrbZW3FmokMDgU+THLOcRqka5jQ0oac6QHlJ 96/w== X-Gm-Message-State: AOAM532ox4KvqMmp9wKNNPD0C8EoWh45BT98Vl/oi15yBo9K5EKuuyLW SDhspQuCCGc1QnP44+BQjj3R6A== X-Received: by 2002:a17:90a:f012:: with SMTP id bt18mr4586168pjb.63.1596660625999; Wed, 05 Aug 2020 13:50:25 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id y65sm4787621pfb.155.2020.08.05.13.50.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2020 13:50:25 -0700 (PDT) Date: Wed, 5 Aug 2020 13:50:24 -0700 From: Kees Cook To: Rasmus Villemoes Cc: Jason Gunthorpe , Leon Romanovsky , "Gustavo A. R. Silva" , Matthew Wilcox , linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Segher Boessenkool Subject: Re: [RFC] saturate check_*_overflow() output? Message-ID: <202008051349.553E49E12@keescook> References: <202008031118.36756FAD04@keescook> <202008041137.02D231B@keescook> <6d190601-68f1-c086-97ac-2ee1c08f5a34@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6d190601-68f1-c086-97ac-2ee1c08f5a34@rasmusvillemoes.dk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 05, 2020 at 01:38:58PM +0200, Rasmus Villemoes wrote: > Anyway, we don't need to apply it to the last expression inside ({}), we > can just pass the whole ({}) to must_check_overflow() as in > > -#define check_sub_overflow(a, b, d) ({ \ > +#define check_sub_overflow(a, b, d) must_check_overflow(({ \ Oh! Yes, of course. I was blinded by looking inside the macro and not wanting to spoil the type magic. Yes, that's perfect. I will spin a patch... -- Kees Cook