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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05A6BC433EF for ; Thu, 9 Jun 2022 22:05:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 632818D004E; Thu, 9 Jun 2022 18:05:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E1718D0034; Thu, 9 Jun 2022 18:05:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A9A28D004E; Thu, 9 Jun 2022 18:05:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3CBE28D0034 for ; Thu, 9 Jun 2022 18:05:19 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1624735BA8 for ; Thu, 9 Jun 2022 22:05:19 +0000 (UTC) X-FDA: 79560079158.18.85D8546 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf14.hostedemail.com (Postfix) with ESMTP id 78432100055 for ; Thu, 9 Jun 2022 22:05:18 +0000 (UTC) Date: Thu, 9 Jun 2022 15:05:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1654812316; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2UPb9iES8+SbQezsY3NnPZtFOJWYv6G44yCeplV12hY=; b=AHIturndbBN4CDx+oNBA07koXNaHAnzUcQra6tCpOXsmCewQ4MeJkX80gobs4dh570+SQq +Bo4vun5rtA+c12uZE3thcsY5phDz87d6tZkz1IiXOycsCMz7nrpGc2Jh+At2f1ecObMTL V4iu5dpTqsNdKlca0Ehf+ZZRKay27Ik= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Shakeel Butt Cc: Naresh Kamboju , Linux-Next Mailing List , open list , regressions@lists.linux.dev, lkft-triage@lists.linaro.org, Linux ARM , linux-mm , Stephen Rothwell , Andrew Morton , Ard Biesheuvel , Arnd Bergmann , Catalin Marinas , Raghuram Thammiraju , Mark Brown , Will Deacon , Vasily Averin , Qian Cai Subject: Re: [next] arm64: boot failed - next-20220606 Message-ID: References: <20220609191221.rv3lqbhipnvvzt67@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220609191221.rv3lqbhipnvvzt67@google.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1654812318; a=rsa-sha256; cv=none; b=3wgTQHv9HZcvgn7v7fyP1oHXPB6EhFqsBb+phAuHXjWIP3Sx9iULqD9hbHC4QeKKxd3xiF HvuaIeuC6qRuZUtuRswwpFgjCRDOvAuaxYIBUM5BdDeHh00fXwUYi+Hw3kNWq2qFyv8mCb /++2EFfeMJE3TP0CzxMrCLVn+JxoZXk= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=AHIturnd; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf14.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1654812318; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2UPb9iES8+SbQezsY3NnPZtFOJWYv6G44yCeplV12hY=; b=oYbxaR+7ixr46rAh2CYjtrrp4ssItr7xjix5jJfFYdiXhydavFGtNsHeu4bqM+NQ1k8l+3 Px4AvPiSSPfMHmchESVvdwqzmrWKoW82n1MFXxm083qFtq3uow51KMFXGOM5PnKfkrf7Jh Q0FwoT4YRfSILbTFa99sHDEsxdSKFrw= X-Stat-Signature: z4w6mro8escro3z1s7dp3e7eja7645am X-Rspam-User: X-Rspamd-Queue-Id: 78432100055 X-Rspamd-Server: rspam07 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=AHIturnd; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf14.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-HE-Tag: 1654812318-307995 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 Thu, Jun 09, 2022 at 07:12:21PM +0000, Shakeel Butt wrote: > On Thu, Jun 09, 2022 at 10:56:09AM -0700, Roman Gushchin wrote: > > On Thu, Jun 09, 2022 at 10:47:35AM -0700, Shakeel Butt wrote: > > > On Thu, Jun 9, 2022 at 10:27 AM Roman Gushchin wrote: > > > > > > > [...] > > > > +struct mem_cgroup *mem_cgroup_from_obj(void *p) > > > > +{ > > > > + struct folio *folio; > > > > + > > > > + if (mem_cgroup_disabled()) > > > > + return NULL; > > > > + > > > > + if (unlikely(is_vmalloc_addr(p))) > > > > + folio = page_folio(vmalloc_to_page(p)); > > > > > > Do we need to check for NULL from vmalloc_to_page(p)? > > > > Idk, can it realistically return NULL after is_vmalloc_addr() returned true? > > I would be surprised, but maybe I'm missing something. > > is_vmalloc_addr() is simply checking the range and some buggy caller can > provide an unmapped address within the range. Maybe VM_BUG_ON() should > be good enough (though no strong opinion either way). No strong opinion here as well, but I think we don't have to be too defensive here. Actually we'll know anyway, unlikely a null pointer dereference will be unnoticed. And it's not different to calling mem_cgroup_from_obj() with some random invalid address now. Thanks!