Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2117455iof; Tue, 7 Jun 2022 20:18:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/LctjXWYrxJZafzZ+RV/jnfwZwzHdZyyN4E7kORen++KHdMo57DCiGNMzc3V+Vs60Ka+W X-Received: by 2002:a17:90a:bc98:b0:1e8:6895:645e with SMTP id x24-20020a17090abc9800b001e86895645emr19498170pjr.131.1654658323465; Tue, 07 Jun 2022 20:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654658323; cv=none; d=google.com; s=arc-20160816; b=aarMkUWCs4gQi1ISjGcFHPAXKSkSNJQ5U5WUo/w0vWbmU1jFWAA1ti6XduRm6zamV1 6vGeQ+UE2VmgF8c6R1SVGEmpIBTrgQqVpSV6xhfr3yqcug+q6p4QQXVMpB3+db3FdA+J wOsD4/LKsgpPDq8RvLvVFtB8ioqc6fo1gkYXQBK7mg+mE1X7RK6/ysDaTz05T860s1MJ kEv50iZqoaz4/x8k2Xo273eJ0QWTCSc9bstHrJTamRZPQO9a6oV9PI2URL3srbx0jr2J prxVE+fzFOY9s6XkwIokBLDSFdGalAoYH3O/yx+BPlIody9I6yra0Wf3QbL3kwIoZB6T q44g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SdrNomF4nhx1466F59Cs0XBm4DrFs3fSMmHF2b5d1e0=; b=AV1vOLkorsUX0eF9HJyc70gRFt+8Wv45v3TpdP/46aTGpGKfImlM3sZMYuQu8DRUfG a4WGQyuQz7Hx6qF/ck7jLadbgF9zjATRyJpwk+/I1k5JmzYXQveLV2xLKq6RBE8CU07a X/PUPxiTkN3Fhp6gooKFeokosPOezCldxL2c/uEuAIToppQFUzfu1Ngdqo/cEKrgkeC3 B6VeQcJ4KZeAj5YEFSZy4MGE7dARKyWod17HnU7MZXBHGPDuvxZD9rFwE2UnrT5pQaY+ vFI8WDDbtw1Q0wDmYyUuNqdFRLJOkROZYr+OVLxI1SKl02VPx/jt+5TqKkZq4C4YIgyY /V7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=YWdHmyRP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h17-20020a170902f55100b0015d0f3a4ac5si28034145plf.300.2022.06.07.20.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 20:18:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=YWdHmyRP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A9E18254ECF; Tue, 7 Jun 2022 19:27:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244121AbiFGOLH (ORCPT + 99 others); Tue, 7 Jun 2022 10:11:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235212AbiFGOLG (ORCPT ); Tue, 7 Jun 2022 10:11:06 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D7869B1BD for ; Tue, 7 Jun 2022 07:11:04 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id 187so15632439pfu.9 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=WAPIWw3SHOOmNFbwwzm41y9kJOoclOiKTIkuyuxklPhfbuX/wFyyrcKlrSxEH1t+dW Nvnh1jrd8+be51H3lvwL086z184+nN8F7VWh8A2h54WzmXDnvBKah8zzsyO+VK47HEl+ 2Y3O8un2aqGN2uVKkAVuqlu/KCOjidb5HWrgRBY1c/7xo8EsKj7d/dQvywB2o1zxllgN vtEpOANx1V9vqLb4qHMc/K+wurX5wNHuf8iYo6lhPtbh6USnIuhZY+acxsF09bp0Qtce GPE6jXDKDTQDibVVkRXNDRCBgNxCf2oHQRqmIvJ+mTEM/lAG6BPZWIRxtNKpdgBbi+C2 uM7Q== X-Gm-Message-State: AOAM531nCArqWzspR1A6S2fozDK49VXMVnZXgYFnbn0g4QpQ09hIxpYJ cf/udcy1q750VOpBQPMC8bmo8Cl4Z1Q7NS2bEBYReQ== 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-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?