From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DC10741C5F for ; Fri, 10 Feb 2023 12:01:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC6E640EE6; Fri, 10 Feb 2023 12:01:41 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 3F89740EE6 for ; Fri, 10 Feb 2023 12:01:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676026899; 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: in-reply-to:in-reply-to:references:references; bh=aN0NAg8QPgUUS7dpECC5iZ32jC8hVLrK55kzAfKfdog=; b=RDrUW3eJB/WFNvitTMiU4egf/AOKlYMLsUVX76kcqZBVSGX05wxy71YedQFZQGtkTasXWN X2NHAP10t90E7MZdwnD6zQv2Ukc1xD4mGD1fA+1tUeu0FTCGWvAKqe2I6NfMyNJfSG9/Ts 7oNQNryXdiD+0T99F24pSiCc4+EZkiI= Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-9-b0ZdJwCCPsGM1pkE0yLhzQ-1; Fri, 10 Feb 2023 06:01:38 -0500 X-MC-Unique: b0ZdJwCCPsGM1pkE0yLhzQ-1 Received: by mail-pg1-f198.google.com with SMTP id c8-20020a630d08000000b004fb299589a2so2435976pgl.15 for ; Fri, 10 Feb 2023 03:01:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aN0NAg8QPgUUS7dpECC5iZ32jC8hVLrK55kzAfKfdog=; b=J/LtO1VsSvF+HNhFFawEJhY5yBWE5kFh/FDL6+cbs2kp1WtvGjXJZ6p91kWpXxXtG/ KbLJ9P3Vp7KAeCNX5q1OSMnEjTdpyln+i8tyD3CbqB6ATQj7K2wpstAANnTA3RBTHrEG 0WTSN2kkFz2cO3JKg8zrGWUJtjvcpvbU46pYJcn6fpkm3zh7jfQ9IsZOmPt9BTHhHc9j 8zozFXz2qbVa52jrZsrG60juWyNPzMQrLcZf+KhIgjkfKLx52LetLCtYscSww+p+9roa 11K9HbH16ulr58FEHK8z837sPUlN3M+4wQ5nTBlC9vQ6lYIwQEamUUWDUpFXCe4D1x1R cFFA== X-Gm-Message-State: AO0yUKU79YjSc4ZKC3QBNvWSYsbbfJC7clMHt0zYwC4OsTaHDB7UlQUd WwVTTSIrGocj6GUeEBePOBfxLuqufA53N8SpVvIeNDuYjx3PQHesBnX07ilh98zWcbuTvv48DMg TjprumI/at/nG+mKW2vYJKmk= X-Received: by 2002:a63:af44:0:b0:4ad:30aa:8e6a with SMTP id s4-20020a63af44000000b004ad30aa8e6amr3081520pgo.40.1676026897539; Fri, 10 Feb 2023 03:01:37 -0800 (PST) X-Google-Smtp-Source: AK7set9Nj1fRo0cnB0cdAbdcjCnOPCZ5CV/443QJFP40ukLi4xrde2ji5y6uGkrdHvNDaUPWTJ1Kxr9Td8jWl4sP2SQ= X-Received: by 2002:a63:af44:0:b0:4ad:30aa:8e6a with SMTP id s4-20020a63af44000000b004ad30aa8e6amr3081511pgo.40.1676026897119; Fri, 10 Feb 2023 03:01:37 -0800 (PST) MIME-Version: 1.0 References: <20230103185732.2007210-1-ashish.sadanandan@gmail.com> <20230109015239.3956876-1-ashish.sadanandan@gmail.com> In-Reply-To: <20230109015239.3956876-1-ashish.sadanandan@gmail.com> From: David Marchand Date: Fri, 10 Feb 2023 12:01:25 +0100 Message-ID: Subject: Re: [PATCH v4 1/1] eal/linux: reject mountpt not parent of --huge-dir To: Ashish Sadanandan Cc: dev@dpdk.org, john.levon@nutanix.com, stable@dpdk.org, "Meunier, Julien (Nokia - FR/Paris-Saclay)" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Mon, Jan 9, 2023 at 2:52 AM Ashish Sadanandan wrote: > > The code added for allowing --huge-dir to specify hugetlbfs > sub-directories has a bug where it incorrectly matches mounts that > contain a prefix of the specified --huge-dir. > > Consider --huge-dir=/dev/hugepages1G is passed to rte_eal_init. Given > the following hugetlbfs mounts > > $ mount | grep hugetlbfs > hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M) > hugetlbfs on /dev/hugepages1G type hugetlbfs (rw,relatime,pagesize=1024M) > hugetlbfs on /mnt/huge type hugetlbfs (rw,relatime,pagesize=2M) > > get_hugepage_dir is first called with hugepage_sz=2097152. While > iterating over all mount points, /dev/hugepages is incorrectly > determined to be a match because it's a prefix of --huge-dir. The caller > then obtains an exclusive lock on --huge-dir. > > In the next call to get_hugepage_dir, hugepage_sz=1073741824. This call > correctly determines /dev/hugepages1G is a match. The caller again > attempts to obtain an exclusive lock on --huge-dir and deadlocks because > it's already holding a lock. > > This has been corrected by ensuring any matched mount point is either an > exact match or a parent path of --huge-dir. > > Fixes: 24d5a1ce6b85 ("eal/linux: allow hugetlbfs sub-directories") > Cc: stable@dpdk.org > Signed-off-by: Ashish Sadanandan Reviewed-by: John Levon I got pinged by Julien who reported a similar issue. He confirmed later that this fix works for him too. Tested-by: Julien Meunier Applied, thanks Ashish. -- David Marchand