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 1124B41C5F; Fri, 10 Feb 2023 12:01:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F30FE42670; 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.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 3961D40687 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-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-374-mnMAFp50P2-MUj4dycX4VA-1; Fri, 10 Feb 2023 06:01:38 -0500 X-MC-Unique: mnMAFp50P2-MUj4dycX4VA-1 Received: by mail-pj1-f71.google.com with SMTP id pj9-20020a17090b4f4900b00232cca91108so2400705pjb.7 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=TfbCy+s0W67UPU68aNbkmukEY9SXk7Z6VOsFzWPGi13rENPQcH6qdEgEn7tgJDIteS El+a8d0wXlydcDPbsJDy7UTree9/j1JOCOOE3NqEeTtTDQjevYiT0r7rtgLu/KKtj6xm DFbooMdwcFbjt4WRQAlGaWvB8iJtmqMJBCOFpv7PNAk1xqeO4AeyloY830AM9S3af1xT trTWAl0nqtrB1TPVhlIouY/UU+XYRy36n3wDQmjpStlETKgjsrfQLaP2dI0PPVFQ8EmN yBJm5sEECxWTpoCr/W0+ErXUuaHMbzqCmCEkHmmt54nB66TP2DOAWFa0AVSJfetO/+NT 9fKQ== X-Gm-Message-State: AO0yUKVC1Jsq/yjpAvTZPWn+xYcxal5BusR4kKaQrw+Z7GZKIHrGcW9h F6oDx20W2tPhpUrfLOumXMady/KhnHn2Gwb+p3rcxGt3SBq7dGc2+EOCYdyJS+kvgPynloXuHHU 3H7rssoRlsyNKyUPtNAU= X-Received: by 2002:a63:af44:0:b0:4ad:30aa:8e6a with SMTP id s4-20020a63af44000000b004ad30aa8e6amr3081519pgo.40.1676026897538; 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: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-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