From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
"Paul E . McKenney" <paulmck@linux.ibm.com>,
Boqun Feng <boqun.feng@gmail.com>,
"H . Peter Anvin" <hpa@zytor.com>, Paul Turner <pjt@google.com>,
linux-api@vger.kernel.org,
Christian Brauner <christian.brauner@ubuntu.com>,
Florian Weimer <fw@deneb.enyo.de>,
carlos@redhat.com,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: [RFC PATCH 1/4] selftests: rseq: Use fixed value as rseq_len parameter
Date: Mon, 13 Jul 2020 23:03:45 -0400 [thread overview]
Message-ID: <20200714030348.6214-2-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <20200714030348.6214-1-mathieu.desnoyers@efficios.com>
The rseq registration and unregistration expect a fixed-size length
(32 bytes). In preparation to extend struct rseq, pass a fixed value
rather than the size of the rseq structure.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
include/uapi/linux/rseq.h | 5 +++++
tools/testing/selftests/rseq/rseq.c | 5 ++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/uapi/linux/rseq.h b/include/uapi/linux/rseq.h
index 9a402fdb60e9..e11d9df5e564 100644
--- a/include/uapi/linux/rseq.h
+++ b/include/uapi/linux/rseq.h
@@ -37,6 +37,11 @@ enum rseq_cs_flags {
(1U << RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE_BIT),
};
+/* The rseq_len expected by rseq registration is always 32 bytes. */
+enum rseq_len_expected {
+ RSEQ_LEN_EXPECTED = 32,
+};
+
/*
* struct rseq_cs is aligned on 4 * 8 bytes to ensure it is always
* contained within a single cache-line. It is usually declared as
diff --git a/tools/testing/selftests/rseq/rseq.c b/tools/testing/selftests/rseq/rseq.c
index 7159eb777fd3..da2264c679b9 100644
--- a/tools/testing/selftests/rseq/rseq.c
+++ b/tools/testing/selftests/rseq/rseq.c
@@ -87,7 +87,7 @@ int rseq_register_current_thread(void)
}
if (__rseq_refcount++)
goto end;
- rc = sys_rseq(&__rseq_abi, sizeof(struct rseq), 0, RSEQ_SIG);
+ rc = sys_rseq(&__rseq_abi, RSEQ_LEN_EXPECTED, 0, RSEQ_SIG);
if (!rc) {
assert(rseq_current_cpu_raw() >= 0);
goto end;
@@ -115,8 +115,7 @@ int rseq_unregister_current_thread(void)
}
if (--__rseq_refcount)
goto end;
- rc = sys_rseq(&__rseq_abi, sizeof(struct rseq),
- RSEQ_FLAG_UNREGISTER, RSEQ_SIG);
+ rc = sys_rseq(&__rseq_abi, RSEQ_LEN_EXPECTED, RSEQ_FLAG_UNREGISTER, RSEQ_SIG);
if (!rc)
goto end;
__rseq_refcount = 1;
--
2.17.1
next prev parent reply other threads:[~2020-07-14 3:03 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-14 3:03 [RFC PATCH 0/4] rseq: Introduce extensible struct rseq Mathieu Desnoyers
2020-07-14 3:03 ` Mathieu Desnoyers [this message]
2020-07-14 3:03 ` [RFC PATCH 2/4] rseq: Allow extending " Mathieu Desnoyers
2020-07-14 9:58 ` Florian Weimer
2020-07-14 12:50 ` Mathieu Desnoyers
2020-07-14 13:00 ` Florian Weimer
2020-07-14 13:19 ` Mathieu Desnoyers
2020-07-14 21:30 ` Carlos O'Donell
2020-07-15 13:12 ` Mathieu Desnoyers
2020-07-15 13:22 ` Florian Weimer
2020-07-15 13:31 ` Mathieu Desnoyers
2020-07-15 13:42 ` Florian Weimer
2020-07-15 13:55 ` Christian Brauner
2020-07-15 14:20 ` Mathieu Desnoyers
2020-07-15 14:54 ` Mathieu Desnoyers
2020-07-15 14:58 ` Florian Weimer
2020-07-15 15:26 ` Mathieu Desnoyers
2020-07-14 17:24 ` Peter Oskolkov
2020-07-14 17:43 ` Mathieu Desnoyers
2020-07-14 18:33 ` Peter Oskolkov
2020-07-15 2:34 ` Chris Kennelly
2020-07-15 6:31 ` Florian Weimer
2020-07-15 10:59 ` Christian Brauner
2020-07-15 14:38 ` Mathieu Desnoyers
2020-07-15 14:50 ` Mathieu Desnoyers
2020-07-15 11:38 ` Christian Brauner
2020-07-15 12:33 ` Christian Brauner
2020-07-15 15:10 ` Mathieu Desnoyers
2020-07-15 15:33 ` Christian Brauner
2020-07-14 3:03 ` [RFC PATCH 3/4] selftests: rseq: define __rseq_abi with extensible size Mathieu Desnoyers
2020-07-14 3:03 ` [RFC PATCH 4/4] selftests: rseq: print rseq extensible size in basic test Mathieu Desnoyers
2020-07-14 20:55 ` [RFC PATCH 0/4] rseq: Introduce extensible struct rseq Carlos O'Donell
2020-07-15 13:02 ` Mathieu Desnoyers
2020-07-16 13:39 ` Carlos O'Donell
2020-07-16 14:45 ` Mathieu Desnoyers
2020-07-15 15:12 ` Florian Weimer
2020-07-15 15:32 ` Mathieu Desnoyers
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=20200714030348.6214-2-mathieu.desnoyers@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=boqun.feng@gmail.com \
--cc=carlos@redhat.com \
--cc=christian.brauner@ubuntu.com \
--cc=fw@deneb.enyo.de \
--cc=hpa@zytor.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.ibm.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).