Message ID | 20180629183754.b5accab9f7f6593a39d6f0be@linux-foundation.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1ED0060327 for <patchwork-linux-mm@patchwork.kernel.org>; Sat, 30 Jun 2018 01:37:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E66CB294D7 for <patchwork-linux-mm@patchwork.kernel.org>; Sat, 30 Jun 2018 01:37:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D79C8294DF; Sat, 30 Jun 2018 01:37:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24410294D7 for <patchwork-linux-mm@patchwork.kernel.org>; Sat, 30 Jun 2018 01:37:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37B436B0008; Fri, 29 Jun 2018 21:37:57 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 32A806B000C; Fri, 29 Jun 2018 21:37:57 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21B5D6B000D; Fri, 29 Jun 2018 21:37:57 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id D45F56B0008 for <linux-mm@kvack.org>; Fri, 29 Jun 2018 21:37:56 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id ba8-v6so3733341plb.4 for <linux-mm@kvack.org>; Fri, 29 Jun 2018 18:37:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:date:from:to :cc:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=1T2LkJfPC7MLcPxk9zQMuQ9H3F1s5fl4k/Dij5HuX4Y=; b=EjtpsQtN83wX3cywODuIJKHCXjJi73pEDnvpjq9JDHu70Ue+OqcKepcznQRMBgWAmN G2L7Yq/3k//7Q/xl4vcpFq3q0PxA5u7QtcrThP1sSbI+Z7ObD3rgIs14H+k927S295kW kiLed4XGXd8TE7MWJaLlmC/g111qJSPU19G1Xgy6OZp1c9Ln90YIw6R1iucc0RDLM3g7 eRqWts3TtyDquBRaPM5hUUal2qhBcs9CMChFG1TLqvIuzefLqpVosX6fBEEACRWK1x33 6qQlKf4If7SNIJYgkZIuYDRIJve4i4K7YFxD3ho7ybSiZqfP1zE9BF6Q17yqRxIwiozD JpEg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Gm-Message-State: APt69E2I5zGgol0+XFeiSC0O5hbU16bKrfRs3my9+n8hizNzwvgR4zsZ dW+CNFd8VwPcKf6b164jcYV0oUUro9f5WCQ7RV1BRrzgz71t1CSM4PBXEMB3lMII3ewlSjECZ66 lliW5QqlHYEJYOnkyHUInuu0gKGSuZ5sUKO/U1D94XGcPjkyMoc5jGiCiFhc+ZGv4Gg== X-Received: by 2002:a62:b94:: with SMTP id 20-v6mr16355343pfl.234.1530322676546; Fri, 29 Jun 2018 18:37:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeu14p9zQl7cX//2EpAewxhxCXD5n+VabYD0RLKL+ULq3HiUFMQoPeMrbmSCOT2aVBj6bXf X-Received: by 2002:a62:b94:: with SMTP id 20-v6mr16355311pfl.234.1530322675635; Fri, 29 Jun 2018 18:37:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530322675; cv=none; d=google.com; s=arc-20160816; b=Exoo+1zu+GttnxWu0iIIM0thNHfhI5GGDJwsbbmdY3vtz96hbCh+HSa0dgOpaeaK1v 0n9YHHSs/xI5I0SncRN9rApfYAyh+oZTDYgoy0JN2FmyPhXn0IhcXeCOapOXH+XNWROT Z6rLwW/xYgR7l9B7gVGvwPzzcci9QRT5fhrXzvOyfEdEOzfJnL+HE2ETDaOS636BaBbW trUFmuIxxkQDKM7AqKH3xVfVze9EgC2veAlBw6fDRI23sD3nNW3c/hb5/dSslBE5/MNo k2UyR9/nZj2Fl1Eg6SnF75Ji6Ad8zA33FEROaaup0ZRU6N3zlEUjkLKbg4BNZRiwZJRY 6xWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:arc-authentication-results; bh=1T2LkJfPC7MLcPxk9zQMuQ9H3F1s5fl4k/Dij5HuX4Y=; b=yJE8xDhhBXy4uzpAARpb63EkcoddsxrVxBLTqjwNjzYkvOchMe5tC3FfgTujAKf7K4 WFmDQ1p83qqd1gjrCcoMO1CUCZNoJi/i7VBX0va8Apb9R/VewkAbsLhLk3+1/v0fAw62 3YemAN6Q6KCmNRVBCz0+IHk2rKKD5znPthmHrGwrHj56kHIcH8Qaxlg9puWQPaZ1eSMx XCcGFyEbY/l1jixhwIRVy/KSmfqSyrJ3k2ahaRRWSwgPTIO6h3QW4A8H2ouoV4T+qh/m 3uFgwkn/jm1DkdaGGrUgVmVrjyBjGnh419YjVZFNIVuKYSgJ3+0k9PUkBZjmuXZvxZbT eKlA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org. [140.211.169.12]) by mx.google.com with ESMTPS id 67-v6si9134200pgi.456.2018.06.29.18.37.55 for <linux-mm@kvack.org> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Jun 2018 18:37:55 -0700 (PDT) Received-SPF: pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.12 as permitted sender) client-ip=140.211.169.12; Authentication-Results: mx.google.com; spf=pass (google.com: domain of akpm@linux-foundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org Received: from localhost.localdomain (c-24-4-125-7.hsd1.ca.comcast.net [24.4.125.7]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 25560CA0; Sat, 30 Jun 2018 01:37:55 +0000 (UTC) Date: Fri, 29 Jun 2018 18:37:54 -0700 From: Andrew Morton <akpm@linux-foundation.org> To: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: icytxw@gmail.com, Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/fadvise: Fix signed overflow UBSAN complaint Message-Id: <20180629183754.b5accab9f7f6593a39d6f0be@linux-foundation.org> In-Reply-To: <20180629184453.7614-1-aryabinin@virtuozzo.com> References: <20180627204808.99988d94180dd144b14aa38b@linux-foundation.org> <20180629184453.7614-1-aryabinin@virtuozzo.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000076, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> X-Virus-Scanned: ClamAV using ClamSMTP |
--- a/mm/fadvise.c~mm-fadvise-fix-signed-overflow-ubsan-complaint-fix +++ a/mm/fadvise.c @@ -72,7 +72,11 @@ int ksys_fadvise64_64(int fd, loff_t off goto out; } - /* Careful about overflows. Len == 0 means "as much as possible" */ + /* + * Careful about overflows. Len == 0 means "as much as possible". Use + * unsigned math because signed overflows are undefined and UBSan + * complains. + */ endbyte = (u64)offset + (u64)len; if (!len || endbyte < len) endbyte = -1;