Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1o9bIv-0006hN-Q1 for mharc-grub-devel@gnu.org; Thu, 07 Jul 2022 19:53:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9bIu-0006gs-Ap for grub-devel@gnu.org; Thu, 07 Jul 2022 19:53:04 -0400 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]:43675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9bIp-0003fe-W4 for grub-devel@gnu.org; Thu, 07 Jul 2022 19:53:04 -0400 Received: by mail-qk1-x735.google.com with SMTP id p17so2388769qkj.10 for ; Thu, 07 Jul 2022 16:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lpACRi07kY9z3eeZzy5Vy8FJa3MyX2IeWINXaB7y9fw=; b=PSvYyN75YnALY1060VU0JS6d+3yiL2hI96968Ee+q2e0GxRtXMwZZrfd1XvLlGfzkG J/xDfWOFiMG5MW7a1FqEomXjzNyShV4oGjj9S6LcwDIN/LfBeD5YU6e6hyzxJ7tTmubr GxCsW/RhwG/J7zYkibgtUO05QYokp7AadoCcy3Yb3yo+sHwSGBkGHJQE8ky/UtgdRc5c 5/C+4t5LCGU2cY99qH5tuBo/Yws/9v4WGbyH6nld33PfpUFpmPBej1+oQbPU3jlBzXji 8vApfBbJU5Puc6kVlBRcM7PRL3ERjUm5H9jI5ySLZkAdU3n6zL+I67+47pYaRcIFjsKe a0tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=lpACRi07kY9z3eeZzy5Vy8FJa3MyX2IeWINXaB7y9fw=; b=k+pQQca78RVdL4RJSfzVdf9/sadmV1UcqoLMkbP7kkidN9gaeIOux7QGGa8GnB7uYn I3JRfaqOr82h1wXSFCibuok1DcDTVVyX+OT6AepI8bCO9/7CWEOCYwbd/ZKA3Vn58B+t 3RU35MBu60xhnux/QLA03HHNoOGIRLf4VHpPFVEgZcZNMnJ3ui5QDeb52/O0viLs9K0B ktZIwSKvtiUZXYHULZPjhUJBWflsuuPTxbQYY+9ygyOMigHF8q+cVzahW959OdlM+aHD iKvTWB/gXGzXaJBFCDaCh/j+vUNinlMKWZeRN//Ja6Iu21wkNuIByM/vVZlyPZiPbhXK vDFg== X-Gm-Message-State: AJIora+dic/lR+8TyGNwsT3jEIsVyHlP1RCQs6F2V/oH5qQWsKHgDFcM BoE8PSUfOkK8+5TmQuGs/mPsy+Lp/eo= X-Google-Smtp-Source: AGRyM1trrK1bCift5XQF0uK9SDqyH3gi9mmqxkaQypt1YbYMFq479zw+NYi5LtzJM2HodVu+CJ519A== X-Received: by 2002:a37:678f:0:b0:6b5:4e8a:a8f2 with SMTP id b137-20020a37678f000000b006b54e8aa8f2mr392032qkc.341.1657237978070; Thu, 07 Jul 2022 16:52:58 -0700 (PDT) Received: from localhost.localdomain ([2602:47:d930:400:e23f:49ff:fe19:abd0]) by smtp.googlemail.com with ESMTPSA id ay4-20020a05622a228400b002f39b99f69csm26189047qtb.54.2022.07.07.16.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 16:52:57 -0700 (PDT) From: Nicholas Vinson To: grub-devel@gnu.org Cc: Nicholas Vinson Subject: [PATCH v3] configure.ac: warn if stack-protector not allowed Date: Thu, 7 Jul 2022 19:52:47 -0400 Message-Id: <20220707235247.16239-1-nvinson234@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::735; envelope-from=nvinson234@gmail.com; helo=mail-qk1-x735.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jul 2022 23:53:04 -0000 Introduce ERROR_PLATFORM_NOT_SUPPORT_SSP environment variable to treat the '--enable-stack-protector is only supported on EFI platforms' message as a warning instead of an error. If ERROR_PLATFORM_NOT_SUPPORT_SSP is set to 'no' (case-insensitive), then the message will be printed as a warning. Otherwise, it prints as an error. The default behavior is to print the message as an error. For any wrapper build script that has some variation of: for p in SELECTED_GRUB_PLATFORMS; do \ configure --enable-stack-protector \ --with-platform${P} ... || die; \ done make GRUB will fail to build if SELECTED_GRUB_PLATFORMS contains a platform that does not support SSP. Such wrapper scripts need to work-around this issue by modifying the above for-loop, so it conditionally passes '--enable-stack-protector' to configure for the proper GRUB platform(s). However, if the above example is modified to have to conditionally pass in --enable-stack-protector, its behavior is effectively the same as the proposed change. Additionally, The list of SSP supported platforms is now in 2 places. One in the configure script and one in the build wrapper script. If the second list is not properly maintained it could mistakenly disable SSP for a platform that later gained support for it. Signed-off-by: Nicholas Vinson --- configure.ac | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 57fb70945..90f686f79 100644 --- a/configure.ac +++ b/configure.ac @@ -36,6 +36,10 @@ dnl description of the relationships between them. AC_INIT([GRUB],[2.11],[bug-grub@gnu.org]) +AS_CASE(["$ERROR_PLATFORM_NOT_SUPPORT_SSP"], + [n | no | nO | N | No | NO], [ERROR_PLATFORM_NOT_SUPPORT_SSP=no], + [ERROR_PLATFORM_NOT_SUPPORT_SSP=yes]) + # We don't want -g -O2 by default in CFLAGS : ${CFLAGS=""} @@ -1349,7 +1353,12 @@ if test "x$enable_stack_protector" = xno; then TARGET_CFLAGS="$TARGET_CFLAGS -fno-stack-protector" fi elif test "x$platform" != xefi; then - AC_MSG_ERROR([--enable-stack-protector is only supported on EFI platforms]) + if test "$ERROR_PLATFORM_NOT_SUPPORT_SSP" = "yes"; then + AC_MSG_ERROR([--enable-stack-protector is only supported on EFI platforms]) + else + AC_MSG_WARN([--enable-stack-protector is only supported on EFI platforms]) + fi + enable_stack_protector=no elif test "x$ssp_global_possible" != xyes; then AC_MSG_ERROR([--enable-stack-protector is not supported (compiler doesn't support -mstack-protector-guard=global)]) else -- 2.35.1