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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF57EC43334 for ; Thu, 9 Jun 2022 22:05:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245693AbiFIWFZ (ORCPT ); Thu, 9 Jun 2022 18:05:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234857AbiFIWFV (ORCPT ); Thu, 9 Jun 2022 18:05:21 -0400 Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 370D43A707; Thu, 9 Jun 2022 15:05:18 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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!