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 C17DB385840E for ; Mon, 17 Apr 2023 21:20:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C17DB385840E 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=1681766440; 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=ontGVu8UgSl3te6NU2VFf4VpP1kaRQldMmbITrB56nE=; b=br1QYKTzLw+pbk81gLuBzpKM/b91E3CkJHMppGjJL/H4mHG01X4R66hST2GCRrJeM3iK4g /jGGk27kSlV2Cp1pZtCMxka4qYPgR+KZ07FmMvrhwlpMyJpi5yWvGgAjl99eAUGpLQd3Qh L3kTqnGW/7IhgzvAevgzfUGl2gSer2w= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-65-OTA71YN_PjGIGW5NK7WdVQ-1; Mon, 17 Apr 2023 17:20:39 -0400 X-MC-Unique: OTA71YN_PjGIGW5NK7WdVQ-1 Received: by mail-qt1-f198.google.com with SMTP id 13-20020ac8570d000000b003e37d3e6de2so18932764qtw.16 for ; Mon, 17 Apr 2023 14:20:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681766438; x=1684358438; 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=ontGVu8UgSl3te6NU2VFf4VpP1kaRQldMmbITrB56nE=; b=L3o0s4l2SbgLUNjUfIDm7RPn8PGMj+qkAAgq0aR5m0z6fB7hEdIljABhGIgfN9lQee mpdXA2C0ddyxvtyeiji2DgOP9frdsoeJKUDonlp1we1WM8ziKKUVCZDi1GHc0ZbKvrY2 enycmvFmtq9qqtT/mxRqBLbhq05Sz8nso9JFyizNQQTHLx3U7kmGyrpjgfqdrL2lE3Ht cjXi8c9JOi6HwVjVsaHzjTTHQlRuR3l6A3F6FQT3PlYlj3vEBuWeHqkDT8bxanXErDZd eAR+ZDOVXGMav4Em3OyyhPT0CRoB3eyGEfOxWRqHGf31sjyt9jxqnFWPIjE8+3wRNuq0 kaTg== X-Gm-Message-State: AAQBX9cB+RzS4XIy3x7Z66A04RHLud1mUJGLkuSj1Yfe69WfMOviu8TD hPYmnlMYxMKpULDOsf2yu7H70dYfyzXcK7jhYyXgRzMa59wbiiHzacEj2TBWumwkesWRaqNdzIS jDcPWkO+v9Yahk1qiIFH+kB9/gpqDFdcYcBWH1FHM5NEXQ8WYwGWJKII/F+EpDYZ2MdZ/8x7fGH idBsLE X-Received: by 2002:ad4:5f49:0:b0:5ef:8c79:fe88 with SMTP id p9-20020ad45f49000000b005ef8c79fe88mr1271842qvg.2.1681766438268; Mon, 17 Apr 2023 14:20:38 -0700 (PDT) X-Google-Smtp-Source: AKy350Y+Ijf1iWKPTrwT7QUOa4TBomp/CE1HfOWcrbYn+f9nQNMbO9EevZCCbV04mNw/SD7J7wZPhg== X-Received: by 2002:ad4:5f49:0:b0:5ef:8c79:fe88 with SMTP id p9-20020ad45f49000000b005ef8c79fe88mr1271808qvg.2.1681766437968; Mon, 17 Apr 2023 14:20:37 -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 q1-20020ad44341000000b005ef817d14casm668666qvs.83.2023.04.17.14.20.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Apr 2023 14:20:37 -0700 (PDT) From: Joe Simmons-Talbott To: libc-alpha@sourceware.org Cc: Joe Simmons-Talbott Subject: [PATCH v4 0/2] x86_64: aarch64: Set call number just before syscall Date: Mon, 17 Apr 2023 17:20:32 -0400 Message-Id: <20230417212034.3890596-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=-5.9 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 v3: * x86_64: Combine two inline asms into one. - Suggested by "H.J. Lu" 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 | 27 +++++++++++++----------- 2 files changed, 32 insertions(+), 15 deletions(-) -- 2.39.2