From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from compass.polito.it (compass.polito.it [130.192.55.110]) by dpdk.org (Postfix) with ESMTP id 14B741396 for ; Fri, 1 Apr 2016 13:17:07 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by compass.polito.it (Postfix) with ESMTP id DD457100180 for ; Fri, 1 Apr 2016 13:17:06 +0200 (CEST) Authentication-Results: compass.polito.it (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=studenti.polito.it DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= studenti.polito.it; h=content-type:content-type:cc:to:from:from :subject:subject:message-id:date:date:references:in-reply-to :received:mime-version:received:received:received; s=y2k10; t= 1459509425; bh=QpA6W5CQ4YafW6mbKtRgT9PASb4v1KSi2qpSvGvpLhY=; b=g Z+ZaTfHuPMp0bJ4zP5kWOrKv6BtpJcZ4+F5ziOD98thuqyiW0s3pSdjwfBmMnO7m BwkQUE382Za4EFDLifJZ6+O/QLkpnvFaIs675U5s34C+ReURrCvk+h1XP4h/0xl8 Dmy2rwd3qh7nCkJqJES+yf5ifedvitmYStRo7X6zF4= X-Virus-Scanned: amavisd-new at studenti.polito.it X-Spam-Flag: NO X-Spam-Score: -5.859 X-Spam-Level: X-Spam-Status: No, score=-5.859 tagged_above=-100 required=3.5 tests=[ALL_TRUSTED=-5, AWL=0.640, BAYES_00=-1.5, HTML_MESSAGE=0.001] autolearn=ham Received: from compass.polito.it ([127.0.0.1]) by localhost (compass.polito.it [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id pl_xToBY2XYR for ; Fri, 1 Apr 2016 13:17:05 +0200 (CEST) Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: s203403@studenti.polito.it) by compass.polito.it (Postfix) with ESMTPSA id BE62F1001CD for ; Fri, 1 Apr 2016 13:17:05 +0200 (CEST) Received: by mail-lf0-f51.google.com with SMTP id g184so5060033lfb.3 for ; Fri, 01 Apr 2016 04:17:05 -0700 (PDT) X-Gm-Message-State: AD7BkJK8umMMAW1SApUYCXMvLo/lffPt5hZxJHxCwXviZDGfPrwKBTmBXuKqsaSYKxf0UYRBH9fOflUoZZ+xGg== MIME-Version: 1.0 X-Received: by 10.25.79.139 with SMTP id d133mr3193278lfb.98.1459509425336; Fri, 01 Apr 2016 04:17:05 -0700 (PDT) Received: by 10.25.0.198 with HTTP; Fri, 1 Apr 2016 04:17:05 -0700 (PDT) In-Reply-To: References: <1459498608-10789-1-git-send-email-mauricio.vasquezbernal@studenti.polito.it> Date: Fri, 1 Apr 2016 13:17:05 +0200 X-Gmail-Original-Message-ID: Message-ID: From: =?UTF-8?Q?Mauricio_V=C3=A1squez?= To: "Burakov, Anatoly" Cc: "dev@dpdk.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] ivshmem: fix race condition X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Apr 2016 11:17:07 -0000 Hi Anatoly, On Fri, Apr 1, 2016 at 11:01 AM, Burakov, Anatoly wrote: > Hi Mauricio, > > > The memory zone could be freed just after adding it to the metadata > > file and just before marking it as not freeable. > > This patch changes the locking logic in order to prevent it. > > Just a nit: if the stated purpose of the patch is to prevent the memzone > free > before adding it to metadata, then it probably should check if the memzone > wasn't freed before we got the lock (or if it's a valid memzone in the > first place). > Probably just checking if the virtual address of the memzone isn't 0 would > be > enough. Otherwise looks fine to me. > > The purpose of this patch is to avoid a memzone be freed after it has been added to the metadata but before it is marked as not freeable. (that small time interval where it is possible). Avoid adding an already freed memzone is another case, I will send a v2 that addresses it. I used the length of the memzone to check whether the memzone is valid or not. > Thanks, > Anatoly > Mauricio Vasquez,