From patchwork Mon Jul 13 19:34:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 1328421 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=Mp8nnIvv; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B5DPZ2R1sz9s1x for ; Tue, 14 Jul 2020 05:34:58 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EBC483851C29; Mon, 13 Jul 2020 19:34:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EBC483851C29 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1594668895; bh=gLzZGVGRyCToISG4FfXhaiM4zBna9al1S+EA/9nMDuw=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Mp8nnIvvHTauv0Hk5GpMdEhG9F0NCc6Ur3HvXMVsLpcOVoAnQ5TimcLMcucuuAcfP YK7f9Dby8tPqnczbeOAAqJL+1agdyjPa/mCTZR4i1ljlThsDCc9FNc+m1t/+kbtI9O 6WVO3OyX843vn5NJFk93eFWrJlWe9oMiEKOH/IiQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail.efficios.com (mail.efficios.com [167.114.26.124]) by sourceware.org (Postfix) with ESMTPS id CF5923858D37 for ; Mon, 13 Jul 2020 19:34:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CF5923858D37 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 79C212A5162; Mon, 13 Jul 2020 15:34:51 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id cRjZYDCY8lVu; Mon, 13 Jul 2020 15:34:51 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 4BB8B2A5049; Mon, 13 Jul 2020 15:34:51 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 4BB8B2A5049 X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 7Jzw3SUSKd5m; Mon, 13 Jul 2020 15:34:51 -0400 (EDT) Received: from localhost.localdomain (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) by mail.efficios.com (Postfix) with ESMTPSA id DEC632A4CA9; Mon, 13 Jul 2020 15:34:50 -0400 (EDT) To: Florian Weimer Subject: [RFC PATCH glibc] Linux: Use fixed rseq_len value for rseq registration Date: Mon, 13 Jul 2020 15:34:34 -0400 Message-Id: <20200713193434.30440-1-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-15.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Mathieu Desnoyers via Libc-alpha From: Mathieu Desnoyers Reply-To: Mathieu Desnoyers Cc: libc-alpha@sourceware.org, Joseph Myers , Mathieu Desnoyers Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The rseq registration system call expects a fixed-size argument of 32 for the rseq_len. We are currently discussing schemes to extend struct rseq beyond that size, and those involve using fields within struct rseq, without any changes to the rseq_len argument. Building a glibc with an updated, larger, struct rseq in the Linux kernel UAPI headers should not break registration. Therefore, use a fixed-size of 32 as rseq_len parameter. See struct rseq extension discussion: https://lore.kernel.org/lkml/1305865358.10354.1594665620975.JavaMail.zimbra@efficios.com/ --- sysdeps/unix/sysv/linux/rseq-internal.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h index 8f6772ca1d..3522668f3a 100644 --- a/sysdeps/unix/sysv/linux/rseq-internal.h +++ b/sysdeps/unix/sysv/linux/rseq-internal.h @@ -33,8 +33,9 @@ rseq_register_current_thread (void) if (__rseq_abi.cpu_id != RSEQ_CPU_ID_UNINITIALIZED) __libc_fatal ("glibc fatal error: " "rseq already initialized for this thread\n"); - ret = INTERNAL_SYSCALL_CALL (rseq, &__rseq_abi, sizeof (struct rseq), - 0, RSEQ_SIG); + /* The rseq_len parameter does not allow extending struct rseq. Fix its + value to 32 as expected by the Linux kernel. */ + ret = INTERNAL_SYSCALL_CALL (rseq, &__rseq_abi, 32, 0, RSEQ_SIG); if (INTERNAL_SYSCALL_ERROR_P (ret)) { const char *msg = NULL;