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 94C69A00BE; Tue, 7 Jul 2020 22:22:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7B2D91DB3E; Tue, 7 Jul 2020 22:22:14 +0200 (CEST) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) by dpdk.org (Postfix) with ESMTP id D9E531D9F5 for ; Tue, 7 Jul 2020 22:22:13 +0200 (CEST) Received: by mail-lj1-f180.google.com with SMTP id e8so17241317ljb.0 for ; Tue, 07 Jul 2020 13:22:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2ak4q8pBw/G1gKqY5Kk1myvZ5nTiaA6ixGJMTyoCHe0=; b=oFpjAjoT3fLfrV5O9URmtFVoc+vF8fv/7fFVQ3ODhkBZ8GExpnGeDO1gBDl//Rfym5 pT0RoKYGDGM9vgHG9IhZlhG5vqWlbeo2iowXIWFXWw7oyOC3ulopJXe7V73DPHxard+Y 7v3+ew1dDwaBaWrivVbwRWiJAtjpwSkv6xYAJYPFB03tmqggk6fycHB9SoBfRluGsPeW Qp5mIO67I7z4kqQNmKtN41tprFMOcMyTUBcUGrYi+Q7lMVjqjj3YxjePWM/Vavm4oxjX fMrdwLoapLy6hIlHB85wMRzPQap4off62G/ue83CfK3DFrssohKQGC1R86Bv9fA1trfC KjCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2ak4q8pBw/G1gKqY5Kk1myvZ5nTiaA6ixGJMTyoCHe0=; b=MijqqvYd6W49cBRoooXgevtgzqkoViBwl7ZgJUXTwbwPJPZUaWpyB+8Ub/u7HIvFrN pBSMG29kxuwkLdan/zrHfsk7dnO7kAqF7pCXJ1sXabflJymfgXCSIFwDMrfvh6A8EW7D QY87PFxjIGk8da+C9OBSq/6KdMux0pvIGhMLmcTRoE2IBBs9WT2yiYuXrX17jI9eN+5r Yq7Z6FJ85U+atTib5I9SOvwlEFc0fJtJMapm/KH6mSR5/l/+qqXp57d9vq/sTvbg3Ymv 1Hfynp8g5M09FxvdFAwUiMzc5S0WstFOaWq4dWsHbeSn55GqurdUf+teZMZ1oAqlBdlJ yi3g== X-Gm-Message-State: AOAM531aQgQkkhpps5zspnrVuxjLIxyVB66BeyOgiea059b5ZDw8j2x9 9zkZ2KSCyA4hcb0B50y84QCWIuDkygr03g== X-Google-Smtp-Source: ABdhPJx0zxobnwltLgINY9fE09GK6CAksZJ2qUke7tYG2lqivtHNX5Yy+XUN3r59HR7AKJlD8hGbEg== X-Received: by 2002:a2e:4612:: with SMTP id t18mr28819596lja.212.1594153333215; Tue, 07 Jul 2020 13:22:13 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id g7sm9764313lfe.62.2020.07.07.13.22.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2020 13:22:12 -0700 (PDT) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Narcisa Ana Maria Vasile , Ranjit Menon , Pallavi Kadam , Tal Shnaiderman , Dmitry Kozlyuk Date: Tue, 7 Jul 2020 23:22:03 +0300 Message-Id: <20200707202203.8780-1-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] eal/windows: detect insufficient privileges for hugepages 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" AdjustTokenPrivileges() succeeds even if no requested privileges have been granted; this behavior is documented. Check last error code in addition to return value to detect such case. Signed-off-by: Dmitry Kozlyuk --- lib/librte_eal/windows/eal_hugepages.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/librte_eal/windows/eal_hugepages.c b/lib/librte_eal/windows/eal_hugepages.c index 5779cd325..07a5467d0 100644 --- a/lib/librte_eal/windows/eal_hugepages.c +++ b/lib/librte_eal/windows/eal_hugepages.c @@ -41,6 +41,10 @@ hugepage_claim_privilege(void) goto exit; } + /* AdjustTokenPrivileges() may succeed with ERROR_NOT_ALL_ASSIGNED. */ + if (GetLastError() != ERROR_SUCCESS) + goto exit; + ret = 0; exit: -- 2.25.4