From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2031C32771 for ; Wed, 28 Sep 2022 18:06:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7E4B110E550; Wed, 28 Sep 2022 18:06:15 +0000 (UTC) Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 32F7D10E566 for ; Wed, 28 Sep 2022 18:06:10 +0000 (UTC) Received: by mail-pf1-x42b.google.com with SMTP id w2so13249265pfb.0 for ; Wed, 28 Sep 2022 11:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=lg8DJ4PVGf/UE/b9agj2E3jF0biYJ2TzSjDWoqo1nWk=; b=kX6MiQJJ++GzWgnGDgSHhlrCPXkUnTfSWuw5a1vTXKi13Y13VyCmf0QKz9GO79Hl9h lytSSUqbfN/S/Ah/mnF4XU0V59XNaRA/1kXJDF/OU4N76i45SgkcHk4RiaBdM3X11q3P ngv3+AbyQkBAOyZ4Efs1UnxU8fMOnw5TwIofU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=lg8DJ4PVGf/UE/b9agj2E3jF0biYJ2TzSjDWoqo1nWk=; b=71LEUjbXGejgWlI4A0fiUhxEJ2AYlxF75IiUzWUCNhX2Y8FmyzvNb55N8UBwCf0gFj BfMS+g06ophxOs/QVc8ToHtOUwC7SYKgvL45c9KeegpbM12A1kZbolbARCDY8CD/ERHd P3jOQyUeIKTLiG8T+wa2MF91N7nJhJ6ueeA4XheIVpdD1i/YZu+4W6IW0x2tEwzMxxEo zSTcCnA2+dgX3dVDSbOq6/3tXzeQk1HC8UXYREc1Q9JEV2Q7JkRPTLzKSTgFy7RpFSxn 8Z/uNzFnlKNn96UQ5u980OKf2/gAc9DFTlnU5qadEuJur/Dcj52CFux9JohvlJv2PkPU i9Dg== X-Gm-Message-State: ACrzQf15GhtBwAZYdXsljFiH/esLkKeBcTYCGNHiqfg8HUxYwP9f8teD qoUd3eMX6lYd+VT8s7WUEeikOw== X-Google-Smtp-Source: AMsMyM5YqTL3LfyC56o9MrGg1TzPcXSkd4eESKCY3Dzo1hitrUn0UwkQLKFW1M9B3lIoMGRQbkcRdw== X-Received: by 2002:a65:4609:0:b0:434:8f0b:5d05 with SMTP id v9-20020a654609000000b004348f0b5d05mr29993911pgq.606.1664388369685; Wed, 28 Sep 2022 11:06:09 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id mt10-20020a17090b230a00b00203059fc75bsm1706643pjb.5.2022.09.28.11.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 11:06:09 -0700 (PDT) Date: Wed, 28 Sep 2022 11:06:07 -0700 From: Kees Cook To: Linus Torvalds Message-ID: <202209281102.A86D736@keescook> References: <20220928081300.101516-1-gwan-gyeong.mun@intel.com> <20220928081300.101516-6-gwan-gyeong.mun@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Intel-gfx] [PATCH v13 5/9] drm/i915: Check for integer truncation on scatterlist creation X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gustavoars@kernel.org, trix@redhat.com, dlatypov@google.com, llvm@lists.linux.dev, linux@rasmusvillemoes.dk, dri-devel@lists.freedesktop.org, chris@chris-wilson.co.uk, linux-hardening@vger.kernel.org, andrzej.hajda@intel.com, linux-sparse@vger.kernel.org, matthew.auld@intel.com, airlied@redhat.com, thomas.hellstrom@linux.intel.com, jani.nikula@intel.com, intel-gfx@lists.freedesktop.org, nathan@kernel.org, mchehab@kernel.org, ndesaulniers@google.com, linux-kernel@vger.kernel.org, daniel@ffwll.ch, vitor@massaru.org, luc.vanoostenryck@gmail.com, nirmoy.das@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Wed, Sep 28, 2022 at 10:09:04AM -0700, Linus Torvalds wrote: > Kees, you need to reign in the craziness in overflow.h. Understood. I've been trying to help the drm folks walk a line between having a bunch of custom macros hidden away in the drm includes and building up generalized versions that are actually helpful beyond drm. But I can see that it doesn't help to have a "do two things at the same time" macro for the assignment checking. -- Kees Cook From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BC0EC32771 for ; Wed, 28 Sep 2022 18:06:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234619AbiI1SGM (ORCPT ); Wed, 28 Sep 2022 14:06:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234577AbiI1SGL (ORCPT ); Wed, 28 Sep 2022 14:06:11 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F087101977 for ; Wed, 28 Sep 2022 11:06:10 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id a29so13213784pfk.5 for ; Wed, 28 Sep 2022 11:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=lg8DJ4PVGf/UE/b9agj2E3jF0biYJ2TzSjDWoqo1nWk=; b=kX6MiQJJ++GzWgnGDgSHhlrCPXkUnTfSWuw5a1vTXKi13Y13VyCmf0QKz9GO79Hl9h lytSSUqbfN/S/Ah/mnF4XU0V59XNaRA/1kXJDF/OU4N76i45SgkcHk4RiaBdM3X11q3P ngv3+AbyQkBAOyZ4Efs1UnxU8fMOnw5TwIofU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=lg8DJ4PVGf/UE/b9agj2E3jF0biYJ2TzSjDWoqo1nWk=; b=1UlhH3g5WyrjgrdRyCnJ2quTrleP9lCvEiOin4P92qNcuvGH9nfgtLvP8AJzbFFxY9 F2W2WXjHA76/Ci5GbqWzOMOlS+cyu+w6XQyE9eAWtIVqHJ85zQggzHAIqfuZcCuwZb44 Fde/S8RZgpIqPnfPb6O6yTIEKt0uLkb/a1eBMNdATmjvh5yXk3IRwy3LYtD/omOwfoHp TemtKjXOV8Orv2U8zyXgwSTPIuYJ+roY64/IyLlDYb4P99nRBDsBBBYxPCZYLfDrV4TD WP/QXJZmwWgh25jnGtYYq0FD2906fpXJSZA0NzMFlsgpGcx0FadRqfmVs84FoF1I3fnH x8VQ== X-Gm-Message-State: ACrzQf0MBTHwgvXs2oCpPxAKnvD1M622QC1vrn4zaLd7FFiu5iLI0Jje syzoMEdYEaiokrqHeOJzyPpdTA== X-Google-Smtp-Source: AMsMyM5YqTL3LfyC56o9MrGg1TzPcXSkd4eESKCY3Dzo1hitrUn0UwkQLKFW1M9B3lIoMGRQbkcRdw== X-Received: by 2002:a65:4609:0:b0:434:8f0b:5d05 with SMTP id v9-20020a654609000000b004348f0b5d05mr29993911pgq.606.1664388369685; Wed, 28 Sep 2022 11:06:09 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id mt10-20020a17090b230a00b00203059fc75bsm1706643pjb.5.2022.09.28.11.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 11:06:09 -0700 (PDT) Date: Wed, 28 Sep 2022 11:06:07 -0700 From: Kees Cook To: Linus Torvalds Cc: Gwan-gyeong Mun , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, mchehab@kernel.org, chris@chris-wilson.co.uk, matthew.auld@intel.com, thomas.hellstrom@linux.intel.com, jani.nikula@intel.com, nirmoy.das@intel.com, airlied@redhat.com, daniel@ffwll.ch, andi.shyti@linux.intel.com, andrzej.hajda@intel.com, mauro.chehab@linux.intel.com, linux@rasmusvillemoes.dk, vitor@massaru.org, dlatypov@google.com, ndesaulniers@google.com, trix@redhat.com, llvm@lists.linux.dev, linux-hardening@vger.kernel.org, linux-sparse@vger.kernel.org, nathan@kernel.org, gustavoars@kernel.org, luc.vanoostenryck@gmail.com Subject: Re: [PATCH v13 5/9] drm/i915: Check for integer truncation on scatterlist creation Message-ID: <202209281102.A86D736@keescook> References: <20220928081300.101516-1-gwan-gyeong.mun@intel.com> <20220928081300.101516-6-gwan-gyeong.mun@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org On Wed, Sep 28, 2022 at 10:09:04AM -0700, Linus Torvalds wrote: > Kees, you need to reign in the craziness in overflow.h. Understood. I've been trying to help the drm folks walk a line between having a bunch of custom macros hidden away in the drm includes and building up generalized versions that are actually helpful beyond drm. But I can see that it doesn't help to have a "do two things at the same time" macro for the assignment checking. -- Kees Cook From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36D17C04A95 for ; Wed, 28 Sep 2022 18:06:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C75310E54F; Wed, 28 Sep 2022 18:06:45 +0000 (UTC) Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3257210E559 for ; Wed, 28 Sep 2022 18:06:10 +0000 (UTC) Received: by mail-pf1-x435.google.com with SMTP id l65so13189542pfl.8 for ; Wed, 28 Sep 2022 11:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=lg8DJ4PVGf/UE/b9agj2E3jF0biYJ2TzSjDWoqo1nWk=; b=kX6MiQJJ++GzWgnGDgSHhlrCPXkUnTfSWuw5a1vTXKi13Y13VyCmf0QKz9GO79Hl9h lytSSUqbfN/S/Ah/mnF4XU0V59XNaRA/1kXJDF/OU4N76i45SgkcHk4RiaBdM3X11q3P ngv3+AbyQkBAOyZ4Efs1UnxU8fMOnw5TwIofU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=lg8DJ4PVGf/UE/b9agj2E3jF0biYJ2TzSjDWoqo1nWk=; b=S9cXjcnLbENwM9Ughx+cJCjxoCU5CcSxintPPeKqz8aSF4iWr4hS89pky2HjI8OQwc KwhF+spPmofvFPBpb1XnemaMhii4270pWGVMmGndBxjrN7vmB2ZBSV3TyptPxl6E16xY d1lfqH725fG3efG4UhSOJlJw2BfSY8NKHui8HLuiySw59Uhll+2xzbkw85G2mrFZX0ju wbq7Cum+6PY6vCXLu0WyYPZJN9SW5WuyMwPXEAoBP/FH/fI7yTWHADPLpH1fOmCcvPnF bDim9t36UvF1HITKG95Nzs11L437MEWnzOTrJJmxQsIY193Uxsry5hVmAIhl/B3i1hFv C6XQ== X-Gm-Message-State: ACrzQf02+q2Nh+wpAwcccGHanV9xQCtVeHi0WqaVVcPBJmFehuIrSpOT mAdieTpLL+HXlULW0u8u7XVxDZRa0XqcFA== X-Google-Smtp-Source: AMsMyM5YqTL3LfyC56o9MrGg1TzPcXSkd4eESKCY3Dzo1hitrUn0UwkQLKFW1M9B3lIoMGRQbkcRdw== X-Received: by 2002:a65:4609:0:b0:434:8f0b:5d05 with SMTP id v9-20020a654609000000b004348f0b5d05mr29993911pgq.606.1664388369685; Wed, 28 Sep 2022 11:06:09 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id mt10-20020a17090b230a00b00203059fc75bsm1706643pjb.5.2022.09.28.11.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 11:06:09 -0700 (PDT) Date: Wed, 28 Sep 2022 11:06:07 -0700 From: Kees Cook To: Linus Torvalds Subject: Re: [PATCH v13 5/9] drm/i915: Check for integer truncation on scatterlist creation Message-ID: <202209281102.A86D736@keescook> References: <20220928081300.101516-1-gwan-gyeong.mun@intel.com> <20220928081300.101516-6-gwan-gyeong.mun@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gustavoars@kernel.org, trix@redhat.com, dlatypov@google.com, llvm@lists.linux.dev, linux@rasmusvillemoes.dk, dri-devel@lists.freedesktop.org, chris@chris-wilson.co.uk, linux-hardening@vger.kernel.org, andrzej.hajda@intel.com, linux-sparse@vger.kernel.org, matthew.auld@intel.com, andi.shyti@linux.intel.com, airlied@redhat.com, thomas.hellstrom@linux.intel.com, jani.nikula@intel.com, intel-gfx@lists.freedesktop.org, Gwan-gyeong Mun , nathan@kernel.org, mchehab@kernel.org, mauro.chehab@linux.intel.com, ndesaulniers@google.com, linux-kernel@vger.kernel.org, vitor@massaru.org, luc.vanoostenryck@gmail.com, nirmoy.das@intel.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, Sep 28, 2022 at 10:09:04AM -0700, Linus Torvalds wrote: > Kees, you need to reign in the craziness in overflow.h. Understood. I've been trying to help the drm folks walk a line between having a bunch of custom macros hidden away in the drm includes and building up generalized versions that are actually helpful beyond drm. But I can see that it doesn't help to have a "do two things at the same time" macro for the assignment checking. -- Kees Cook