From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 93D81A00C3; Thu, 23 Apr 2020 22:04:34 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BFED51C220; Thu, 23 Apr 2020 22:04:33 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 4CC341C210 for ; Thu, 23 Apr 2020 22:04:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587672271; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iQ7XumCWpipFM0jdbfbgtYUl+LoIugE3AKcHhH3DZMA=; b=UUCpS8nGdI/z6bMavSiEG4gLmbx2i5HUDsTn3/iAYsc6q3LCMEpCHqaKXSpOWQyaXmh4I3 GEIbdKrh88Ykr4I7d3iNp7Sdal9x3xbUOELfoTqUC0NBDKQj4oveuhLmvQKkWXNFEn4yPb EaQiTl69bk4O0Rb+DZdNwjp2G9G1J7o= Received: from mail-ua1-f72.google.com (mail-ua1-f72.google.com [209.85.222.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-456-x7yIyVpRNoWnH0W777_Uug-1; Thu, 23 Apr 2020 16:04:26 -0400 X-MC-Unique: x7yIyVpRNoWnH0W777_Uug-1 Received: by mail-ua1-f72.google.com with SMTP id x6so3735769uaj.13 for ; Thu, 23 Apr 2020 13:04:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WNpoi3CLrgTWo3pWhx2ophbj9g9Mxw1J2GqvPajruKU=; b=VeDhNZ1NcN0IOHgmPVRalkv2GCsTzETtz+VLcqotdj0Kj8NCEFchlu5G2WZZ1jIGnw A+zyLeroLnACGKq70+XtOV9lmguzA/dBLvryCkg2oqvMTZYSumXluRXJduSyJzWblmhY yIZUW0efk/rCu6RGahZYwlFATKCOT+kY8I1HM+SChaYQGRG3CYEApZDTFTaaizcU+K0X 6R/zg9CjxNtndxFTMDYjGQqhAALWfzlWYTtbGK7Kk1TwW5MPfEDt++bL7CXAegpKFKAk /P3ng2FprY+Zy5Kken7nEmoYp/vc1/bTKidsdAwBYSKfwb9t1c2saU62qaJhagNo6f5w benw== X-Gm-Message-State: AGi0PuaHaNE2fHfP83jZOzsEhk0NxdeI5ixRjheyO8S4+RkEel/GRJ+A CH9raLVRH6bJo6AhJAHXzwPTGojJTHb0qTcJOnvFQq/xux1Yc/k/V0VbzBSEhh2lSjZENcd2PJa 0uZ1r69ECKaqdr5fhEzA= X-Received: by 2002:a05:6102:382:: with SMTP id m2mr4917226vsq.141.1587672266183; Thu, 23 Apr 2020 13:04:26 -0700 (PDT) X-Google-Smtp-Source: APiQypJP5EfqMRxOxE1UTs1yat5XXYlPbdnmvR5rvyUZT2d4kLXSzgDvoHaniavwh83AStMwbzSjAlW+6SmizfbWajI= X-Received: by 2002:a05:6102:382:: with SMTP id m2mr4917198vsq.141.1587672265860; Thu, 23 Apr 2020 13:04:25 -0700 (PDT) MIME-Version: 1.0 References: <20200420070508.645533-1-fengli@smartx.com> <20200423154302.2217041-1-fengli@smartx.com> <9d6dc63b-34f7-36b3-5c3f-df74b71d961c@intel.com> In-Reply-To: <9d6dc63b-34f7-36b3-5c3f-df74b71d961c@intel.com> From: David Marchand Date: Thu, 23 Apr 2020 22:04:14 +0200 Message-ID: To: "Burakov, Anatoly" Cc: Li Feng , dev , Kyle Zhang , Feng Li , fanyang@smartx.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v2] eal: add madvise to avoid dump memory X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Apr 23, 2020 at 6:34 PM Burakov, Anatoly wrote: > > diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal= /common/eal_common_memory.c > > index cc7d54e0c..2d9564b28 100644 > > --- a/lib/librte_eal/common/eal_common_memory.c > > +++ b/lib/librte_eal/common/eal_common_memory.c > > @@ -177,6 +177,20 @@ eal_get_virtual_area(void *requested_addr, size_t = *size, > > after_len =3D RTE_PTR_DIFF(map_end, aligned_end); > > if (after_len > 0) > > munmap(aligned_end, after_len); > > + > > + /* > > + * Exclude this pages from a core dump. > > + */ > > + if (madvise(aligned_addr, *size, MADV_DONTDUMP) !=3D 0) > > + RTE_LOG(WARNING, EAL, "Madvise with MADV_DONTDUMP= failed: %s\n", > > + strerror(errno));> + } else { > > + /* > > + * Exclude this pages from a core dump. > > + */ > > + if (madvise(mapped_addr, map_sz, MADV_DONTDUMP) !=3D 0) > > + RTE_LOG(WARNING, EAL, "Madvise with MADV_DONTDUMP= failed: %s\n", > > + strerror(errno)); > > } > > > > return aligned_addr; > > > > For the contents of this patch, MADV_DONTDUMP does not seem POSIX, but as I said [1], there seems to be a MADV_NOCORE option on FreeBSD. 1: http://inbox.dpdk.org/dev/CAJFAV8y9YtT-7njUz+mD6U8+3XUqYrgp28KD7jy2923Ep= AcXrg@mail.gmail.com/ > > Acked-by: Anatoly Burakov > > However, even though this is good to have, after some more thought, i > believe the fix is incomplete, because this is not the only place we're > reserving anonymous memory. We're also doing so in > `eal_memalloc.c:free_seg()`, so an `madvise()` call should also be added > there. > > @David, now that i think of it, the PROT_NONE patch also was incomplete, > as we only set PROT_NONE to memory that's initially reserved, but not > when it's unmapped and returned back to the pool of anonymous memory. > So, eal_memalloc.c should also remap anonymous memory with PROT_NONE. I can't disagree if you say so :-). > > @Li Feng, would you be so kind as to provide a patch replacing PROT_READ > with PROT_NONE in eal_memalloc.c as well? Thank you very much! > Once we have the proper fixes, I'd like to get this Cc: stable@dpdk.org. Thanks. --=20 David Marchand