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 X-Spam-Level: X-Spam-Status: No, score=-16.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2304C433E0 for ; Wed, 3 Feb 2021 20:03:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 53BB964F6C for ; Wed, 3 Feb 2021 20:03:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53BB964F6C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BC8ED6B006C; Wed, 3 Feb 2021 15:03:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B79E06B006E; Wed, 3 Feb 2021 15:03:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8F8E6B0070; Wed, 3 Feb 2021 15:03:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0045.hostedemail.com [216.40.44.45]) by kanga.kvack.org (Postfix) with ESMTP id 90B3E6B006C for ; Wed, 3 Feb 2021 15:03:14 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4FBF78249980 for ; Wed, 3 Feb 2021 20:03:14 +0000 (UTC) X-FDA: 77778030708.29.cable78_581648c275d6 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 24F91180868D5 for ; Wed, 3 Feb 2021 20:03:12 +0000 (UTC) X-HE-Tag: cable78_581648c275d6 X-Filterd-Recvd-Size: 5379 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Wed, 3 Feb 2021 20:03:10 +0000 (UTC) Received: by mail-pl1-f179.google.com with SMTP id u15so480341plf.1 for ; Wed, 03 Feb 2021 12:03:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SnxhWz1pN2kdt7xfbO4NRF8c0j2EbnQ4AfDU/TQ6pI0=; b=IJAT+V9jEKmD3/hz9sZZbR6exYwBw75s6HVYvCREJIM03/RdTo3G6cQ+RvQ1orR5p4 kc4JqKf6397I8VNQmJrFTNP3jO5nFJYrxviBV4RM+nLn3gvWw/OrxTG+KoJqZXYv1Kde VgySvk7uRqNgqNfTqopEuJXxjPPuaz/g8DVTE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SnxhWz1pN2kdt7xfbO4NRF8c0j2EbnQ4AfDU/TQ6pI0=; b=VpCFlBukKN6p3e5XxlRPhdY98SZJr1FXBxz4NZK2okMMSJyOkjiKv14CZyOI9rxwqq SLX3SH82B7RsR94yO0a1qn6R0gEpn829yBojua3wq1hbmHzObkeTqU8qyp3S0oVHDGp7 D+5ZYlQ+ozowihKmfFKfE5tlc6WrOcpTN7/oBpHdTgC8jwHMtayX0EJlZxOVSUir/By3 CGce+/7ObF+pQY28U9j5CBujfKmD4gNvX45JN1YWpXNZrfh8gpRg8OGKTDRodCmqfxX3 OzZF/qmLxeRfVVmnRLAAKXACsKkUrjlb3COUgmCivSVjYBoq2C9MjQsWtycrIfEiiTE6 JX6g== X-Gm-Message-State: AOAM530h3oMcE/i5jrEiAmPeX7rUeiwyJqn/FVUEuOIMIV/zatcVlcia P1R44kBA9fqx1fRvyeg0Bz+2oQ== X-Google-Smtp-Source: ABdhPJzy/ot00jPf50W+6aRzRBLtT42uZYU3mpc8lCUNPUApoInnp5OnjQ9oTpnPaiDbD6WpZSh0qA== X-Received: by 2002:a17:90b:3886:: with SMTP id mu6mr4570866pjb.153.1612382590066; Wed, 03 Feb 2021 12:03:10 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id j9sm3682830pgb.47.2021.02.03.12.03.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 12:03:08 -0800 (PST) Date: Wed, 3 Feb 2021 12:03:07 -0800 From: Kees Cook To: Nathan Chancellor Cc: Arnd Bergmann , Andrew Morton , Nick Desaulniers , "Kirill A. Shutemov" , Wei Yang , Arnd Bergmann , Vlastimil Babka , Dmitry Safonov <0x7f454c46@gmail.com>, Brian Geffon , linux-mm@kvack.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: Re: [PATCH] mm/mremap: fix BUILD_BUG_ON() error in get_extent Message-ID: <202102031202.F0AEC4A7@keescook> References: <20201230154104.522605-1-arnd@kernel.org> <20210112191634.GA1587546@ubuntu-m3-large-x86> <20210203184840.GA1711681@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210203184840.GA1711681@localhost> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Feb 03, 2021 at 11:48:40AM -0700, Nathan Chancellor wrote: > On Tue, Jan 12, 2021 at 12:16:34PM -0700, Nathan Chancellor wrote: > > On Wed, Dec 30, 2020 at 04:40:40PM +0100, Arnd Bergmann wrote: > > > From: Arnd Bergmann > > > > > > clang cannt evaluate this function argument at compile time > > > when the function is not inlined, which leads to a link > > > time failure: > > > > > > ld.lld: error: undefined symbol: __compiletime_assert_414 > > > >>> referenced by mremap.c > > > >>> mremap.o:(get_extent) in archive mm/built-in.a > > > > > > Mark the function as __always_inline to avoid it. > > > > > > Fixes: 9ad9718bfa41 ("mm/mremap: calculate extent in one place") > > > Signed-off-by: Arnd Bergmann > > > > I would like to see some movement on getting this fixed in 5.11. As it > > stands, this is one of three __compiletime_assert references with > > CONFIG_UBSAN_UNSIGNED_OVERFLOW. If we want to keep the BUILD_BUG() > > around, I think this is fine. Alternatively, turning it into a runtime > > check would be fine too. > > > > Reviewed-by: Nathan Chancellor > > Ping? It is pretty late into the 5.11 cycle and this is still broken. I think we should just do the __always_inline. Who can take this? -Kees > > Cheers, > Nathan > > > > --- > > > mm/mremap.c | 5 +++-- > > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > > > diff --git a/mm/mremap.c b/mm/mremap.c > > > index c5590afe7165..1cb464a07184 100644 > > > --- a/mm/mremap.c > > > +++ b/mm/mremap.c > > > @@ -336,8 +336,9 @@ enum pgt_entry { > > > * valid. Else returns a smaller extent bounded by the end of the source and > > > * destination pgt_entry. > > > */ > > > -static unsigned long get_extent(enum pgt_entry entry, unsigned long old_addr, > > > - unsigned long old_end, unsigned long new_addr) > > > +static __always_inline unsigned long get_extent(enum pgt_entry entry, > > > + unsigned long old_addr, unsigned long old_end, > > > + unsigned long new_addr) > > > { > > > unsigned long next, extent, mask, size; > > > > > > -- > > > 2.29.2 > > -- Kees Cook