Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1629296lqo; Sat, 18 May 2024 11:23:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV0aXGFjXzsvL7hFlvHuMTOmGxcT6VItJswfxWh7n1K8plj0F3MdtqmrgAkcJs/VBeXS8GVk4qweLIx0ZXPtNCvc56AlB0+jk/wtjcyUg== X-Google-Smtp-Source: AGHT+IG6kPC15A1o2NqbLQc/FUVfUqxc5Jcv1xFQYro8DDeDvFA3/WuLhkU/DLJOmd3t4yNdmfdH X-Received: by 2002:a17:902:ef8e:b0:1e4:17e4:3a30 with SMTP id d9443c01a7336-1ef43d2e97emr203796765ad.31.1716056637544; Sat, 18 May 2024 11:23:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716056637; cv=pass; d=google.com; s=arc-20160816; b=ioh0Hc0qIqQOGviwQjW+fC6msD3QMdlhPlRwowxxtq2QJd+3TfMPcS4EBrLjkD80zL KZyhgo7Dj20pURUkojh/4CjKxPeMJVJ8ufveA22Rw2MNDtPms1/tLbnxTIs8y3dvr/Ll XP32LnXXZLrUWSF6Sp771hfCJjy2Q4VoycH5iEAyHxU5jjbM288kR+2dTlfR2G12KWi8 H3+BfW1EzlGDyvbQqvbkoWzyXKPLHqv3CZq5wHlnQoPV1Nfy1M2aZ+pXsH/EX/HzJrnV qK8Kxif/dffvSYnpG5AMdUkG/C1qzdIJeGm/3zR0o1hbuiriUy8kqgxqFWYuWxrdDYGb Db7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=+VKrQ8v4nDq2FqFQMeX2RIFuDjUMEcY8fFPfS8T9+S0=; fh=T/Ofi5CvKNfosGgjAuP14dnDpCYmUY6UFdyh63bH5XM=; b=eb4fDn0+6lf0XRtj+7ZthzdbiNUJh/1VO1WLocS8/c+61/+OFGQqSqhCXjiYRnO6Bm /W3B+BY+7WoYxq7agO+22M5E96PQRXCSzxnFcRSWkRn3PwzJpdaQ6eT7Ek2isEckxow7 DFmnM/w0Vn3Rz+eL0t6y7+UwlmZ9hjm+3nfJIP+cP4o26RPxVf2gBTTerNPZUzIdAifo nKVElEsiT+e0cyNdDok81q3eNrIixAQ+oX4B6PDjx/kdwfSQ62WKt/BOM5ZSFlIg0haG hrKuw8sRiRzQPS74dvyoshVt3JD84JHBVi/Lf+fK+k9WzDVAGplXZwA+eyU9QWIB7s5g tBMw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Cmmlni4J; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-182931-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182931-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c03a168si7579245ad.426.2024.05.18.11.23.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 11:23:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182931-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Cmmlni4J; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-182931-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182931-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1975D28228C for ; Sat, 18 May 2024 18:23:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC21D4EB55; Sat, 18 May 2024 18:23:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Cmmlni4J" Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FC224778E; Sat, 18 May 2024 18:23:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716056629; cv=none; b=aRSHtsUdxGXtFFVQpIxgx1PAJFwTq5iirdMrU8kyz8OnqUxcxokXVrxTozbE84qf1M/lVdN1sQ0n5NVVo1XO9Bjke1jElMD7cjb1DXYnfEUcvjr5Q5fYqD4R8v2wDNS7fjyTd7nwQLReSs6hhgVAR3EXWes5FmTqA2frohpUzqA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716056629; c=relaxed/simple; bh=6vfd2VVqFfQOnJgQsovW1LDIKgBF5CdBO4CTuR99WXo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=k1cGk1yzczB6AgaBcYVzdR9dMEUxLTTT4ZA+0+EMwmDH6jMFLLFFqM7zyNmdF3hGQ96YJ0vJWfDWTl6yd1oV2GxWugytpFlivPRHCelbUaoESjnjMz97Z05Arq9gupYggVT/gTLoef932P0oW8G02Rxr5WGamibyztwCycXjfzI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Cmmlni4J; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1ee5235f5c9so39112455ad.2; Sat, 18 May 2024 11:23:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716056627; x=1716661427; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=+VKrQ8v4nDq2FqFQMeX2RIFuDjUMEcY8fFPfS8T9+S0=; b=Cmmlni4JhDwpDdcQ1wTiiGNNDSKKgx4lkWHdk+QXJufhkMKPfR9pbygaCOovdFj8YS F1ulR6Sx1LnUTtVLECJyWAr6aqbKlUuF4shcH06x/ezEf/lYk+8tbxYLNYrrEKbWMt9/ WJEG1BkLJjScK4lRkOtKHbkt1Oi5f7ZCBFHusQDoxCVS17vwHZgnL2HRlqNB0mF/zjWB EUjzvL2kcVl3l9+bqRWikHRvHOLoNGOxQ8K7ztaH6AX6Sw1nxukW2XJIhCfjNr9VPbM+ w5k//DCscZDGOHlrS5q3ry6ycck8iy8M72WE2TAoKGG0xFE1VWKmrKBGWtrCg2HXSCRl OJmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716056627; x=1716661427; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+VKrQ8v4nDq2FqFQMeX2RIFuDjUMEcY8fFPfS8T9+S0=; b=sJBubIWvgYiZUYS6CFgcOQbH+c/atLTmCmaK5/VWhJgCTgHhbCzEVfpSHN8hcOS+/x F3YAuDPLnYTkiBP6lKBNkCjPDbvNBHt9oPMG9B8oXkFdrU5zQtZ4js8hlTUJ3GAIFubc MJdnqLVGk98OiWhUy+ag1mEYYXzPJ/ci+gOcv3NGlKs9rmCOQx93OWWbpdbZ0RHKvahf icR4nuAT/2UJQ2G05zeKXCP71gwqP3irwgcdXzoOvudfDkaitINGmL9LhMooNB9Hp3IV bloA2yVjyYVv1eYYUdJ6Yd5EH/eGiaP1pCudSgtYyFei/tB2IadZeZLKKEIAWwpDuRGd /RnA== X-Forwarded-Encrypted: i=1; AJvYcCUQpr2QMSQpaqWaZF6rwQyqeGrmGhTBcmzt7pfF7P03bX7zTOmda2LA4Jr2m8ULig857ifzFfpMM2LgmjSmAsp11lph2TRAvsQtskfqYdJ18SxxDvKF7A8eeO+Eb5+gcfvQpUVYX6HcRLZWVHjC X-Gm-Message-State: AOJu0YxbsFQBsHHHnTFgThiJ8TRUU8lc1v1ViioLmU4ZGrbIDyDzPBcS UiSI/vKRewtcGoooXlOGj1wia9/gBGJt3bZXBW+oyR1R1NlZQLEd X-Received: by 2002:a17:90b:3ecd:b0:2bd:7264:ed8d with SMTP id 98e67ed59e1d1-2bd7264f164mr152105a91.17.1716056627196; Sat, 18 May 2024 11:23:47 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2bd72b74a49sm70162a91.17.2024.05.18.11.23.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 18 May 2024 11:23:46 -0700 (PDT) Sender: Guenter Roeck Message-ID: Date: Sat, 18 May 2024 11:23:44 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/nouveau/nvif: Avoid build error due to potential integer overflows To: Kees Cook , Christophe JAILLET Cc: airlied@gmail.com, dakr@redhat.com, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, jani.nikula@intel.com, javierm@redhat.com, kherbst@redhat.com, linux-kernel@vger.kernel.org, lyude@redhat.com, mripard@kernel.org, nouveau@lists.freedesktop.org, tzimmermann@suse.de, linux-hardening@vger.kernel.org References: <20240518143743.313872-1-linux@roeck-us.net> <34a6d812-b4ed-4465-b0ec-e641d185b9b1@wanadoo.fr> <202405181020.2D0A364F@keescook> Content-Language: en-US From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh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ULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: <202405181020.2D0A364F@keescook> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 5/18/24 10:32, Kees Cook wrote: > On Sat, May 18, 2024 at 06:54:36PM +0200, Christophe JAILLET wrote: >> (adding linux-hardening@vger.kernel.org) >> >> >> Le 18/05/2024 à 16:37, Guenter Roeck a écrit : >>> Trying to build parisc:allmodconfig with gcc 12.x or later results >>> in the following build error. >>> >>> drivers/gpu/drm/nouveau/nvif/object.c: In function 'nvif_object_mthd': >>> drivers/gpu/drm/nouveau/nvif/object.c:161:9: error: >>> 'memcpy' accessing 4294967264 or more bytes at offsets 0 and 32 overlaps 6442450881 bytes at offset -2147483617 [-Werror=restrict] >>> 161 | memcpy(data, args->mthd.data, size); >>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>> drivers/gpu/drm/nouveau/nvif/object.c: In function 'nvif_object_ctor': >>> drivers/gpu/drm/nouveau/nvif/object.c:298:17: error: >>> 'memcpy' accessing 4294967240 or more bytes at offsets 0 and 56 overlaps 6442450833 bytes at offset -2147483593 [-Werror=restrict] >>> 298 | memcpy(data, args->new.data, size); >>> >>> gcc assumes that 'sizeof(*args) + size' can overflow, which would result >>> in the problem. >>> >>> The problem is not new, only it is now no longer a warning but an error since W=1 >>> has been enabled for the drm subsystem and since Werror is enabled for test builds. >>> >>> Rearrange arithmetic and add extra size checks to avoid the overflow. >>> >>> Fixes: a61ddb4393ad ("drm: enable (most) W=1 warnings by default across the subsystem") >>> Cc: Javier Martinez Canillas >>> Cc: Jani Nikula >>> Cc: Thomas Zimmermann >>> Cc: Danilo Krummrich >>> Cc: Maxime Ripard >>> Signed-off-by: Guenter Roeck >>> --- >>> checkpatch complains about the line length in the description and the (pre-existing) >>> assignlemts in if conditions, but I did not want to split lines in the description >>> or rearrange the code further. >>> >>> I don't know why I only see the problem with parisc builds (at least so far). >>> >>> drivers/gpu/drm/nouveau/nvif/object.c | 8 +++++--- >>> 1 file changed, 5 insertions(+), 3 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/nouveau/nvif/object.c b/drivers/gpu/drm/nouveau/nvif/object.c >>> index 4d1aaee8fe15..baf623a48874 100644 >>> --- a/drivers/gpu/drm/nouveau/nvif/object.c >>> +++ b/drivers/gpu/drm/nouveau/nvif/object.c >>> @@ -145,8 +145,9 @@ nvif_object_mthd(struct nvif_object *object, u32 mthd, void *data, u32 size) >>> u8 stack[128]; >>> int ret; >>> - if (sizeof(*args) + size > sizeof(stack)) { >>> - if (!(args = kmalloc(sizeof(*args) + size, GFP_KERNEL))) >>> + if (size > sizeof(stack) - sizeof(*args)) { >>> + if (size > INT_MAX || >>> + !(args = kmalloc(sizeof(*args) + size, GFP_KERNEL))) >> >> Hi, >> >> Would it be cleaner or better to use size_add(sizeof(*args), size)? > > I think the INT_MAX test is actually better in this case because > nvif_object_ioctl()'s size argument is u32: > > ret = nvif_object_ioctl(object, args, sizeof(*args) + size, NULL); > ^^^^^^^^^^^^^^^^^^^^ > > So that could wrap around, even though the allocation may not. > > Better yet, since "sizeof(*args) + size" is repeated 3 times in the > function, I'd recommend: > > ... > u32 args_size; > > if (check_add_overflow(sizeof(*args), size, &args_size)) > return -ENOMEM; > if (args_size > sizeof(stack)) { > if (!(args = kmalloc(args_size, GFP_KERNEL))) > return -ENOMEM; > } else { > args = (void *)stack; > } > ... > ret = nvif_object_ioctl(object, args, args_size, NULL); > > This will catch the u32 overflow to nvif_object_ioctl(), catch an > allocation underflow on 32-bits systems, and make the code more > readable. :) > Makes sense. I'll change that and send v2. Thanks, Guenter