From patchwork Sun May 21 09:36:28 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: 9630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp791043vqo; Sun, 21 May 2023 02:53:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7qHuvM+bPxm1N43AWsvvFcGV+r+9caLNdVA8i4o64ihaMu4+pi9a+Px6scbx2YmLGzbUWj X-Received: by 2002:a17:90a:ba0a:b0:249:842d:312f with SMTP id s10-20020a17090aba0a00b00249842d312fmr7177459pjr.4.1684662829578; Sun, 21 May 2023 02:53:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684662829; cv=none; d=google.com; s=arc-20160816; b=IEo+1Gj71jhvZBtYfliFWYyLiNtdYC7ukoRPkEso9XraJE1lnCzB4evt5oh/eoyM32 prcJUBw/8Ms4rOjNVfj4o2YTQeDP0y6wVEExntsnf8q7QTXJ4GyKppA3RBMdJNo80KEP uklkYurVtlyHexuj0CxQe0fuN/4WKnTPlT9yaPwVMLKhoC+F3N0Z7r1Uwk0+TV9Rt2eD x+o0GcgewIFvbGCT9IJL1iK+aHEXlqQ5JlVaNrxK4neFKZ/B5wMtc7zJNN51IGJZRtaW ZF88rPV+pdizdKoB40GPK7vl906JH8T9bIDAEcNpGOevq6VLJcEab8ShNqOu8UKaNbcY frfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:dkim-signature:from; bh=V4t8nKYgP0dxTHWw+kaFcERfFszxGbasnK+61sTxnlc=; b=b/ZtAnYHpdJLm/aIht2GIgTSOoVgRiUOlMFOeMArvd5cADDVpBqD2QLmxsK4Di1TAw GztviTFQe3WYvL0q9w8gvAOCxqoapkGChPvKxwLEfcj+isBGEuvyQljk6wXVMYr0bKTl 6ZwtrTZ42oveX8wDy+CQAxZvjx65rp5fgLx2qsGZiUvZMgg0elputxXHmUphzOYcScu8 WltDA2PV0pHQ9NYM1fTXC8873nDDoFCPebrtCKvZmydX9O3ZqzXd5KvrafSgua2reOC4 woZ6NF4wdp4T1kkYjeR5ptmJC/x0Q2RFrBv+CElEEvv7pOrUrfWHQuYfRze8IdalMAxn 71XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=cqxlSIQD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gm14-20020a17090b100e00b0023af4ee47dasi1052449pjb.65.2023.05.21.02.53.35; Sun, 21 May 2023 02:53:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=cqxlSIQD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230150AbjEUJhU (ORCPT + 99 others); Sun, 21 May 2023 05:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230164AbjEUJhH (ORCPT ); Sun, 21 May 2023 05:37:07 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B76D0119; 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=IRUupTWokl6bSvN/Qk4Ov6+kUGTwoo0KFMWwChixIDM=; h=From:Subject:Date:To:Cc:From; b=cqxlSIQDXcaATq4ZkEomg3mY2IIrtqss61smptg9yb0lL1E7hdITHmKOiQkYwWMPr dSUmlXT3YXWXIAj6wIKV373n/HOdFYkU8neAUuRNG4U2Y55s6Mf3AQV4YgSKua8BCn gEy2ZeaIjLoDyfdEpiNxt0KJb6Awa7KExEknuKus= Subject: [PATCH 0/7] tools/nolibc: autodetect stackprotector availability from compiler Date: Sun, 21 May 2023 11:36:28 +0200 Message-Id: <20230521-nolibc-automatic-stack-protector-v1-0-dad6c80c51c1@weissschuh.net> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIABzmaWQC/x2NQQrCMBAAv1L27EIbraJfkR4268YuxqRsUhFK/ 27wOHOY2aCIqRS4dRuYfLRoTg2GQwc8U3oK6qMxuN4d+9ENmHJUz0hrzW+qylgq8QsXy1W4ZkN /CpdA/ipnN0LLeCqC3ijx3EJpjbHJxSTo9/+9T/v+A6RUit+HAAAA 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=1743; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=IRUupTWokl6bSvN/Qk4Ov6+kUGTwoo0KFMWwChixIDM=; b=+KCHXIX7ZFxeWvKYgiPiXSHck8c9OJAqiZ1m8d98eL9+rckJEWvb6uDCavW+0/kuvJ7Fdte+g m1VE13Y0y6WDZ5dPNcWR/VP/9J98CEzoH+Wt4RH1E7OYcJxR3RLRXIu X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766497010832004708?= X-GMAIL-MSGID: =?utf-8?q?1766497010832004708?= As suggested by Willy it is possible to detect the availability of stackprotector via preprocessor defines. Make use of that to simplify the code and interface of nolibc. Signed-off-by: Thomas Weißschuh --- Thomas Weißschuh (7): tools/nolibc: fix typo pint -> point tools/nolibc: x86_64: disable stack protector for _start tools/nolibc: ensure stack protector guard is never zero tools/nolibc: add test for __stack_chk_guard initialization tools/nolibc: reformat list of headers to be installed tools/nolibc: add autodetection for stackprotector support tools/nolibc: simplify stackprotector compiler flags tools/include/nolibc/Makefile | 19 +++++++++++++++++-- tools/include/nolibc/arch-aarch64.h | 6 +++--- tools/include/nolibc/arch-arm.h | 6 +++--- tools/include/nolibc/arch-i386.h | 6 +++--- tools/include/nolibc/arch-loongarch.h | 6 +++--- tools/include/nolibc/arch-mips.h | 6 +++--- tools/include/nolibc/arch-riscv.h | 6 +++--- tools/include/nolibc/arch-x86_64.h | 8 ++++---- tools/include/nolibc/arch.h | 2 +- tools/include/nolibc/compiler.h | 15 +++++++++++++++ tools/include/nolibc/stackprotector.h | 15 ++++++--------- tools/testing/selftests/nolibc/Makefile | 13 ++----------- tools/testing/selftests/nolibc/nolibc-test.c | 10 +++++++++- 13 files changed, 72 insertions(+), 46 deletions(-) --- base-commit: 606343b7478c319cb30291a39ecbceddb42229d6 change-id: 20230521-nolibc-automatic-stack-protector-b4f7fab9e625 Best regards,