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 1CE2C3858D33 for ; Wed, 19 Apr 2023 15:48:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1CE2C3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681919294; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tvkEbAsLfwC7y8wEF3VdnzN0QkmoWxI4iNhQJZEBJcU=; b=g7N+UZtt74tT0ivplTKmpTZ4QwDkZLtX4YLNXpT706s75byo/CIS/y20bUQeZLQshAX4a1 VWybo3pqQdKgaBwkYlrbAJiKpAmAiGnGuy5WezgR2z6xprfBpH9/+ZQEpXASvGmVbV4sCo kmk1UjQ6SRbNjsL8YvdyEwd/G9Un8Ag= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-318-N2-6vpb0MLi2OYoz7NuL4Q-1; Wed, 19 Apr 2023 11:48:13 -0400 X-MC-Unique: N2-6vpb0MLi2OYoz7NuL4Q-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0C9C1380673B; Wed, 19 Apr 2023 15:48:13 +0000 (UTC) Received: from oak (unknown [10.22.34.175]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3135637A2; Wed, 19 Apr 2023 15:48:12 +0000 (UTC) Date: Wed, 19 Apr 2023 11:48:11 -0400 From: Joe Simmons-Talbott To: "H.J. Lu" Cc: libc-alpha@sourceware.org Subject: Re: [PATCH v5 1/3] x86_64: Set the syscall register right before doing the syscall. Message-ID: <20230419154811.GH2106608@oak> References: <20230411133004.2268170-1-josimmon@redhat.com> <20230419135821.4113156-1-josimmon@redhat.com> <20230419135821.4113156-2-josimmon@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.6 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_H2,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: On Wed, Apr 19, 2023 at 08:35:30AM -0700, H.J. Lu wrote: > On Wed, Apr 19, 2023 at 6:59 AM Joe Simmons-Talbott via Libc-alpha > wrote: > > > > To make identifying syscalls easier during call tree analysis load the > > syscall number just before performing the syscall. > > > > Compiler optimizations can place quite a few instructions between the > > setting of the syscall number and the syscall instruction. During call > > tree analysis the number of instructions between the two can lead to > > more difficulty for both tools and humans in properly identifying the > > syscall number. Having the syscall number set in the prior instruction > > to the syscall instruction makes this task easier and less error prone. > > Being able to reliably identify syscalls made by a given API will make > > it easier to understand and verify the safety and security of glibc. > > --- > > sysdeps/unix/sysv/linux/x86_64/sysdep.h | 27 ++++++++++++++----------- > > 1 file changed, 15 insertions(+), 12 deletions(-) > > > > diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h > > index cfb51be8c5..fd9eb4b02f 100644 > > --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h > > +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h > > @@ -250,6 +250,9 @@ > > (long int) resultvar; \ > > }) > > > > +#define MSTR_HELPER(x) #x > > +#define MSTR(x) MSTR_HELPER(x) > > These are unused. > I'll remove this in v6. Thanks, Joe