From patchwork Mon Nov 25 18:03:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 101843 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 68A6C385840D for ; Mon, 25 Nov 2024 18:04:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 68A6C385840D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=it1MnM6o X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 8C2303858D29 for ; Mon, 25 Nov 2024 18:03:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8C2303858D29 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 8C2303858D29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732557824; cv=none; b=vbIyUJ/7xfKmLFlKy7g7bfOAfYLCc1Y7Y07rEnAiLrhAELzQb8PggsH2DGtGTc+ADtHhl7rURs19a7fcoT+9uWFyffqXZNoaCQzds4QG9hnQtaMCHfxIux12QP2bW98vOFna1AVK4yXQI6N5Mk2xes850qCkexJwycKposHuf54= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1732557824; c=relaxed/simple; bh=sIa841zeaBim9B7kq2yBL3//8LAPoyiIQOXuU7T+688=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=dZvH/1F8wyHUMubDPLjg9/LOvmfneJEOgmb7MEpZSCdJuZvrHi1O27XueMJlfCwJEUtHt57qP4dIi4Dv8FtZcnSSyVpxQkBYZ7ykNw5BRP8zajOfcvGbTRU2wZnczh5JcaYDPzWRHAUGHOfr5lOEn4Ru+gIj1zE5oPZZ8FqeUIM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8C2303858D29 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732557824; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=qnffUDdRfGyuzcbRxi42sn8ao15s1NrS/SmUD7nEKXE=; b=it1MnM6o4/FIr9jRGLrhXNLG73XAMhy9EtsAZoHt4vSClfCG5IJyh5evQo99Op8HSBsz6m C/AHF884k2il2I7IMDwwv9qtUAE01UkIWXmUR8fO4RFnafiCSg72itquypQGDzyRMH+O8r 17pBi7T3ZE1pBeVlb9bK0h78k2jhtMA= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-620-QCpb_oQQPlmfLY_TxLeoRQ-1; Mon, 25 Nov 2024 13:03:43 -0500 X-MC-Unique: QCpb_oQQPlmfLY_TxLeoRQ-1 X-Mimecast-MFC-AGG-ID: QCpb_oQQPlmfLY_TxLeoRQ Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 630A21955F3A for ; Mon, 25 Nov 2024 18:03:42 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.74]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id ABBD41944CC9 for ; Mon, 25 Nov 2024 18:03:41 +0000 (UTC) From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] debug: Wire up tst-longjmp_chk3 Date: Mon, 25 Nov 2024 19:03:39 +0100 Message-ID: <87h67v5gxw.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: uZoxRKLiT8l9rRRHHVibE5VR47Bn3hKVfZsc_Ll41js_1732557822 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, INDUSTRIAL_BODY, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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~patchwork=sourceware.org@sourceware.org The test was added in commit ac8cc9e300a002228eb7e660df3e7b333d9a7414 without all the required Makefile scaffolding. Tweak the test so that it actually builds (including with dynamic SIGSTKSZ). Tested on aarch64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu, s390x-linux-gnu, x86-64-linux-gnu. Reviewed-by: Adhemerval Zanella --- debug/Makefile | 1 + debug/tst-longjmp_chk3.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) base-commit: 2062e02772128db6b90bf0078c5041c66c4a951e diff --git a/debug/Makefile b/debug/Makefile index 89ee80bf4d..278e44c6ad 100644 --- a/debug/Makefile +++ b/debug/Makefile @@ -288,6 +288,7 @@ tests = \ tst-fortify-wide \ tst-longjmp_chk \ tst-longjmp_chk2 \ + tst-longjmp_chk3 \ tst-realpath-chk \ tst-sprintf-fortify-rdonly \ tst-sprintf-fortify-unchecked \ diff --git a/debug/tst-longjmp_chk3.c b/debug/tst-longjmp_chk3.c index 9ff9977207..7bf1646b35 100644 --- a/debug/tst-longjmp_chk3.c +++ b/debug/tst-longjmp_chk3.c @@ -18,9 +18,12 @@ #include #include +#include #include -static char buf[SIGSTKSZ * 4]; +#include + +static char *buf; static jmp_buf jb; static void @@ -49,8 +52,10 @@ do_test (void) set_fortify_handler (handler); /* Create a valid signal stack and enable it. */ + size_t bufsize = SIGSTKSZ * 4; + buf = xmalloc (bufsize); ss.ss_sp = buf; - ss.ss_size = sizeof (buf); + ss.ss_size = bufsize; ss.ss_flags = 0; if (sigaltstack (&ss, NULL) < 0) { @@ -65,8 +70,8 @@ do_test (void) /* Shrink the signal stack so the jmpbuf is now invalid. We adjust the start & end to handle stacks that grow up & down. */ - ss.ss_sp = buf + sizeof (buf) / 2; - ss.ss_size = sizeof (buf) / 4; + ss.ss_sp = buf + bufsize / 2; + ss.ss_size = bufsize / 4; if (sigaltstack (&ss, NULL) < 0) { printf ("second sigaltstack failed: %m\n");