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.129.124]) by sourceware.org (Postfix) with ESMTPS id 15EF83858C50 for ; Mon, 17 Apr 2023 15:35:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 15EF83858C50 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=1681745708; 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=MwcD193AcdeH28RnfG8/+PwU3qhp4fzUCzlYUx7GRP0=; b=GbEPYkRJ8ikmSThrpRQrmIEVvXkKCao7BkjwV0+HFUMsDLVxiM9o5lPtVFtFPVmvM9I4cd RYkh4xnq73dJuQqhxD6p71QeQXiZ+wU5bp2+2X9cXDzBxJ2uWdQaCbRLPWdVb6Jh/2UW3f 0TuRrfNg3O4DkEA2rxp/oJdVXiM0ATA= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-563-Yy7H5zKgPIKlYXRxvQVGlg-1; Mon, 17 Apr 2023 11:35:07 -0400 X-MC-Unique: Yy7H5zKgPIKlYXRxvQVGlg-1 Received: by mail-qk1-f199.google.com with SMTP id r22-20020a37a816000000b0074abffe8a68so6746246qke.5 for ; Mon, 17 Apr 2023 08:35:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681745706; x=1684337706; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MwcD193AcdeH28RnfG8/+PwU3qhp4fzUCzlYUx7GRP0=; b=SJbiLbN8Urft8vViEgKL2ddERrVOpnRfnoT/Dz9jOE1HnQS08LddUu7hp8E/63MQbI SV6UnLmllNJB1W7UoGuYT9ytO92KG9clwFzyPlOTBLll+IxWLYJzJF9YMbMdKTns4Oex prIIYGUElYFsm9O/NQh8IQHHzkeKELjeI8EfYnHi2QHbTZEpwEBnN2jVsM23P1xPdbro jkeITk1sb4dVpX/iPjetOaONYV4xgMNfN90kbyuv5Eta+NoIrkf3Xr+4X+9xaomLC45b 4lnu/6ALZYgw06hZRjk1MvIedO3o+J3MAP94ye1gcBzBFssTlFsJLVc5IMgVbV3vk/Cu uv+Q== X-Gm-Message-State: AAQBX9dz1HKzfPglBbGSMrHGLX4OlPUTVFPSiAodi9zD3cSwnA+a1KIN HvacW4fGk1nkdn1bbg555DyN2HKxWRIrFiBeE4E2Cl/cmTxOQdzP58y71iUnQ1lY1xNQOlfVXcu 0PnNLTuNYNQFUxNlWVofPiJhMYIRjOeoxiv8SoP85j7frdf2wHPuS2FWs++2TyDv0MEZea9kVmG MDKXbj X-Received: by 2002:ac8:59d5:0:b0:3e6:38b6:88f5 with SMTP id f21-20020ac859d5000000b003e638b688f5mr22219041qtf.25.1681745706536; Mon, 17 Apr 2023 08:35:06 -0700 (PDT) X-Google-Smtp-Source: AKy350YXCRLZzbDMV+ovjoHPFxLZxItC++yjJwpzLZsKMhA1i0CIYLzP2xY4ZV4cmC28GiJJN97wfw== X-Received: by 2002:ac8:59d5:0:b0:3e6:38b6:88f5 with SMTP id f21-20020ac859d5000000b003e638b688f5mr22219009qtf.25.1681745706121; Mon, 17 Apr 2023 08:35:06 -0700 (PDT) Received: from oak.redhat.com (c-71-206-142-238.hsd1.va.comcast.net. [71.206.142.238]) by smtp.gmail.com with ESMTPSA id f20-20020a05620a20d400b0074d3233487dsm1577107qka.114.2023.04.17.08.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 08:35:05 -0700 (PDT) From: Joe Simmons-Talbott To: libc-alpha@sourceware.org Cc: Joe Simmons-Talbott Subject: [PATCH v3 0/2] x86_64: aarch64: Set call number just before syscall Date: Mon, 17 Apr 2023 11:34:49 -0400 Message-Id: <20230417153451.1450817-1-josimmon@redhat.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230411133004.2268170-1-josimmon@redhat.com> References: <20230411133004.2268170-1-josimmon@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: To make binary call tree analysis easier place the syscall number into the register just before the syscall is made. Only do this if the syscall number is a constant integer. 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. Tested on x86_64 and aarch64. Changes to v2: * Add a more detailed commit message. Changes to v1: * aarch64: Combine two inline asms into one. Avoid loading name twice. Joe Simmons-Talbott (2): x86_64: Set the syscall register right before doing the syscall. aarch64: Set the syscall register right before doing the syscall. sysdeps/unix/sysv/linux/aarch64/sysdep.h | 20 +++++++++++--- sysdeps/unix/sysv/linux/x86_64/sysdep.h | 33 ++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) -- 2.39.2