From patchwork Fri Dec 22 16:58:30 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: 1879730 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=Ja4ee2Xv; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4SxYTw5Pxxz1ydZ for ; Sat, 23 Dec 2023 04:01:08 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C05AD385E01F for ; Fri, 22 Dec 2023 17:01:06 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 43D8238582B2 for ; Fri, 22 Dec 2023 16:58:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 43D8238582B2 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 43D8238582B2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703264318; cv=none; b=WM0je+SobETvrt21CnLDnpyNJvZ/ZDEM8Z/5xxySb189amcpS6ixtdrkdBCr+g/VnJ5fTytnoW/thCLuzWORkmvtaQS6WOLtDCNraS5kn3tSQQmmZ+Lkt8RuWKTZPiX0yxMPODeUG8vFw+dH40XXcF/cLXacXUMk4knosPr9TAI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703264318; c=relaxed/simple; bh=YAkl96M8k37ah/XICIiH0nKKSVslMYzFablCzmr8/74=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=LBnIXCjwVdjrjTyU+vTPTy8U0wgOyvAJtbQdZn/aYfdUyZLBagSS+MlaArMHGeEwOEPiwoD2l4mGhIL7+ds2jgG9GDzHlF2iGbmGJmx/TaYw/04kuVpOdZNWXwddUA41qSvFPxIyihqQ/QO8XZ7Wy4g7QI/P9kAL6bhDKwRzTwo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6d98f6e8de1so362758b3a.0 for ; Fri, 22 Dec 2023 08:58:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703264314; x=1703869114; 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=1VGmPlHVScbKJ2Qc4J9Qvr9tLXWZCigzD8Xl07+thY0=; b=Ja4ee2Xv8xdbZBxS4y81WektB6H3zdj6HkybppPFNgPSDve1P3vD8CZoVPo/shtz94 2MFli8BQiFdnLegU39HLTICayi2dv7UY+IADq1xQuCItV+fr63HtP5jH3JzzZ8pGu6QL rvc107vwKgyq29U1vSvbL8ogi7kkviQNxIg5AiPeX+8fDYOUGf6InNFrLT/nyB4AyFYs 5Gcy/iCl3xpRd6SuWyIxaarCaeDZgoGiHuDk8vE813+1+inSRm2s1pQsz2/Dz2n/C5ee pBclbYBhQiiqhkpqs4grCMKSpc0MrIkwdWKtrjTBPFxVLHIv3bt8DjFR3Rr8FLx0/iQ0 8YXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703264314; x=1703869114; 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=1VGmPlHVScbKJ2Qc4J9Qvr9tLXWZCigzD8Xl07+thY0=; b=uHzEfri5FUfTvWyrdlO0OhwDnQWcXeJmD3l7scbNiXY9T9mypgAlycut2/qhlN9ead 889PEhXxkkgNZomgS3euqihdeTK6eOb8bU2nEUZXVEoVo6ZsJZ5BFY1wlP0Gk7EWH6/Q 26+PPdbeuvDMO8pOZgRIPQE2JKuqzI2o2L78t1nvS6de3mvnYOgBrmPRcyrno53yX2Ow iVKE9hfJaemEiQkurl1zATsSwuQcoLTtUsorPtKpf4tQRT7UqVy4I9oezBzBssFKQVqj pgAxA8bm70qanvtswswzIXtHGEbqNlp+w25vvpd9HTqqnkeydRCWpuZh7vqs7WyM8rKK 9/6Q== X-Gm-Message-State: AOJu0Yy3I9oihvx/HcoODi9NBC2zA4v6JCVi+jrSyzPrK1RlnyhgShaL ZeMw6/L4R5dtRomRh71lkGM= X-Google-Smtp-Source: AGHT+IGLXVa2edycurudSJQVEMyxIbFBdfUF07rqwkHtMRsP1vBWcVpQDeYWV2SA4AmKHs9D/SHXlw== X-Received: by 2002:aa7:8003:0:b0:6d9:5da1:5b9 with SMTP id j3-20020aa78003000000b006d95da105b9mr1053354pfi.65.1703264314085; Fri, 22 Dec 2023 08:58:34 -0800 (PST) Received: from gnu-cfl-3.localdomain ([172.56.169.119]) by smtp.gmail.com with ESMTPSA id g12-20020aa79f0c000000b006d273997cd5sm3738283pfr.91.2023.12.22.08.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 08:58:33 -0800 (PST) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id C838C740659; Fri, 22 Dec 2023 08:58:30 -0800 (PST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: rick.p.edgecombe@intel.com, goldstein.w.n@gmail.com Subject: [PATCH v5 6/6] x86/cet: Run some CET tests with shadow stack Date: Fri, 22 Dec 2023 08:58:30 -0800 Message-ID: <20231222165830.2100438-7-hjl.tools@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231222165830.2100438-1-hjl.tools@gmail.com> References: <20231222165830.2100438-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3024.6 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 0aafd2afeb..a49b13c595 100644 --- a/sysdeps/x86/Makefile +++ b/sysdeps/x86/Makefile @@ -249,6 +249,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 @@ -288,14 +295,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 @@ -309,6 +322,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).