Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp740629rdb; Tue, 23 Jan 2024 13:33:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IE9aB2+wdoRwy0ZJtSui4Q+3sllqwpLknoi5V6bMrx0GCBphPOX7jypMnPo7SqfraIVQXJK X-Received: by 2002:a17:902:74c1:b0:1d3:aab1:6273 with SMTP id f1-20020a17090274c100b001d3aab16273mr4127692plt.118.1706045586916; Tue, 23 Jan 2024 13:33:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706045586; cv=pass; d=google.com; s=arc-20160816; b=kYfLGkWIni4KwTteMMJDm2cuW0UmoUKrbg+MVV0enCj5lfWpbQAoV6jvs8AYbREQ3O tN173werklcuyFCp7ajWF+AUEXcdd9etne4jzy8e+nmCmi8N2oX7OVGwO6DOvScILn7t uwp9C102Gk/LGm2CuMfHcd3YPII1o+lh3PBZa3Ww7BqzRPT1Uix7UNNYy3QUNW6MJ6Eh v9a+D5kfp4E6kfDmJKySYWbK1Ntjz+MAVYQwh/zezfjRWGmuFiGtjtt3PxeOqA1kVkoS 5c0oaQIu0YxaxvjIpU0kJjpY0mxUC2K9onEpm8VyEj5UlBXFmNnJXO1UssC7PbEsHWqH dOMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=swQh+tXC7wjzygjmlvxoa7jnM24RYNaNqlf/2tnlFpM=; fh=LAsqS8RdsoIDFD7oZ5i3U/7TU7gaJL57pmAV3CwTz28=; b=K3DR4FyUP53CMHt45WvTVYX3NdH8/DuF11nmDEtVSpnr+nw60ldqcGbigzuhXFmEy+ FJTQNZtrHza9m32Wg3j+oHTLfI81UuVOeIMaXdkJxS6Yy3IsN87PhgRnrq5lfYonZ5QC lLLd3Cn7eHo+v9+WSRMHbmN/Kg7MZ7eMhcgDM3QEqMv2YXbTnjIJ+EYf+UozJKJtWtXU ww3GMJZz6TcDhI2baW76JYgCoxqcun88VCN1WYsr2ohA6gLC6Yfgr/TihaDxLRXWKaBo 3kj3dDB46GM1W+JFBZ/Aq1dT2sxnClWpFdNKAiRiCErcgh8NHEkK5psJUnmwdtAoBCFr cnbw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=RZWZDETR; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-36080-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36080-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 l8-20020a170903120800b001d6f7875f69si10614721plh.380.2024.01.23.13.33.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 13:33:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36080-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=@chromium.org header.s=google header.b=RZWZDETR; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-36080-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36080-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 5D0CA2864A8 for ; Tue, 23 Jan 2024 21:32:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5AD23B790; Tue, 23 Jan 2024 21:32:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="RZWZDETR" 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 DA1CCC8FD for ; Tue, 23 Jan 2024 21:32:36 +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=1706045558; cv=none; b=mNjiWwp3j3NmBxmgvK4JyF6n6EVDCBH7yQcBjElYwPAkLV0l4L2iQGuGxHcW35hnGVU4vxnfnSagCB6s4WNsdjzlzDzE03u0S5lokcjNAyuukPSAjZL7/zYW5p+yqtkoJfNFy45hCEEdsFsZTtkxpD9N+jYP1ijjkoLDnjaLfxY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706045558; c=relaxed/simple; bh=N2eMKxGKC9fb0PjB8BggX+mn9jsS+yaW0VK2ox0w8Oo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kKeWjfqy2JQ0FuY+PSc6HyM/s+qSTjz7NiUwgQHC3ohLOAQg8jv+vkdXBlCI9JTQufqV8kGppKQyX2Jw8ivHA3YvggZ9Sp5iE3qVID7j37sf+u/q71KVbfX4Zmh589G2gY4ejmejyjUq3fqDLy2q9smG9aTgD4lGP1h2P7xsDAk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=RZWZDETR; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1d74678df08so16070815ad.1 for ; Tue, 23 Jan 2024 13:32:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706045556; x=1706650356; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=swQh+tXC7wjzygjmlvxoa7jnM24RYNaNqlf/2tnlFpM=; b=RZWZDETRJ3tdK1x5X6K5KNtiJ9OFq2PbD0OBYuOj5ncE/kICqyYGWyiipWArPUcV+R I+VcKv+e80Px86gl3C4eF6UjVc0z6kUBEQ/9X4Yswd3eUeustu+K4+ttSrKMPRUpJqOF Sj0lAePTvUusLq9GYw+KSHDTQyNdvGhRNvpBk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706045556; x=1706650356; 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 :message-id:reply-to; bh=swQh+tXC7wjzygjmlvxoa7jnM24RYNaNqlf/2tnlFpM=; b=Ot26w71HGyKXB+iVWRaiFeK+D5wxAmzmnbGYkkwAlGPO3F+ZJHa7mQn7AVT5m66/E8 Am2ovbxNHEcRFAaFLd2DozLVViIy4UsNOfOYjh7dhMzcmHX77qvIDiakVwFYpSnM0r1e HW0zxYIaulv6WAKTcKjEDaBlv8CfpquolsBDsQ0F/AGQFq8rf50txrf+87trgOtVg2v9 geoNDOXZ5Tc9LP6RJJt7o/fK9V7Fr/8LiG7i6/MNL/MMfWX8B0LD7C6RpcGs8ykHTYyM l06if8Q+O1f9yBtUstykbAbjhLtHmGLTUKVITz4+KbXBrdFQ0DilQ3/VAc+kevZpY28u rC+w== X-Gm-Message-State: AOJu0Yy698qGZSMQCzjtnRmhFAM+fAcMyUqHSw7Hq00EomGX9GbR+dug xq1Ultzn2RDdGMBW7sVnEw+UbzyIKn8DUvdpr5p04WsYDTjCjBFTqyYCLehUQA== X-Received: by 2002:a17:903:120d:b0:1d5:7316:c9fb with SMTP id l13-20020a170903120d00b001d57316c9fbmr3866864plh.37.1706045556284; Tue, 23 Jan 2024 13:32:36 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id g8-20020a170902740800b001d714ccf7b3sm8100220pll.180.2024.01.23.13.32.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 13:32:35 -0800 (PST) Date: Tue, 23 Jan 2024 13:32:35 -0800 From: Kees Cook To: Jan Beulich Cc: Wei Liu , Paul Durrant , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , xen-devel@lists.xenproject.org, netdev@vger.kernel.org, "Gustavo A. R. Silva" , Bill Wendling , Justin Stitt , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH 80/82] xen-netback: Refactor intentional wrap-around test Message-ID: <202401231331.0BD2925D4E@keescook> References: <20240122235208.work.748-kees@kernel.org> <20240123002814.1396804-80-keescook@chromium.org> <35ff4947-7863-40da-b0e7-3b84e17c6163@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <35ff4947-7863-40da-b0e7-3b84e17c6163@suse.com> On Tue, Jan 23, 2024 at 08:55:44AM +0100, Jan Beulich wrote: > On 23.01.2024 01:27, Kees Cook wrote: > > --- a/drivers/net/xen-netback/hash.c > > +++ b/drivers/net/xen-netback/hash.c > > @@ -345,7 +345,7 @@ u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 gref, u32 len, > > .flags = GNTCOPY_source_gref > > }}; > > > > - if ((off + len < off) || (off + len > vif->hash.size) || > > + if ((add_would_overflow(off, len)) || (off + len > vif->hash.size) || > > I'm not maintainer of this code, but if I was I would ask that the > excess parentheses be removed, to improve readability. Good call. I will adjust that. Thanks! -Kees -- Kees Cook