From patchwork Sun May 21 09:36:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13249336 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B675C77B73 for ; Sun, 21 May 2023 09:37:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230241AbjEUJh0 (ORCPT ); Sun, 21 May 2023 05:37:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbjEUJhH (ORCPT ); Sun, 21 May 2023 05:37:07 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B740710D; Sun, 21 May 2023 02:36:46 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1684661803; bh=oLTaTevv3k80SApzPl3sC5k69tzfv/sUdDz9hEu9AXU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EVIsm97U6hspOISLz9ZkoZ//yLstU5Paxq2AbGwXTOMqrQbGKyFY0AH9JSYJPwldQ 4RGacL4K8+kn2z5fmBIN0ip99iQ/Kz5Pturk+/Of9nX1yVmMXX91Xv1Zz15tgi9oY6 3qo9uvtT7IdogZqQbFO5ZQrxu4Quvu8oCON6CzjE= Date: Sun, 21 May 2023 11:36:32 +0200 Subject: [PATCH 4/7] tools/nolibc: add test for __stack_chk_guard initialization MIME-Version: 1.0 Message-Id: <20230521-nolibc-automatic-stack-protector-v1-4-dad6c80c51c1@weissschuh.net> References: <20230521-nolibc-automatic-stack-protector-v1-0-dad6c80c51c1@weissschuh.net> In-Reply-To: <20230521-nolibc-automatic-stack-protector-v1-0-dad6c80c51c1@weissschuh.net> To: Willy Tarreau , "Paul E. McKenney" , Shuah Khan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nathan Chancellor , Nick Desaulniers , Tom Rix Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_Wei?= =?utf-8?q?=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1684661802; l=737; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=oLTaTevv3k80SApzPl3sC5k69tzfv/sUdDz9hEu9AXU=; b=8XeDn2bNa5olwhqFKmuOVv/Y2l1qpUlcqMMKVlNWL29/GDmokGkH5PtrMdPY2qmVkaOW+rQMG ukmwfsiBBjjBGSgBiSPqAT5uQqfU3LNeeObcPPkOlh4tTWg/TZJiFcq X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c index d8b59c8f6c03..995dc39a177e 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -808,6 +808,14 @@ static int run_protection(int min, int max) return 0; #endif +#if defined(NOLIBC_STACKPROTECTOR) + if (!__stack_chk_guard) { + llen += printf("__stack_chk_guard not initialized"); + pad_spc(llen, 64, "[FAIL]\n"); + return 1; + } +#endif + pid = -1; pid = fork();