Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1188450lqo; Fri, 17 May 2024 13:41:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWp0GfhaPnO0Mh8vOr+YDsVgT7HUIoWt4kPSjW4YO7mNYOQTIUA55DTnZeTiz0C5wLWRWRj2tMcYZspW4XKp44T13OusyKaDUBHtOmKpQ== X-Google-Smtp-Source: AGHT+IFJ6O36cgpoJcbkqYdeQzQtD2xevIIv6mqbkoxkTl9wmpjNV1x7S/6VeLxwPGEIYTJwvJEm X-Received: by 2002:a05:6a20:8407:b0:1af:cefe:dbab with SMTP id adf61e73a8af0-1afde0b7168mr22977380637.5.1715978512663; Fri, 17 May 2024 13:41:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715978512; cv=pass; d=google.com; s=arc-20160816; b=ay/N5uATW3MvCvetrY5eTsocXdvBtbXzFiTS2LrBUJDQ+RCAJb0TCEwCPLQKs1eSHf ffyZW4LDoTkXXWNOBolSEnBs7yxLNFjFKd+6kDP+7DeoiYq1UR5RrW1JXNilavHgLKMG Hm58lDcMxIsSGWC3CzW4f6WUByk0I888cghfeSzniFvVMoOxlAmSMn1OZQtqWmhpMZ4o YQACism/iIedbs52wb2mEffD2j295zcj8RoZIR9fsfIGR+PK0BEsarmex9PMYQVyF6zT vWVHTCNnPocAp5B2msMIEursXWaoyRSrRRD9SYvR+dNoz8dgUgmswnlL4P4StLWPX/r0 eGrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=R30tVZwDgV0/d0XFfhvgj7VuYYCEcxfHEIQCyiSom9Q=; fh=7oKz8NjOi47IMsRKhLsDf82b91GNuusf05qWDgYf1Dw=; b=hgJBINu2Hfzcdp8aOlYqnwVAj5MVEHsN/8r9i8ToU/YcVc2EKjPD2T/ilHGeJhBDIc 6Zo4KeFZOiFHKYkQ8KLXzOy1YMx6ZlDLEPBtRvHhWUW4U6RvPZqI+WLgUPTwpxk+dmKs 3c8N/mmc7kRy+QpqI72i8zQj9BvzxsCJ1v/MtRarCxcGaTqPAHaOw+5uOiTzz6cwOifh G+mbqh+PnFRbZElhP55+f3zJabKMog4D5bPzwiHgEuzFJdP/64U0UTNExQIJ6w8UVbuv VX6jdbmLxNdMKqXubApGL2kIcz27sdlLyok7Gs2T9wwugud/o7XRNY7vnwdTpUOM+68Z QhDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="mH+oa/U+"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-182617-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182617-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-660ac7befbasi1380592a12.550.2024.05.17.13.41.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 13:41:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182617-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="mH+oa/U+"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-182617-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182617-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 BA07E28749F for ; Fri, 17 May 2024 20:41:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4CA113E03C; Fri, 17 May 2024 20:41:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="mH+oa/U+" Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50]) (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 A24671E89C for ; Fri, 17 May 2024 20:41:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715978475; cv=none; b=A2foJ051Qv3xzM/rjCDijb9Ta3Qw+vbwMijc1yk4PJdEcx18YPvnWyGlXT7qZY6HXb8jGx/tXqwp8I5z8qiJSyVYczbmwzhrP1+g5r3gzcwM6uFRhv2JH+XrIPxeXdCPj3nxbEI9hw+l7aGL8XhzvTg53YRTDOwXuV5CgoLT9AU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715978475; c=relaxed/simple; bh=1zR4oNwvnA8BkAHQhbNCPpvycGJsy3kDip8fLJUMvs0=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=FNGcKT5qiiZ3U8S8Xynt9Zb/UpOGO/1m/EGOSKEndqhpOwMYu1oRsvdts4o3ThexxF8zAA0LhHBpjgrT+LalhXNGiNAlPCEgNkYqnqalZGPsqMwhgt2Vv1Jt5xJ5x4T5+qHP9m8ZhWXR6ekZHn6KUbP/Hk5bLOQp5P2XJnL34PE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=mH+oa/U+; arc=none smtp.client-ip=209.85.222.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ua1-f50.google.com with SMTP id a1e0cc1a2514c-7fbbb2cf3c1so414254241.3 for ; Fri, 17 May 2024 13:41:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715978472; x=1716583272; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=R30tVZwDgV0/d0XFfhvgj7VuYYCEcxfHEIQCyiSom9Q=; b=mH+oa/U+pZw9M6PdpQ0Ikf9E0v+oC4j3gECWwxWWr9cRfLqWdCjLZ3Tq/F9vO3H8AZ RJX2aEPhAz6oT7DMFisz6xSAKeosAs1p/h5fj9zJMg3WmlrbLt0bEkQiS6Cwk+pp7yeq mFkspH4SPjy0Xt/0azA07J7te/vpitJsbEUFmnliPiiRzb1cmVR6eVrcuC0HhD5tL48u fPOOzWJrBCkTZlYbsl+TdPT937jCX3bVLOj/c0Agmd4k1GWtp3+lwuvPRm9vfLtMq/mC DLReSp6iscWNBwxP8tz6NRgSreGqkrovduvwEGc9qfvIJ3b6q/PWf367QqFqPfWHGWdY D2iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715978472; x=1716583272; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R30tVZwDgV0/d0XFfhvgj7VuYYCEcxfHEIQCyiSom9Q=; b=vh6S66QpLl2+LzHA4bMUE53LjePKHfIPZZylsykxzmUJrKegDBo9tCsIdR+EPW8A/n 5vbIisBQa779sQc2fClt06KXZ/pcx6I+jA0FvX5FjrAfc7O/iQynuCkAT0YYnEZifneJ RaKKTN4G/1diTZNuALBkha0Qx7e2XjNPIyxLpBpFVzlV4W5gbwlyD48KDBALu5yPuP3C YSsVdX1d2y7DLwqOC8urhuBhq/0Liga3CDTpWbBMHcbmTCcUVKn+8Q8u6oPVFXjj0oir /DrBBjTpMEI+KnbHBp+094Sy3t+PdRDs39Kd30qF7nZsMEdQ0d8UtxwDgZYmXYc8+97O xuDw== X-Forwarded-Encrypted: i=1; AJvYcCWGPPEpRCuVXSdVmbEI0pnK1kFzf2nsZ/wcgJTPDCPpWQFEjvB5bKgSZR7+JQZXGm8aPic39txqVLM8sBfA68lqWAZqQh2OHATr0bZP X-Gm-Message-State: AOJu0YwIMnwMpsz0ivaJkriW89VeMZHMlsOVGSoWgzS7N5Wk1YGC8AgD +O1Nbp2qxsJWi9EDpBYBmK/8F+UEN7pIXzWHD4934QWTTPzs+EcvLrsa8JGsrDU4EIjMOs19lju EMTmFJLxl+7LWKSB2a6wKC9G8yUGRIm7ZSYE8 X-Received: by 2002:a05:6102:390b:b0:486:2c0:1d86 with SMTP id ada2fe7eead31-48602c02a3cmr6067630137.7.1715978472478; Fri, 17 May 2024 13:41:12 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240517-b4-sio-read_write-v3-1-f180df0a19e6@google.com> In-Reply-To: From: Justin Stitt Date: Fri, 17 May 2024 13:40:59 -0700 Message-ID: Subject: Re: [PATCH v3] fs: fix unintentional arithmetic wraparound in offset calculation To: Matthew Wilcox Cc: Christian Brauner , Jan Kara , Nick Desaulniers , Nathan Chancellor , Alexander Viro , Bill Wendling , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Thu, May 16, 2024 at 6:13=E2=80=AFPM Matthew Wilcox wrote: > > On Fri, May 17, 2024 at 12:29:06AM +0000, Justin Stitt wrote: > > When running syzkaller with the newly reintroduced signed integer > > overflow sanitizer we encounter this report: > > why do you keep saying it's unintentional? it's clearly intended. Right, "unintentional" is a poor choice of phrasing. I actually mean: "overflow-checking arithmetic was done in a way that intrinsically causes an overflow (wraparound)". I can clearly see the intent of the code; there's even comments saying exactly what it does: "/* Ensure offsets don't wrap. */"... So the thinking is: let's use the overflow-checking helpers so we can get a good signal through the sanitizers on _real_ bugs, especially in spots with no bounds handling. Thanks Justin