From patchwork Sat Dec 16 16:53:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1876962 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=H926At3D; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Sssg83qQyz23p7 for ; Sun, 17 Dec 2023 03:56:20 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 89ADD3864C5B for ; Sat, 16 Dec 2023 16:56:18 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by sourceware.org (Postfix) with ESMTPS id ACB203864C6A for ; Sat, 16 Dec 2023 16:53:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ACB203864C6A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ACB203864C6A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d29 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702745618; cv=none; b=xqF6UN86gObfKtn12Pr1sgg3xmGIcL9gBo+QFZp0FdNdRQTaEB+7FUEtcBIXIqsR1oKm/GWKhj62dUW/fVJW9SKilSqna71xJum1ROKt0hp+vMVykq0+ic+PvnAvV+7fWDHlXxMjMfVXhGw7WM0A1Pz7rPLvjMG/0oCsbiu7nOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702745618; c=relaxed/simple; bh=Firs2vtPaO3PKpysQgLiOzcQl5hNwlbOXzdtHcqOjpM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=cx9VWoEF4wD7UfhcPLQkqI1GXQS0gEYpItPGIr1l9DBWw6wAU42qnyZfz2Cz27x8VXm7cV+jDdXnQeV1SXAxqMwVBIfUgijSlWYsrGLsMhvRVEHneG7H0Lg3+umY9x91p0PfuvRFx9whytl92tznigfXo6gRNFXKFBLjf6lxHC0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-7b771176f80so130756339f.2 for ; Sat, 16 Dec 2023 08:53:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702745616; x=1703350416; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=929ZGvdUFAKvxIj+iZVtCt4zlFAzvqMB684rflN/xpQ=; b=H926At3Dc3WIFI4uISKIIqUomZYV3z9GUJuKJcch9SJ8T4AVGOp57BDZVmj1lPksvl T0sMYRtjghDjrXf9JTHNJEr0e9UeH86S9Jd+BpVCt03QJwyXRzbP9o3hkLQRR8Rrd2hP ow5fsmGaMKRS6AKjCabvvsoAoD1sUGyx8JiaUaqvf+1nnA1nVjgR4Sx79U5wbu/rEY+W Urlt+l4RyGoddeYGe+Wfu1mil+zphnrKhWmAtk+mic5dMKmF53ycIvsjJMJ0zyd160WP Ie3E/heP/l2DePNjbLzWaTgvE7jk9I+l/+46Y6TIOWak4J+9PtrJ8zzT6CIOYmB9WDan +7ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702745616; x=1703350416; 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=929ZGvdUFAKvxIj+iZVtCt4zlFAzvqMB684rflN/xpQ=; b=o7S0/xOuqLPbNSrnWqOBqTYq5wRIoUeLjfMvhC7sLndOWt7D+3tLqmXp66NuvsTqMw 6u6/jlnHM+mY+LpOg1RY+gm653FPaf2bpn3t0bV0kaaZOnzp3OiPd6EZobW/gS/H2jMm DZ0wc8D/CLp8d6pQsXEyYDhaHgnkIkM5xiUOjY1zXdimiuxTlm4D59V7w58pNZq+A2I9 9ujgIs/1Ab8rCT+71Wl+IUk3qYhylfcQImWux+7tuXXUibCoPXACTuCHEMZ+b3A7QXFG O9s69w/ZYrOVQzw0ScS1zfCQPatDEvFJlFZ56CuQUxHONL98qz7RAfYsQCroQad9PLvv UVGA== X-Gm-Message-State: AOJu0YzaRCdCkxm+QYj+a/7OisD2xmsyjfGBlk1288Rr7pwPI4YMWggm SELQiFlTfTXrjzlAjplXsXD3K4ARvv4= X-Google-Smtp-Source: AGHT+IFOq6ExQQaSa9bGBHKOoXCkU78/DXFZR0xgAhOYjHj47SkhrMskLLjMyIHJAfif/5RKjANZzA== X-Received: by 2002:a05:6e02:15c7:b0:35d:763a:926c with SMTP id q7-20020a056e0215c700b0035d763a926cmr23827287ilu.114.1702745615776; Sat, 16 Dec 2023 08:53:35 -0800 (PST) Received: from gnu-cfl-3.localdomain ([172.59.129.147]) by smtp.gmail.com with ESMTPSA id b18-20020a170902d51200b001cf511aa772sm16097764plg.145.2023.12.16.08.53.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 08:53:32 -0800 (PST) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 205F0740640; Sat, 16 Dec 2023 08:53:26 -0800 (PST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: rick.p.edgecombe@intel.com Subject: [PATCH v2 16/16] x86/cet: Run some CET tests with shadow stack Date: Sat, 16 Dec 2023 08:53:25 -0800 Message-ID: <20231216165325.2584919-17-hjl.tools@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231216165325.2584919-1-hjl.tools@gmail.com> References: <20231216165325.2584919-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3024.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org When CET is disabled by default, run some CET tests with shadow stack enabled using $ export GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK --- sysdeps/x86/Makefile | 14 ++++++++++++++ sysdeps/x86/tst-shstk-legacy-1e-static.sh | 1 + sysdeps/x86/tst-shstk-legacy-1e.sh | 1 + sysdeps/x86/tst-shstk-legacy-1g.sh | 1 + 4 files changed, 17 insertions(+) diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile index 6911a07a87..d751eaedf4 100644 --- a/sysdeps/x86/Makefile +++ b/sysdeps/x86/Makefile @@ -247,6 +247,13 @@ CFLAGS-tst-cet-legacy-10-static.c += -mshstk CFLAGS-tst-cet-legacy-10a.c += -fcf-protection=none CFLAGS-tst-cet-legacy-10a-static.c += -fcf-protection=none +tst-cet-legacy-4-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-cet-legacy-6-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-cet-legacy-10-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-cet-legacy-10-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-cet-legacy-10a-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-cet-legacy-10a-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK + CFLAGS-tst-shstk-legacy-1a.c += -fcf-protection=none CFLAGS-tst-shstk-legacy-1a-static.c += -fcf-protection=none CFLAGS-tst-shstk-legacy-1d.c += -fcf-protection=none @@ -286,14 +293,20 @@ tst-cet-legacy-6b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK tst-cet-legacy-9-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK tst-cet-legacy-9-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK +tst-shstk-legacy-1a-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-shstk-legacy-1a-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK $(objpfx)tst-shstk-legacy-1a: $(objpfx)tst-shstk-legacy-1-extra.o $(objpfx)tst-shstk-legacy-1a-static: $(objpfx)tst-shstk-legacy-1-extra.o +tst-shstk-legacy-1b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-shstk-legacy-1b-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK $(objpfx)tst-shstk-legacy-1b: $(objpfx)tst-shstk-legacy-1-extra.o $(objpfx)tst-shstk-legacy-1b-static: $(objpfx)tst-shstk-legacy-1-extra.o tst-shstk-legacy-1c-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-SHSTK tst-shstk-legacy-1c-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-SHSTK $(objpfx)tst-shstk-legacy-1c: $(objpfx)tst-shstk-legacy-1-extra.o $(objpfx)tst-shstk-legacy-1c-static: $(objpfx)tst-shstk-legacy-1-extra.o +tst-shstk-legacy-1d-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-shstk-legacy-1d-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK $(objpfx)tst-shstk-legacy-1d: $(objpfx)tst-shstk-legacy-1-extra.o $(objpfx)tst-shstk-legacy-1d-static: $(objpfx)tst-shstk-legacy-1-extra.o $(objpfx)tst-shstk-legacy-1e: $(objpfx)tst-shstk-legacy-1-extra.o @@ -307,6 +320,7 @@ $(objpfx)tst-shstk-legacy-1e-static.out: \ $(objpfx)tst-shstk-legacy-1e-static $(SHELL) $< $(common-objpfx) 2> $@; \ $(evaluate-test) +tst-shstk-legacy-1f-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK $(objpfx)tst-shstk-legacy-1f: $(objpfx)tst-shstk-legacy-mod-1.so $(objpfx)tst-shstk-legacy-mod-1.so: \ $(objpfx)tst-shstk-legacy-mod-1.os \ diff --git a/sysdeps/x86/tst-shstk-legacy-1e-static.sh b/sysdeps/x86/tst-shstk-legacy-1e-static.sh index e943aec70e..008c50dae3 100755 --- a/sysdeps/x86/tst-shstk-legacy-1e-static.sh +++ b/sysdeps/x86/tst-shstk-legacy-1e-static.sh @@ -20,6 +20,7 @@ common_objpfx=$1; shift +GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK \ ${common_objpfx}elf/tst-shstk-legacy-1e-static # The exit status should only be unsupported (77) or segfault (139). status=$? diff --git a/sysdeps/x86/tst-shstk-legacy-1e.sh b/sysdeps/x86/tst-shstk-legacy-1e.sh index b0467aa899..82f2acbf75 100755 --- a/sysdeps/x86/tst-shstk-legacy-1e.sh +++ b/sysdeps/x86/tst-shstk-legacy-1e.sh @@ -21,6 +21,7 @@ common_objpfx=$1; shift test_program_prefix=$1; shift +GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK \ ${test_program_prefix} \ ${common_objpfx}elf/tst-shstk-legacy-1e # The exit status should only be unsupported (77) or segfault (139). diff --git a/sysdeps/x86/tst-shstk-legacy-1g.sh b/sysdeps/x86/tst-shstk-legacy-1g.sh index c112bf6d8d..261eef7cac 100755 --- a/sysdeps/x86/tst-shstk-legacy-1g.sh +++ b/sysdeps/x86/tst-shstk-legacy-1g.sh @@ -21,6 +21,7 @@ common_objpfx=$1; shift test_program_prefix=$1; shift +GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK \ ${test_program_prefix} \ ${common_objpfx}elf/tst-shstk-legacy-1g # The exit status should only be unsupported (77) or segfault (139).