Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp312482rwd; Mon, 12 Jun 2023 14:03:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Y8qJDUrpXMcmQOIpAGvFeO2cP1C3juRzacMdolUJvFneKR/b2qfMPEL+tXjJ2FluzbADG X-Received: by 2002:a05:6a20:d38d:b0:10f:8b61:195f with SMTP id iq13-20020a056a20d38d00b0010f8b61195fmr10376788pzb.46.1686603795811; Mon, 12 Jun 2023 14:03:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686603795; cv=none; d=google.com; s=arc-20160816; b=jyohW8lwwsPoNledlZUPLsUR4gjMomL2rPOWa5MRhX82H1KtEuqWDRY58HhPtXRCns 5j6h68eCn68HQkq17jqJvBGnjYbyITjHF4KHX6Vkh7CDoyN7v94f+5QukwHaTOZSTgQ1 3hMiu41X3LU+edNFKKJXjHwLXEN53cmAXHsd6FawuwgnT1Wosf4+cvpMS3gBWejqyu8X xEFrNSAos7fubIm0/b1nqDusDlW9F0/WoWU5bvVh18Vigcw/kE7yFeXm3mTsy5pOautH VHRHekFbOyty2KX4mYfRQb+LRcbk+vvIVxoOWAkntTUONpRcNhjTvaKmtxGGYEYfULXu 6OjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=L8vG03HGS/vNhM6rJN9ceTx5vQw9tsgW5Ao0+gwCT1Y=; b=f9Lwl6QXiF4mZ4eDVuJw9sdl4KhO97reQwoWNakK2pnLxyfhgfqmXVgkm/S6Yk6twV eXcxK/7dzYjYrqYyhvlvWpZehTGoY/qGGyEqTC33InpfNGd476pfnSEZAJuY9lo62Ply tshLgoQRoitjqs2899TYhx6Hwf5lRFMg4FdkgyZOZVPho/qrBoRZbOvF8jMBLx18BHya tiea0hhu25boAYf70NlkXt1aZB3Kp/4XpGgu71+fOUSd9fstmMlIuitV9H84FHZfvbPL K8IzZhuI6BYTdQWQEtTRY+wO4qTPjTJa73ErZq+cV3bt9A2HX4fNhM6LakdXPAZ3YqXm eCNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RK8MCXjU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f23-20020a637557000000b00543fccebbb1si7194790pgn.284.2023.06.12.14.03.03; Mon, 12 Jun 2023 14:03:15 -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=@kernel.org header.s=k20201202 header.b=RK8MCXjU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238522AbjFLUvd (ORCPT + 99 others); Mon, 12 Jun 2023 16:51:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238119AbjFLUtI (ORCPT ); Mon, 12 Jun 2023 16:49:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8F13170C for ; Mon, 12 Jun 2023 13:46:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F068E62F28 for ; Mon, 12 Jun 2023 20:45:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D86F5C43442; Mon, 12 Jun 2023 20:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686602716; bh=Z+V/mSZIwxrjw/qqhnVpPLMMERUm+X+LueBoG1mUtCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RK8MCXjUF86Tz9XjkMAPMucGpoVut1ztAAj5YLlv4KxmkwZAm8IU12lTlY9PRfqsA SEq2+yngy61rZNNWtPUk1WJ8dyMr0wHd+VLOKdxspoKLNtKOLD1H4IbfRFlGrs8tUA EBjjdVzsK32ZaLquy5p/99FwSgFfoa/V/pUcTqSSEreiXTfRLz3omhxegdooi5uDKD dE0jkahXPzuNWYl2fpPN7MKMHSi9zsqQixE8YnHBK4z0xGQF+duuURF8lUHl5ueQj+ lkBDj2aMKu6h9Zai8NO7RmAfC+gNdPqj7b2LAdb8L+THa6mycBCzS/jat1N0HK1Lpo JM5pn/FLaj8RQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id D64D0CE3A5E; Mon, 12 Jun 2023 13:45:15 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: gwml@vger.gnuweeb.org, kernel-team@meta.com, w@lwt.eu, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Willy Tarreau , "Paul E . McKenney" Subject: [PATCH v2 nolibc 20/53] tools/nolibc: aarch64: add stackprotector support Date: Mon, 12 Jun 2023 13:44:41 -0700 Message-Id: <20230612204514.292087-20-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <8b757cc0-3719-4e63-a755-9710384137bc@paulmck-laptop> References: <8b757cc0-3719-4e63-a755-9710384137bc@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 From: Thomas Weißschuh Signed-off-by: Thomas Weißschuh Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney --- tools/include/nolibc/arch-aarch64.h | 7 ++++++- tools/testing/selftests/nolibc/Makefile | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/include/nolibc/arch-aarch64.h b/tools/include/nolibc/arch-aarch64.h index 76ef26520c85..6a859131c530 100644 --- a/tools/include/nolibc/arch-aarch64.h +++ b/tools/include/nolibc/arch-aarch64.h @@ -172,10 +172,15 @@ struct sys_stat_struct { char **environ __attribute__((weak)); const unsigned long *_auxv __attribute__((weak)); +#define __ARCH_SUPPORTS_STACK_PROTECTOR + /* startup code */ -void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void) +void __attribute__((weak,noreturn,optimize("omit-frame-pointer"),no_stack_protector)) _start(void) { __asm__ volatile ( +#ifdef NOLIBC_STACKPROTECTOR + "bl __stack_chk_init\n" /* initialize stack protector */ +#endif "ldr x0, [sp]\n" /* argc (x0) was in the stack */ "add x1, sp, 8\n" /* argv (x1) = sp */ "lsl x2, x0, 3\n" /* envp (x2) = 8*argc ... */ diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 423d22f353a0..fa0075479a26 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -82,6 +82,7 @@ CFLAGS_STACKPROTECTOR = -DNOLIBC_STACKPROTECTOR \ CFLAGS_STKP_i386 = $(CFLAGS_STACKPROTECTOR) CFLAGS_STKP_x86_64 = $(CFLAGS_STACKPROTECTOR) CFLAGS_STKP_x86 = $(CFLAGS_STACKPROTECTOR) +CFLAGS_STKP_arm64 = $(CFLAGS_STACKPROTECTOR) CFLAGS_s390 = -m64 CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \ $(call cc-option,-fno-stack-protector) \ -- 2.40.1