public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Jeanson <mjeanson@efficios.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	Michael Jeanson <mjeanson@efficios.com>
Subject: [PATCH 3/3] selftests/rseq: check if libc rseq support is registered
Date: Tue, 14 Jun 2022 11:48:30 -0400	[thread overview]
Message-ID: <20220614154830.1367382-4-mjeanson@efficios.com> (raw)
In-Reply-To: <20220614154830.1367382-1-mjeanson@efficios.com>

When checking for libc rseq support in the library constructor, don't
only depend on the symbols presence, check that the registration was
completed.

This targets a scenario where the libc has rseq support but it is not
wired for the current architecture in 'bits/rseq.h', we want to fallback
to our internal registration mechanism.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
---
 tools/testing/selftests/rseq/rseq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rseq/rseq.c b/tools/testing/selftests/rseq/rseq.c
index 986b9458efb2..4177f9507bbe 100644
--- a/tools/testing/selftests/rseq/rseq.c
+++ b/tools/testing/selftests/rseq/rseq.c
@@ -111,7 +111,8 @@ void rseq_init(void)
 	libc_rseq_offset_p = dlsym(RTLD_NEXT, "__rseq_offset");
 	libc_rseq_size_p = dlsym(RTLD_NEXT, "__rseq_size");
 	libc_rseq_flags_p = dlsym(RTLD_NEXT, "__rseq_flags");
-	if (libc_rseq_size_p && libc_rseq_offset_p && libc_rseq_flags_p) {
+	if (libc_rseq_size_p && libc_rseq_offset_p && libc_rseq_flags_p &&
+			*libc_rseq_size_p != 0) {
 		/* rseq registration owned by glibc */
 		rseq_offset = *libc_rseq_offset_p;
 		rseq_size = *libc_rseq_size_p;
-- 
2.34.1


  parent reply	other threads:[~2022-06-14 15:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 15:48 [PATCH 0/3] selftests/rseq: fixes for RISC-V and Glibc 2.35 Michael Jeanson
2022-06-14 15:48 ` [PATCH 1/3] selftests/rseq: riscv: use rseq_get_abi() helper Michael Jeanson
2022-06-28  7:16   ` [tip: sched/core] " tip-bot2 for Michael Jeanson
2022-06-14 15:48 ` [PATCH 2/3] selftests/rseq: riscv: fix 'literal-suffix' warning Michael Jeanson
2022-06-28  7:16   ` [tip: sched/core] " tip-bot2 for Michael Jeanson
2022-06-14 15:48 ` Michael Jeanson [this message]
2022-06-28  7:16   ` [tip: sched/core] selftests/rseq: check if libc rseq support is registered tip-bot2 for Michael Jeanson
2022-06-14 17:18 ` [PATCH 0/3] selftests/rseq: fixes for RISC-V and Glibc 2.35 Mathieu Desnoyers
2022-06-15 10:15   ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220614154830.1367382-4-mjeanson@efficios.com \
    --to=mjeanson@efficios.com \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox