Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2114538iof; Tue, 7 Jun 2022 20:13:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiXi9Y+tNlqPXJTe1bDa6iwWkj41qW9opJXKEYsSA7QMXhzXgodHtNEUpFGW81ETR5jAIz X-Received: by 2002:a05:6a00:e8e:b0:518:287c:ce82 with SMTP id bo14-20020a056a000e8e00b00518287cce82mr32129341pfb.4.1654658001600; Tue, 07 Jun 2022 20:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654658001; cv=none; d=google.com; s=arc-20160816; b=OqFQuQ+AnDCVjMXWFKe9Bub1rdF1Jv8TuT8arAIjqqFlg1EgEr6m/9fJsVJOpElpXg dlS1lRZFf+VYIY26AYZE/RgT3Uu+x1l6mqc+TjVTkK9+I0yM7asIPmHRDl3P0looQmyU Z6N03l7YFXe4wvcwQGNzlD0uJ+xC2ZC7GnLJniNADaMShOCZeKrTou/qEeXPm188kRB6 Dw/G3lIoutp1EVC5Suax4Jcnik+7E+dQ0mmFfiOAjXWiCpPSahWyqXvnRNJocWxzymPC 5uc2REMmkT28h2axljSDGxMc6eJG63rB7DKn5wspqMOm04ZAXpHA1C9rYHJEUrb5ufFT 2m/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=7VWPEvvINNs28ioVlXIeYh81foNtBWzaOhBPLFOuk84=; b=f2wTVqyT7VwWY9IJ7aGB7U+XlXAOMTJhq0o3ZtCqdWXVfFILrrsWFegRUwhOIuH2/o zLFwe4RZTG+7gwE41VDV6hBuADqAvIY+9mWk/4+14pHXgrmaxZZxarVfnlRoz9nx25sc Wnu4PCLaST9zmPaVEm0dJppGqvMsuQ/PrW8t+H+awIYa7CBl58HwcqvRd9zOBjp004we 4eLS3VXxwkqyFQ9tTGk0jGHitb8YOrTDj07IVTvQqk3EpIVE6iT8ra1ZSAooyqKPD3TI tvHQVlK/0G6GWGw7DHwoCfkB9D6gDELG07ScHpECAff91QxKu3t3hKXi+EHECiJnYa9X kPXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=XrDpP52+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bo15-20020a056a000e8f00b0051ba768d329si22684290pfb.240.2022.06.07.20.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 20:13:21 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz-org.20210112.gappssmtp.com header.s=20210112 header.b=XrDpP52+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvz.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 25E612A3054; Tue, 7 Jun 2022 19:15:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239262AbiFGMjJ (ORCPT + 99 others); Tue, 7 Jun 2022 08:39:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244030AbiFGMi2 (ORCPT ); Tue, 7 Jun 2022 08:38:28 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715D8FF5A4 for ; Tue, 7 Jun 2022 05:37:55 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id y32so28098098lfa.6 for ; Tue, 07 Jun 2022 05:37:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz-org.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=7VWPEvvINNs28ioVlXIeYh81foNtBWzaOhBPLFOuk84=; b=XrDpP52+3EO0X6LweAf3F2Fn+6FcjsCkhpPi7cjUn8ibrMfSb3D2UbsdA6Orz2hz6W //fYF1I8NLKAdicy7sFdjyHXNKIREf3piAeuQEU3Z2Kf+IN/ONt/N0N7mgpRrygVEzRB +uUhMhRCs+Z5gNM2IRxJ24vhTiSjTVXTaghQVEWUPss4PLhOCP/yNOmaDmX7orALggYF xKeGKvLDPSJX6bLRhtSS63GFgPcMZcTyA0lY+Po8NSF7k54K5O3TbvZxudLTQPWbRZ81 hffyMNvw50jHBWi7EJiXxKJbXdYVuHNEv+gXDpQiL6y/EmPXZw1ODm24jBWpW1vh1e2G ocIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=7VWPEvvINNs28ioVlXIeYh81foNtBWzaOhBPLFOuk84=; b=bJziGm6f8f+n1E3CVJPTNgdN32V1G+wtBwtyFPAsLFs/lblAAQNgDauN/1xdHqJ20L eOiUvZee/kvfnWmwZe/G8/0lsseVFzLINERtI/kzVMInfuLRNAvwnr5uYCP2XW2fVwTH ANyqno5TSRPymRFh1jyEgYXPDmBJ8tA8fOit15ZLLgM7hdsJ/Bu8CDUAJjAHkfbE5Seu 0dZUTXJd3drlWiVLle41Zdgy04Rs/do1rsuWM3TzB+o0SQt9SjfiFHR79Ddlq4W1Xj56 5HOJFKBVEKLcA3WKON10EeORJmFBiko2daTbIB2c3rLrcRi5BY4rW4sW7Xkss7LGptPC gIKQ== X-Gm-Message-State: AOAM530UqJdKIe6qqavf/EYYH+ik4u7pbI+IoGtYH/QqMolTxx6k5goN odkqUsjKEd7RCmxN//wIGRCjWQ== X-Received: by 2002:ac2:5d22:0:b0:478:9e46:ae85 with SMTP id i2-20020ac25d22000000b004789e46ae85mr18388836lfb.126.1654605473561; Tue, 07 Jun 2022 05:37:53 -0700 (PDT) Received: from [192.168.1.65] ([46.188.121.129]) by smtp.gmail.com with ESMTPSA id q23-20020a05651232b700b00478ffd14ac1sm3259016lfe.163.2022.06.07.05.37.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Jun 2022 05:37:53 -0700 (PDT) Message-ID: <183333fc-e824-5c85-7c44-270474f5473a@openvz.org> Date: Tue, 7 Jun 2022 15:37:51 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH memcg v6] net: set proper memcg for net_init hooks allocations Content-Language: en-US To: Shakeel Butt 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 References: <6b362c6e-9c80-4344-9430-b831f9871a3c@openvz.org> <360a2672-65a7-4ad4-c8b8-cc4c1f0c02cd@openvz.org> From: Vasily Averin In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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. Thank you, Vasily Averin