From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 10F6A3858D28 for ; Fri, 16 Feb 2024 07:44:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 10F6A3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 10F6A3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708069481; cv=none; b=yCBM+V5+OxhSTIDy5XF91xYzq2sc/14YzCneK7XRh33H36Q4gEU2h7hmHweoho7cTzoPKT4CEvKIIXgoTky4WGqkYebDZRgx33/YX7uABop+VIolswlFCMcv5m6Z+zKafxGPw20R0tiyWJ86cN89MfOFjZZXDcqYGJ5lIPTmXu8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708069481; c=relaxed/simple; bh=QEjtzD/C3k2hvsBFvvUPkYI+JAQoIPFfwkFjbizLO/A=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=i884yRXrbWZ68nWSeWMXRGDniITyci7kBiPojNgYYJWVkOdrCh46V3kK9dw5A1eEe42OA41KXpIcT6qtRjacsGxddpDqikwOXwglKNxX0i1hAlPciCfTotMYJM2VfC0Z/17j2AoBkMHyAOHXe/FrEXB4QtRRX13sQpxwvsnviqM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708069479; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=veo9r3LKKeBFcoLnlqS9u3neGNiH8b1b1qlbZJvhrF0=; b=G2rN8/3WSPW08XBBIaI5XVrSLpX990RsXIJwIItzb95bPFmmLf3wJA/FqHqtk+O8Tl5s20 IZq8D1CyyenlhqN/g0bhETDThhXSMpZlRvgtyIA4Lv7rKGchpHbCtbT6kDcug29XYQaEAY KeMC15eoEfYJ0Y7DabUGjxqh3qDhybs= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-442-3cZH7krPML28njMGvpbxnQ-1; Fri, 16 Feb 2024 02:44:35 -0500 X-MC-Unique: 3cZH7krPML28njMGvpbxnQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 759B21C04187; Fri, 16 Feb 2024 07:44:35 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.50]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22A2B20110C4; Fri, 16 Feb 2024 07:44:33 +0000 (UTC) From: Florian Weimer To: Evan Green Cc: libc-alpha@sourceware.org, vineetg@rivosinc.com, slewis@rivosinc.com, palmer@rivosinc.com Subject: Re: [PATCH v12 2/7] linux: Introduce INTERNAL_VSYSCALL References: <20240214143159.2951158-1-evan@rivosinc.com> <20240214143159.2951158-3-evan@rivosinc.com> Date: Fri, 16 Feb 2024 08:44:32 +0100 In-Reply-To: <20240214143159.2951158-3-evan@rivosinc.com> (Evan Green's message of "Wed, 14 Feb 2024 06:31:53 -0800") Message-ID: <877cj47t0f.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Evan Green: > Add an INTERNAL_VSYSCALL() macro that makes a vDSO call, falling back to > a regular syscall, but without setting errno. Instead, the return value > is plumbed straight out of the macro. > > Signed-off-by: Evan Green > --- > > (no changes since v10) > > Changes in v10: > - Introduced INTERNAL_VSYSCALL patch > > sysdeps/unix/sysv/linux/sysdep-vdso.h | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/sysdeps/unix/sysv/linux/sysdep-vdso.h b/sysdeps/unix/sysv/linux/sysdep-vdso.h > index 189319ad98..f7d4b29b25 100644 > --- a/sysdeps/unix/sysv/linux/sysdep-vdso.h > +++ b/sysdeps/unix/sysv/linux/sysdep-vdso.h > @@ -53,4 +53,23 @@ > sc_ret; \ > }) > > +#define INTERNAL_VSYSCALL(name, nr, args...) \ > + ({ \ > + __label__ out; \ > + long int sc_ret; \ > + \ > + __typeof (GLRO(dl_vdso_##name)) vdsop = GLRO(dl_vdso_##name); \ > + if (vdsop != NULL) \ > + { \ > + sc_ret = INTERNAL_VSYSCALL_CALL (vdsop, nr, ##args); \ > + if ((!INTERNAL_SYSCALL_ERROR_P (sc_ret)) || \ > + (INTERNAL_SYSCALL_ERRNO (sc_ret) != ENOSYS)) \ > + goto out; \ > + } \ > + \ > + sc_ret = INTERNAL_SYSCALL_CALL (name, ##args); \ > + out: \ > + sc_ret; \ > + }) > + > #endif /* SYSDEP_VDSO_LINUX_H */ I wonder if this is clearer without the label and with a conditional expression instead? Thanks, Florian