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 EF5D1423AC; Wed, 11 Jan 2023 13:11:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 964BA40691; Wed, 11 Jan 2023 13:11:15 +0100 (CET) Received: from mx0a-002c1b01.pphosted.com (mx0a-002c1b01.pphosted.com [148.163.151.68]) by mails.dpdk.org (Postfix) with ESMTP id AC2294014F; Wed, 11 Jan 2023 13:11:13 +0100 (CET) Received: from pps.filterd (m0127837.ppops.net [127.0.0.1]) by mx0a-002c1b01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30B8isPL001364; Wed, 11 Jan 2023 04:11:12 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; h=date : from : to : cc : subject : message-id : references : content-type : in-reply-to : mime-version; s=proofpoint20171006; bh=owp3WIUeZeEd1XBfEXJfpmbtO7s0MyunTMFY0vaZ+js=; b=s0SWVPKz+T3UPnCMETlK6xi4ildTt2gJGS9K8gQUsRo84z92dtq/zx+yT0Tky4BxoDcD p9KYi68byfYyDBDv9hnzD3SfEJl2QseV7dyUPxXszq2+h+Pp8d+h4wkHZJbn597NNMwH 7u2wJBJACf9Hl2OCxwexbvlYxt5mHwxncd0FryMyA84i0TVQHpAIEPJKWfEB4KV8BCHL uIb7cWZG4GZV0MhglzU45xOrPafVtqY8e8bOK1p8EunPp3bbQxPRDLwB10eFZLf88i9F paGaJjunfPrvPxqd6qyBJo9AX00r9RiVRVrcdvit1rDa0OP3ppVI21qoJeraifUxhs7T BA== Received: from nam02-bn1-obe.outbound.protection.outlook.com (mail-bn1nam02lp2044.outbound.protection.outlook.com [104.47.51.44]) by mx0a-002c1b01.pphosted.com (PPS) with ESMTPS id 3n1kjk190c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Jan 2023 04:11:12 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=je6ef2Yj9wd6U39drUWyjvk60YVEXyWwbf1G1C4hpgtW8Gpw+/7M/HHb2oFeNX8O3j1pv8phJICiL6RkGdG15hzaJwd77/9WSeHkZpwTtF+5dIeLgoPAnN+520X3VrNKS1j46SpmOCdXravFGDWejrQO5QN0pbPBJZex58RpVQdZbdsZShWWVykHu8pAsdv5ezmYeJrYzWbj+R6wp36KGc/yHsNNZFEuywKd1Jz2Gx78Z+jkkGUIY3/TSqI0NvNPYDc8qes2zcXdY0llbb6tkydkeSB3Drgjeif/Z1bMPAWklO9DBOvcVM75u4AEsf17wGBUEStOuV66hGg7asSjrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=owp3WIUeZeEd1XBfEXJfpmbtO7s0MyunTMFY0vaZ+js=; b=OQzhQk2AtTpoxLFm5FBLFV/q5atYONNRVMHfxhnP2XNsTHeFlAb8cQ1QNX189Ttp6pcDjG2Ih/6LOkQtSzYxpP4jS2+I/lpJZ9k2kvNINoct5kWTDdtVGokTsW8iT3rlOiSHkxaw65zNzjohkO6478qytwIP7J6BofOSi+gqMC3mzpD1bgj2SdDtGb0eTt6wM9mRsecjjnLZSjCPChJ/FedBut1Xsfo0wuqskZ8NfPRQ+RVgkY/2aVq2HKvQJ43GoGtCXAEpMW+Q6BDgtrNgKdO5SYTM8QGvE2Wr2cQbH8bVHpezcMPLO3it0V8CXeOnYiFaGTCi8anN1VwIfMjlIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nutanix.com; dmarc=pass action=none header.from=nutanix.com; dkim=pass header.d=nutanix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nutanix.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=owp3WIUeZeEd1XBfEXJfpmbtO7s0MyunTMFY0vaZ+js=; b=eVzz3P3Nx0pvEzCAHwrzA8joEPO4ZAc4vSh9DYm9A7Skme5uaz1rSbLgF0FHIlt4UVw2/ZmL7kfbeWz9P4Ea34toiKBnRjIj2yWbfHwcJEZdvC7BjS9cKNMUvk3cSm4J/AQn8KMZd+0GM1Mo48I3ASlluvNsPRVkq3qLDv4vuOcRmTd2zehegMTrFayztUrVCZ3TFMDzStgfylyZH9BgumvM8NihCHpc+D8kEPySNUsvNEQw/VBV3ClfJ3vK0ESvBKdYGymuLZIn06Hw5gLAOIP9tCf6Ffx5cqUfCPigOeQ7OZxwFti8RTrREOE3UR+xp2Iu6/oL1v6prFTudcOMPQ== Received: from BY5PR02MB6115.namprd02.prod.outlook.com (2603:10b6:a03:1b2::26) by SJ0PR02MB7438.namprd02.prod.outlook.com (2603:10b6:a03:294::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Wed, 11 Jan 2023 12:11:10 +0000 Received: from BY5PR02MB6115.namprd02.prod.outlook.com ([fe80::f49e:9fd9:136e:9b42]) by BY5PR02MB6115.namprd02.prod.outlook.com ([fe80::f49e:9fd9:136e:9b42%3]) with mapi id 15.20.5986.018; Wed, 11 Jan 2023 12:11:10 +0000 Date: Wed, 11 Jan 2023 12:11:05 +0000 From: John Levon To: Ashish Sadanandan Cc: dev@dpdk.org, stable@dpdk.org Subject: Re: [PATCH v4 1/1] eal/linux: reject mountpt not parent of --huge-dir Message-ID: References: <20230103185732.2007210-1-ashish.sadanandan@gmail.com> <20230109015239.3956876-1-ashish.sadanandan@gmail.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230109015239.3956876-1-ashish.sadanandan@gmail.com> X-Url: http://www.movementarian.org/ X-ClientProxiedBy: LO4P123CA0156.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:188::17) To BY5PR02MB6115.namprd02.prod.outlook.com (2603:10b6:a03:1b2::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY5PR02MB6115:EE_|SJ0PR02MB7438:EE_ X-MS-Office365-Filtering-Correlation-Id: fd850983-cac9-477a-d9b8-08daf3ccecfe x-proofpoint-crosstenant: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5htzJe2ug4zAuMSh53+4rSsyvIIIB5OSXu5yrzj7J/kR6NRs1azU6ypNZHZOCNPBS0i7bu5Bp4CqV/FDb4V51S67imDWVxXbUWKTSUI26MT4GaNkVRixm31tohgA8AY/3AqCnDjhr+uJTFZRz7jvh4bm1NYrStO84UWkasyJNv+US8Z3bnFLH9Z7ngxDDBEEESakasiS1t5Xzt4jd+RbmcTsyPfCnT7y7JjhxuQbE/imXcawWbPmphJR2fAJkmQJ6sH6yqm8PSwfTNdVoOV54chCYn/FOxddzk6I2WrEeF3/bQi8MM4HkBhiTflf+ONGx7ZjO3W6oSp7gnN/glTErj6o41xaRf4M/PVueaJnXNUOhoLH5gOYxxmDubUokDg5nHKkUCh0mr4in08Js+fM9eN07WUKjSV6LBjyM280ltmL7jAWFrkTjwQn4Q69+Z+JeYgE7F8BTKln+BAUh6VTftepcbFJKrsa/kAzwwIl0dN6KI/w4bea8yOx1dWrHz5imxwCKM6rTOIYzCaAhLKGRiJP9DOyu4Ll0M3IhcAVxWc7I4VVhDlMU5PTXybVMDOzDwT76auxZzJUFrbTpIX6KC/Y+424FOSG9H57i5b3mfrcJOplAJARzhNUoAh8oNdOm5+GGo8VBzHOVf6UMM5N7OJwFuXC6v1F3TLd2dbKxriqhPGs/iidgx13J4INJnZs X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR02MB6115.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(346002)(376002)(366004)(396003)(39860400002)(451199015)(66946007)(4326008)(41300700001)(316002)(8676002)(6916009)(66556008)(66476007)(36756003)(86362001)(83380400001)(8936002)(38100700002)(5660300002)(44832011)(6486002)(2906002)(6506007)(6512007)(478600001)(186003)(26005)(9686003)(6666004)(14583001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xj8ZcY1EUbmPYVJEP51e5tgQ0CN1rpcvEx5TjbJ+Iu+hr+ODE2WsDlGZQeF1?= =?us-ascii?Q?IfjbSRRx99dl7s1Hg9JJpgDy4uIm1GlUHfNT+rUIux6niQ5YgwbG8N1EGWTx?= =?us-ascii?Q?yZgwvj2gECi0wSxYXVDJojCOjiNBdx7bUTb7emlm52fVShyGVOSSOWoXHqpW?= =?us-ascii?Q?QXgqnHAOf+O2c3Uvj6cUZAzZ8QvC1L4bbJldfI+nQJ0Bi1QZOk+duOI+u6dl?= =?us-ascii?Q?6bQ6xGaoNU7gr4i26QGOrk5UXmwceMuY2RalUVkXwHtAYfL3m/5gSPl+Ff37?= =?us-ascii?Q?5ogfbLNMfc4kzYeM7Wv3o3GstKc8A4HdK3UgNODSS1pTaRpGzdqZs71MLtBb?= =?us-ascii?Q?cAFRMoBlagiGnYQLBYgYpp7Ls6PjTbmK8mAZO5Wn4Z60E/55wjFxQCeLJ3BE?= =?us-ascii?Q?ZLSaDQLDUvnu7QMhwrDBNXcLD+juQifLqKYMI8rFLaxYzgxxsZRd5MtBrNZQ?= =?us-ascii?Q?1b31hXX1VC4AYMOhzpkjKM5FfOIc7faaXaPHC9vNra0RYJaUHghIykZrReZK?= =?us-ascii?Q?qwqFmH8324G25NoiHI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?pjKKprp4Y8XOwqoIKsHu3O/ccNSRJncEcS4CspbPiiPSvVoy/f5lFlI9wZ9l?= =?us-ascii?Q?FyC1crt2g4//6xn8b4g9SU5RI9lC0DcaOJiVJMa9z+DD2HKPKmw3FcwMDFpj?= =?us-ascii?Q?qqlzZmfI7xkM/HDV9vH7zAjmQTIZhTkMQCezMvsV?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd850983-cac9-477a-d9b8-08daf3ccecfe X-MS-Exchange-CrossTenant-AuthSource: BY5PR02MB6115.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2023 12:11:10.3536 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RLS1gqDknCvOsVtCiB2J6bRX+WnA9yhr3nE+/NCn69/MqvqGupmWNb3JGFa6gUZEeCYB58F9i2LNbzUbsTztzA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR02MB7438 X-Proofpoint-GUID: -cV3WD9tB-egGRQ7VQtSfXzo7wsZ-PJb X-Proofpoint-ORIG-GUID: -cV3WD9tB-egGRQ7VQtSfXzo7wsZ-PJb X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-11_05,2023-01-11_01,2022-06-22_01 X-Proofpoint-Spam-Reason: safe 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 Sun, Jan 08, 2023 at 06:52:39PM -0700, 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: john.levon@nutanix.com > Cc: stable@dpdk.org > Signed-off-by: Ashish Sadanandan Reviewed-by: John Levon thanks john