From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id B184480F25 for ; Mon, 2 Nov 2026 20:07:50 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6A2K6aBU028632; Mon, 2 Nov 2026 23:06:36 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6A2K6aBU028632 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="Ry6SY76o" Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6A2K6UZv028619 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 2 Nov 2026 23:06:31 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6A2K6UZv028619 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-48e6d6e780fso1576717f8f.2 for ; Mon, 02 Nov 2026 12:06:31 -0800 (PST) X-Gm-Message-State: APuU4Z9uyE6cYloHZIhnFKQKqEL+QBpERvOQesiga4tNzHZlN5Ol1Odn MXteDnJQ6EfCIptKU9c2zmZsWR+SKcvQyusk7ThdW3vfnvVkQ2V+QGRoARDt/nL8Ur+S5KZKRNu vOKsPl7qkIG/v5Rpfumsot/j00rxvl54YRRb9Yqi8ie+qAYX9hDu7MA== X-Gm-Gg: AYBFou3hEM1MCIKakxpghj/1zqN//Ze2uo9ma+KEIpaldauYOxzEog9xpRiEbGug3RN YmGz03tcvSSzDqZbSK0MVWA5B+pizLtpxoICwVtDt/V7jvldSMNdAj5QpTWOhcruc+/XRooDUhd CwoFVCdmZWDeRZAZ4Z1+n1sOx3yrA1hm1+K56XCCDO80piYH/qhy5CuVv1vWFPq5qR0nqJDUA+w AiusZIVDVnnocHjVd8rv8i0hTxstAPgOIVkIV74xNqBEihl3qN7LGw5/wbSSeuYqrClBejU4sej 56lQyUVma9yBi7hAE2mxmd1DI4kA7m+g7AxZ4voLzIfniVkTKqoGd7teWamDw3WZBTM/8Zj7rP8 7623hS6l9fcXWwCXu+jAxGPl3 X-Received: by 2002:a5d:5d09:0:b0:48e:76ab:7900 with SMTP id ffacd0b85a97d-48e76ab7eefmr17733067f8f.17.1793649985656; Mon, 02 Nov 2026 12:06:25 -0800 (PST) X-Received: by 2002:a5d:5d09:0:b0:48e:76ab:7900 with SMTP id ffacd0b85a97d-48e76ab7eefmr17733011f8f.17.1793649985132; Mon, 02 Nov 2026 12:06:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1793649985; cv=none; d=google.com; s=arc-20260327; b=SLqzP7lwATJWqio8+hrZ/QaOG36zux//f+M54w/0wvziqj7u1ujFNnvmNkwj7jupGH K3foppmi2yvxiq5moswuFDBfgU0+nRDEmc6fMjGdC08bitP8JVmCewe4T2hsuz3OqFLh t/n1D8CGSq6QwMHB3hE02yFTnMVwzZQY9l6JzlAdmHyWDpHERxWU8Y9F9x9NIsVn8FOu jVSRLRmVKZPRE8d5o97qD1kRfpsQKGAaLP4d7uY+rJ+y8O2ubk1OY/piSzJRCgiMuT7M /oEXvQD7NaiX0UHc0tYeEDIInJZnsfYLobUil5647jENc0XNVcRDXl1OWprqLjrv7ucs nWow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=+Yf1UdIJlEhxpjWShXWXuJUr58vEH3vh6Mpkc9jJyKQ=; fh=WpT6aB7RBAGHZeWZzqAr71yzRFbPTYkPWKsRagLn48Q=; b=DYFwEHTO5jsPlSOz1vxzxlKBxQcrcKODcvgMY5thF2UudaDetJQgfbQPZq46H4Q0ZM pBTzhEC4NsUu41xSZ3khgQ+qIJ2DMVqKEA61Yl+32Xk6mfa17eejZOc4ET62CnRSJIWk umItBRYJJLZxSJdXj4jYtvTuBbRs07yXZbvs+4w7BbEbd+fbF8am04jdcAi0EPRDLSQr nt2sb1BPU1v4HMCgg8BfFa7mWKzRAElHOB2Lbw2Hw+Xfi5GaiVm6YJZo79vvR5XFS0x9 6liqUGQZK43Gk9tQDNNwntW0LvbkIAEMBKJSVn2RTTRXozYgKRPo03sOou1nnqITpCdu tYXg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=Ry6SY76o; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-48e71ba485bsi21391078f8f.119.2026.11.02.12.06.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2026 12:06:25 -0800 (PST) Received-SPF: pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=Ry6SY76o; spf=pass (google.com: domain of eva.kurchatova@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=eva.kurchatova@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=+Yf1UdIJlEhxpjWShXWXuJUr58vEH3vh6Mpkc9jJyKQ=; b=Ry6SY76oiYds OgmE6eeAVYkGdnSqRPLvAzWPPANcBoy4ysLyE58BlMM1tuHmV+vvivHtLAkCLzL/s09lcb4uYV5iT rqTvgmJkqK+6j83o+aSLHs2SzAA0a5pAa29rXIjjFntcs3d8tHhIu4mmhkcc4DZR/bPxuoj7jy19s L+Sq3iX1ALepepQBUXITNUDSrkuJ3WAfNcSDoU8NKdW4fUGW1MJyM58wtSxYwEiKLoTQRL7dn5mvA g3dVij4z1FhykeIAs/vCFinT9Xa/MuoNUMIh6gPSDWp9UA39nrM0C0jfqEYkCkq1SYN+v5ZGiJoop cLQ64xEeLddZ2OO2boaeZg==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=LekKit-T14) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xNyEY-00552l-20; Mon, 02 Nov 2026 21:06:16 +0100 From: Eva Kurchatova To: khorenko@virtuozzo.com Date: Mon, 2 Nov 2026 22:04:38 +0200 Message-ID: <20261102200610.2414832-3-eva.kurchatova@virtuozzo.com> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261102200610.2414832-1-eva.kurchatova@virtuozzo.com> References: <20261102200610.2414832-1-eva.kurchatova@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 2/2] ms/selftests/futex: Correct validation logic in waitv X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org From: Wake Liu In futex_waitv negative tests (invalid_flag, unaligned_address, etc.), test results are evaluated as: if (res == EINVAL) Since sys_futex_waitv returns -1 on error and sets errno, direct positive comparisons against res are always false, causing tests to silently pass regardless of real errors. Correct these validations to assert EXPECT_EQ(res, -1) and compare errno directly against expected constants. [ tglx: Fixup coding style ] Signed-off-by: Wake Liu Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260526010635.23980-3-wakel@google.com (cherry picked from commit a894f6f403320c65b26816be00d9b694e606cae1) Rebase note: mainline moved futex_waitv.c to kselftest_harness in commit a91e8e372e4f ("selftests/futex: Refactor futex_waitv with kselftest_harness.h"), which this tree lacks, so the checks keep the ksft_test_result_*() form: a result other than -1 or an errno other than the expected one fails the subtest. The NULL waitv.uaddr check expects EFAULT: here it runs on an otherwise valid waitv[], and a NULL futex address is answered with EFAULT; in mainline it gets EINVAL only from the zeroed flags of the other entries. https://virtuozzo.atlassian.net/browse/VSTOR-152660 Feature: fix selftests Signed-off-by: Eva Kurchatova --- .../selftests/futex/functional/futex_waitv.c | 55 ++++++++++++------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/tools/testing/selftests/futex/functional/futex_waitv.c b/tools/testing/selftests/futex/functional/futex_waitv.c index 98edb25690d9..f58f3fa8f0e0 100644 --- a/tools/testing/selftests/futex/functional/futex_waitv.c +++ b/tools/testing/selftests/futex/functional/futex_waitv.c @@ -184,10 +184,13 @@ int main(int argc, char *argv[]) to.tv_sec++; res = futex_waitv(waitv, NR_FUTEXES, 0, &to, CLOCK_MONOTONIC); - if (res == EINVAL) { - ksft_test_result_fail("futex_waitv private returned: %d %s\n", - res ? errno : res, - res ? strerror(errno) : ""); + if (res != -1) { + ksft_test_result_fail("futex_waitv without FUTEX_32: unexpected result: %d\n", + res); + ret = RET_FAIL; + } else if (errno != EINVAL) { + ksft_test_result_fail("futex_waitv without FUTEX_32: unexpected errno: %d\n", + errno); ret = RET_FAIL; } else { ksft_test_result_pass("futex_waitv without FUTEX_32\n"); @@ -203,10 +206,13 @@ int main(int argc, char *argv[]) to.tv_sec++; res = futex_waitv(waitv, NR_FUTEXES, 0, &to, CLOCK_MONOTONIC); - if (res == EINVAL) { - ksft_test_result_fail("futex_wake private returned: %d %s\n", - res ? errno : res, - res ? strerror(errno) : ""); + if (res != -1) { + ksft_test_result_fail("futex_waitv with an unaligned address: unexpected result: %d\n", + res); + ret = RET_FAIL; + } else if (errno != EINVAL) { + ksft_test_result_fail("futex_waitv with an unaligned address: unexpected errno: %d\n", + errno); ret = RET_FAIL; } else { ksft_test_result_pass("futex_waitv with an unaligned address\n"); @@ -221,10 +227,13 @@ int main(int argc, char *argv[]) to.tv_sec++; res = futex_waitv(waitv, NR_FUTEXES, 0, &to, CLOCK_MONOTONIC); - if (res == EINVAL) { - ksft_test_result_fail("futex_waitv private returned: %d %s\n", - res ? errno : res, - res ? strerror(errno) : ""); + if (res != -1) { + ksft_test_result_fail("futex_waitv NULL address in waitv.uaddr: unexpected result: %d\n", + res); + ret = RET_FAIL; + } else if (errno != EFAULT) { + ksft_test_result_fail("futex_waitv NULL address in waitv.uaddr: unexpected errno: %d\n", + errno); ret = RET_FAIL; } else { ksft_test_result_pass("futex_waitv NULL address in waitv.uaddr\n"); @@ -237,10 +246,13 @@ int main(int argc, char *argv[]) to.tv_sec++; res = futex_waitv(NULL, NR_FUTEXES, 0, &to, CLOCK_MONOTONIC); - if (res == EINVAL) { - ksft_test_result_fail("futex_waitv private returned: %d %s\n", - res ? errno : res, - res ? strerror(errno) : ""); + if (res != -1) { + ksft_test_result_fail("futex_waitv NULL address in *waiters: unexpected result: %d\n", + res); + ret = RET_FAIL; + } else if (errno != EINVAL) { + ksft_test_result_fail("futex_waitv NULL address in *waiters: unexpected errno: %d\n", + errno); ret = RET_FAIL; } else { ksft_test_result_pass("futex_waitv NULL address in *waiters\n"); @@ -255,10 +267,13 @@ int main(int argc, char *argv[]) to.tv_sec++; res = futex_waitv(waitv, NR_FUTEXES, 0, &to, CLOCK_TAI); - if (res == EINVAL) { - ksft_test_result_fail("futex_waitv private returned: %d %s\n", - res ? errno : res, - res ? strerror(errno) : ""); + if (res != -1) { + ksft_test_result_fail("futex_waitv invalid clockid: unexpected result: %d\n", + res); + ret = RET_FAIL; + } else if (errno != EINVAL) { + ksft_test_result_fail("futex_waitv invalid clockid: unexpected errno: %d\n", + errno); ret = RET_FAIL; } else { ksft_test_result_pass("futex_waitv invalid clockid\n"); -- 2.56.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel