From nobody Mon Nov 10 01:14:39 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552481150156135.44236885111673; Wed, 13 Mar 2019 05:45:50 -0700 (PDT) Received: from localhost ([127.0.0.1]:43966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h43GL-0004kn-KB for importer@patchew.org; Wed, 13 Mar 2019 08:45:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h43By-0001Mw-KC for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:41:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h43Bx-0005MM-E9 for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:41:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47076) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h43Bv-0005L2-Hb for qemu-devel@nongnu.org; Wed, 13 Mar 2019 08:41:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F27731587B0; Wed, 13 Mar 2019 12:41:02 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-43.ams2.redhat.com [10.36.112.43]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61C001001E6A; Wed, 13 Mar 2019 12:41:00 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 13 Mar 2019 13:40:41 +0100 Message-Id: <20190313124042.12855-7-pbonzini@redhat.com> In-Reply-To: <20190313124042.12855-1-pbonzini@redhat.com> References: <20190313124042.12855-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 13 Mar 2019 12:41:02 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 6/7] linux-user: add IBT support to x86 safe-syscall.S X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fweimer@redhat.com, kwolf@redhat.com, richard.henderson@linaro.org, stefanha@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Because safe-syscall.S does not go through the C compiler, the .note.gnu.property note has to be added manually. Safe syscalls do not involve any indirect branch or stack unwinding, so they are trivially safe for IBT or shadow stacks. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- linux-user/host/i386/safe-syscall.inc.S | 19 +++++++++++++++++++ linux-user/host/x86_64/safe-syscall.inc.S | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/linux-user/host/i386/safe-syscall.inc.S b/linux-user/host/i386= /safe-syscall.inc.S index 9e58fc6504..6c6d568d62 100644 --- a/linux-user/host/i386/safe-syscall.inc.S +++ b/linux-user/host/i386/safe-syscall.inc.S @@ -98,3 +98,22 @@ safe_syscall_end: .cfi_endproc =20 .size safe_syscall_base, .-safe_syscall_base + + .pushsection ".note.gnu.property", "a" + .p2align 2 + .long 1f - 0f /* name length. */ + .long 4f - 1f /* data length. */ + .long 5 /* NT_GNU_PROPERTY_TYPE_0. */ +0: + .asciz "GNU" /* vendor name. */ + .p2align 2 +1: + /* GNU_PROPERTY_X86_FEATURE_1_AND. */ + .long 0xc0000002 /* pr_type. */ + .long 3f - 2f /* pr_datasz. */ +2: + .long 0x3 /* IBT, SHSTK */ +3: + .p2align 2 +4: + .popsection diff --git a/linux-user/host/x86_64/safe-syscall.inc.S b/linux-user/host/x8= 6_64/safe-syscall.inc.S index f36992daa3..e1a57db338 100644 --- a/linux-user/host/x86_64/safe-syscall.inc.S +++ b/linux-user/host/x86_64/safe-syscall.inc.S @@ -89,3 +89,22 @@ safe_syscall_end: .cfi_endproc =20 .size safe_syscall_base, .-safe_syscall_base + + .pushsection ".note.gnu.property", "a" + .p2align 3 + .long 1f - 0f /* name length. */ + .long 4f - 1f /* data length. */ + .long 5 /* NT_GNU_PROPERTY_TYPE_0. */ +0: + .asciz "GNU" /* vendor name. */ + .p2align 3 +1: + /* GNU_PROPERTY_X86_FEATURE_1_AND. */ + .long 0xc0000002 /* pr_type. */ + .long 3f - 2f /* pr_datasz. */ +2: + .long 0x3 /* IBT, SHSTK */ +3: + .p2align 3 +4: + .popsection --=20 2.20.1