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 36863C433EF for ; Tue, 7 Jun 2022 14:11:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C1CC6B0072; Tue, 7 Jun 2022 10:11:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 64B526B0073; Tue, 7 Jun 2022 10:11:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C59F6B0074; Tue, 7 Jun 2022 10:11:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 35BD66B0072 for ; Tue, 7 Jun 2022 10:11:06 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 816BB3470B for ; Tue, 7 Jun 2022 14:11:05 +0000 (UTC) X-FDA: 79551626490.25.C3BF48C Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by imf13.hostedemail.com (Postfix) with ESMTP id 442142003F for ; Tue, 7 Jun 2022 14:10:27 +0000 (UTC) Received: by mail-pg1-f180.google.com with SMTP id g186so7093302pgc.1 for ; Tue, 07 Jun 2022 07:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SdrNomF4nhx1466F59Cs0XBm4DrFs3fSMmHF2b5d1e0=; b=YWdHmyRPgXwT5Qi5R4fjTlaDOegA5ZwY7kd0cNW+AniEZ9gqycaerLcysiv7Yc87yE 2C70wH3f79NoW84qA7fZusj7t6pLZo9I8/HVY/ZYiQ7+fljY1WecjXZJrX7H0RSA1Khe 1FTrcwTQayTr7bGlBZpLDOsKqNgr9KglwIATX+xf6dgFs92JIcXMqSfh2wdTOI39fC9y 5eiGZ0pqhBeO8FhoE0bNopfv901Cnm/WzyIQ7K3rjxGPImJO+7L0MCpgOqdojh95CTxg RoOhILHg9P9RcEGMr0E/A2rQr//BDDMwkFwZOdonsdSq3T36wqQkbmUJmO8YvCEQUTw3 78vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SdrNomF4nhx1466F59Cs0XBm4DrFs3fSMmHF2b5d1e0=; b=Dyd97d1zSgshdsEm7EpOiAmlBIHecOTzI9KGiapxeY4JtyI5LE/WjJhZeCMCEnFnl2 RuvUcTOY77AC6E88VbEFPX/zyafwrbXpSQ3OtFcTyubhE6xwgDcVU1XasAMyFMBCpQU+ trxyZHF7W8Q5brASJGkALGUWLHYkryqnSPp1NvFFpzG+3VXuc6YCrCK+Y8UcWU4xyFRq N3LNMX7hRiG6cclHr2wD/qpBPqLvMDiZKqwl0V0xOoJnJReG1aA9uzJLonrskHb8FQEj 6mzqUxVS2H+Gf0IZKUnpygkNCPtNn2ayK66bTiXymNA87UqCvdAeTZy7CUU+tQRH8b+A Krgw== X-Gm-Message-State: AOAM533I4dwq/hgcsAjoMTCx1gsth6JEj0uQgm3EbkQpYZoyorMEcS3A dhFL/Td4rysIOK7Qsx2yjN/TM1Pd1PDftIUr3ewMLQ== X-Google-Smtp-Source: ABdhPJw6uvsovKcKEsVatuSAukDIo0+3pI8rZnaWuOqZGty1hm85rKto4OfXHOtKKjKiaDxzPIkUG/cz9GuFDKZA0VE= X-Received: by 2002:a63:4c09:0:b0:3fc:a85f:8c07 with SMTP id z9-20020a634c09000000b003fca85f8c07mr25624592pga.509.1654611063721; Tue, 07 Jun 2022 07:11:03 -0700 (PDT) MIME-Version: 1.0 References: <6b362c6e-9c80-4344-9430-b831f9871a3c@openvz.org> <360a2672-65a7-4ad4-c8b8-cc4c1f0c02cd@openvz.org> <183333fc-e824-5c85-7c44-270474f5473a@openvz.org> In-Reply-To: <183333fc-e824-5c85-7c44-270474f5473a@openvz.org> From: Shakeel Butt Date: Tue, 7 Jun 2022 07:10:52 -0700 Message-ID: Subject: Re: [PATCH memcg v6] net: set proper memcg for net_init hooks allocations To: Vasily Averin Cc: Qian Cai , Roman Gushchin , Andrew Morton , kernel@openvz.org, LKML , Linux MM , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Vlastimil Babka , Michal Hocko , Florian Westphal , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , Cgroups Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 442142003F X-Stat-Signature: xwbpm7a13m4ih98b7dqx4nostj16qm3t X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=YWdHmyRP; spf=pass (imf13.hostedemail.com: domain of shakeelb@google.com designates 209.85.215.180 as permitted sender) smtp.mailfrom=shakeelb@google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1654611027-968307 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 Tue, Jun 7, 2022 at 5:37 AM Vasily Averin wrote: > > On 6/7/22 08:58, Shakeel Butt wrote: > > On Mon, Jun 6, 2022 at 11:45 AM Vasily Averin wrote: > >> > > [...] > >> > >> As far as I understand this report means that 'init_net' have incorrect > >> virtual address on arm64. > > > > So, the two call stacks tell the addresses belong to the kernel > > modules (nfnetlink and nf_tables) whose underlying memory is allocated > > through vmalloc and virt_to_page() does not work on vmalloc() > > addresses. > > However in both these cases get_mem_cgroup_from_obj() -> mem_cgroup_from_obj() -> > virt_to_folio() -> virt_to_page() -> virt_to_pfn() -> __virt_to_phys() > handles address of struct net taken from for_each_net(). > The only net namespace that exists at this stage is init_net, > and dmesg output confirms this: > "virt_to_phys used for non-linear address: ffffd8efe2d2fe00 (init_net)" > > >> Roman, Shakeel, I need your help > >> > >> Should we perhaps verify kaddr via virt_addr_valid() before using virt_to_page() > >> If so, where it should be checked? > > > > I think virt_addr_valid() check in mem_cgroup_from_obj() should work > > but I think it is expensive on the arm64 platform. The cheaper and a > > bit hacky way to avoid such addresses is to directly use > > is_vmalloc_addr() directly. > > I do not understand why you mean that processed address is vmalloc-specific. > As far as I understand it is valid address of static variable, and for some reason > arm64 does not consider them valid virtual addresses. > Indeed you are right as we are using the addresses of net namespaces and the report already has the information on the address ffffd8efe2d2fe00 which is init_net. I don't know what is the right way to handle such addresses on arm64. BTW there is a separate report on this issue and arm maintainers are also CCed. Why not ask this question on that report?