Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3098689rwl; Tue, 27 Dec 2022 04:27:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXtwaSpkN6FzfZzUQDFesfVJzTfJ3/LFlMQ0TdvWALUAZnT2W+PSZs5qPe8aFziv5HZKLko8 X-Received: by 2002:a17:906:7046:b0:7ae:8194:7e06 with SMTP id r6-20020a170906704600b007ae81947e06mr18906599ejj.56.1672144034506; Tue, 27 Dec 2022 04:27:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672144034; cv=none; d=google.com; s=arc-20160816; b=mDx2FkakpO35TGe2A+A3pmgAI/fXl3Udp7RFHcYENSERN8wQJkEkBJ/jQxSoOFxKC9 ArAhnjQQyqpkXbI25ZMfbB9xok2BsiFKcS0PgrcLB215ccVC8oHoqL89zx9gkxmwzT3P 1A+QlvICt2xjKM5e8bixLMWUiyYcGUqXBZMWqszBw1aeVjnBvxvcLms2y3jQjZaAEX5i DD0Akc6p/CC8NnLhyeyQgulFS0XmJWg9DqAwEQ+ldPZzteEZ8czC9O047+MmGoVwPAEi apNypQgh9WzfiLHp3QFsOOCTratAfZndP3fhVF/m0b+lauWSn55g0nIPX5YNdKbixeUy 53JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=hulIJpjMgo6pOe8FjgQRymuJwZUMCCYKSFHvu1/1r9s=; b=N4g2KhJM4xpsJhYZ5y/2HQgYMzBvujIPnTJtQlZEYA9fyWgnrznxt65AGecqatAK5a /vYWqpM7LgB+SOZbxjEv6gg6MKFoJImT395MB0gnMnZiQN8BxljS6EBwIy9Gk/9C31jG Dft4bIskiIh4ZK6Ct6xRiZYkG1GEixQj2sD/jpYAWynZUqfcrL8gnVtk51Nzg/Dgh6mg 6wymN8yQd34sjPUByNM4VvQNSaudRoP2KC+SOO76AzSyrL3W3N+/MqmQ+QflK4VHd47S hOASqZooheWZ6vKPTKhoQlVjXP26dB45+D7sy7tvoDO57d7noOPGQl+8X/oTbMFiWXRm RlxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WJyri35S; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=xoRZfHCS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he7-20020a1709073d8700b007da4fe085d4si12141135ejc.694.2022.12.27.04.26.59; Tue, 27 Dec 2022 04:27:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WJyri35S; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=xoRZfHCS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231305AbiL0MQn (ORCPT + 66 others); Tue, 27 Dec 2022 07:16:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231718AbiL0MOn (ORCPT ); Tue, 27 Dec 2022 07:14:43 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 365F563FF; Tue, 27 Dec 2022 04:13:56 -0800 (PST) Date: Tue, 27 Dec 2022 12:13:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1672143233; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hulIJpjMgo6pOe8FjgQRymuJwZUMCCYKSFHvu1/1r9s=; b=WJyri35SpY+6VrrUTSEbHH0xkbOZuOfXy8Kjw8BHu+XBiKcR1QePxGMRvBLeshfLkrvDVF s6Jn3lKXF6s/Bnus2PBXylzlI7Oot8S2GDFN8eRjP69q/yKMtbMQmPIQAKlq4sGk6wkGfI uonIOND3YW/UAiXPmgMFY7qCcKwUmw5C0CfY/1XogBK8F7BwJ5992tYQYRaMGK19vM8W1T My4HogM6o+ViKvDgjBE6bH1DBiDOGOoFADWDnAODBxS6F0kB4l8sWIM9ofFACGd8bIJVSy Flvsk9sVMoaUBmbmcOL9eeC2rc4ZfuEu7630DEfdpREEfVbFlONv1dTOy56eqA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1672143233; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hulIJpjMgo6pOe8FjgQRymuJwZUMCCYKSFHvu1/1r9s=; b=xoRZfHCSJyKy5ctgOrpsNzDVqqCbIVMkX5AsRuGZS6avlsyFda3HkJI6K6voa2x3kkxYc3 PZRrcDye5Tf5aWBA== From: "tip-bot2 for Mathieu Desnoyers" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] selftests/rseq: Fix: Fail thread registration when CONFIG_RSEQ=n Cc: Mathieu Desnoyers , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221122203932.231377-2-mathieu.desnoyers@efficios.com> References: <20221122203932.231377-2-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Message-ID: <167214323279.4906.12457162726827402464.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 4842dadfc66f627083ec46c4e9a426e805c765f3 Gitweb: https://git.kernel.org/tip/4842dadfc66f627083ec46c4e9a426e805c765f3 Author: Mathieu Desnoyers AuthorDate: Tue, 22 Nov 2022 15:39:03 -05:00 Committer: Peter Zijlstra CommitterDate: Tue, 27 Dec 2022 12:52:10 +01:00 selftests/rseq: Fix: Fail thread registration when CONFIG_RSEQ=n When linking the selftests against a libc which does not handle rseq registration (before 2.35), rseq thread registration silently succeed even with CONFIG_RSEQ=n because it erroneously thinks that libc is handling rseq registration. This is caused by setting the rseq ownership flag only after the rseq_available() check. It should rather be set before the rseq_available() check. Set the rseq_size to 0 (error value) immediately after the rseq_available() check fails rather than in the thread registration functions. Signed-off-by: Mathieu Desnoyers Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20221122203932.231377-2-mathieu.desnoyers@efficios.com --- tools/testing/selftests/rseq/rseq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/rseq/rseq.c b/tools/testing/selftests/rseq/rseq.c index 4177f95..376a73f 100644 --- a/tools/testing/selftests/rseq/rseq.c +++ b/tools/testing/selftests/rseq/rseq.c @@ -119,9 +119,11 @@ void rseq_init(void) rseq_flags = *libc_rseq_flags_p; return; } - if (!rseq_available()) - return; rseq_ownership = 1; + if (!rseq_available()) { + rseq_size = 0; + return; + } rseq_offset = (void *)&__rseq_abi - rseq_thread_pointer(); rseq_size = sizeof(struct rseq_abi); rseq_flags = 0;