Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1o9UM8-0000pr-0X for mharc-grub-devel@gnu.org; Thu, 07 Jul 2022 12:27:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9UM6-0000nw-DD for grub-devel@gnu.org; Thu, 07 Jul 2022 12:27:54 -0400 Received: from mail-qt1-x829.google.com ([2607:f8b0:4864:20::829]:45591) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9UM2-0000ms-2G for grub-devel@gnu.org; Thu, 07 Jul 2022 12:27:54 -0400 Received: by mail-qt1-x829.google.com with SMTP id z13so23464745qts.12 for ; Thu, 07 Jul 2022 09:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=EPHvYufuSoEdn4HpFeuV22/eC2YTSEMInJScKParzcs=; b=KjBR+n5BspDD5OyuMwNY9o+3gMuTL5rOIkQ7LG1Kwp2pbdjjfHruVaSTq/IBRsnA1l /gCxfKQbwzZ0VTng/z9cHLRTk3qiQ4jt3iibvPCo9O2bMGe9Y5AeL/qZl2c5c6amwXUF tEyWxwj62BAk0Rc27e3rECUqfx0cOLtV8sT1u1uuxn8RgmIPyUtL2o8ijAMspvPQcyxi fAH9UmFp9Mo2oqaY/Nl5PaU8bZrDOvHPHBkbVOwdm1JZtUUYL10btE7D+PRQeQboENcj 57urG1L3/i4MbXi1gfjlYqaP3RvmiDe+xw+Rmu1DPXjtvDLPfzKCRW5o/stB2TlSbCP3 fdzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=EPHvYufuSoEdn4HpFeuV22/eC2YTSEMInJScKParzcs=; b=mnwueE67swfwauYsM3wwwy0pAYqVkBoZv23rcQ7UESn4a2UXhY+ynIAT+lozCCvJmR cqWowVx4xSIHdyAtt9UCtsAHGzT5/ydamumqvfnkIit4c0w3VowgPhsxHE0TAqUv7adq JK2iZwj3wI4BVgHzBLK8FC49PjCFqTN2RyPHtpUuOogEpaXvyrQ1zXzzHFi9B2tOePZz a3+EfzRFzWjuwI0STDLqYaxbi0oSBhF9epIelaUW8iY3ax4FcXbYVBoqpdDa6NvKQPzJ ReQ4RHkCvlTX7k3tGT/x8hF1C0FMuhpBD/aMLmNYMZXiGSVbSvptMVUf9fEkby6vXFvE OrbQ== X-Gm-Message-State: AJIora9kOSc8LUTqU5zgy/6ddbvEbWjgTy2YslEq50OaYpcpZFP2xv9/ 6/QfckOles8klVNeRTqtZEthJEjPdes= X-Google-Smtp-Source: AGRyM1sJuDcBd+V29cK89zYI8yCdIaGTr2WAqVrE1o0SnDg3TSLvJnbnDVzH3lxnjn7uV26FgOnqkQ== X-Received: by 2002:a05:6214:c2a:b0:470:b6c6:8a68 with SMTP id a10-20020a0562140c2a00b00470b6c68a68mr41210625qvd.99.1657211267385; Thu, 07 Jul 2022 09:27:47 -0700 (PDT) Received: from ?IPV6:2602:47:d930:400:1a7:dd5b:d190:a39b? ([2602:47:d930:400:1a7:dd5b:d190:a39b]) by smtp.gmail.com with ESMTPSA id u16-20020a05620a0c5000b006a6ebde4799sm37146315qki.90.2022.07.07.09.27.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Jul 2022 09:27:46 -0700 (PDT) Message-ID: <5dbfaa5e-7dd2-47e6-5809-3eaba01be054@gmail.com> Date: Thu, 7 Jul 2022 12:27:45 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2] configure.ac: warn if stack-protector not allowed Content-Language: en-US To: Daniel Kiper Cc: grub-devel@gnu.org References: <20220706072558.5781-1-nvinson234@gmail.com> <20220707131720.lxzuc2mauhw25vzd@tomti.i.net-space.pl> From: Nicholas Vinson In-Reply-To: <20220707131720.lxzuc2mauhw25vzd@tomti.i.net-space.pl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::829; envelope-from=nvinson234@gmail.com; helo=mail-qt1-x829.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, NICE_REPLY_A=-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 16:27:54 -0000 On 7/7/22 09:17, Daniel Kiper wrote: > On Wed, Jul 06, 2022 at 03:25:58AM -0400, Nicholas Vinson wrote: >> 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 > > Reviewed-by: Daniel Kiper > > But one nit below... > >> --- >> configure.ac | 12 +++++++++++- >> 1 file changed, 11 insertions(+), 1 deletion(-) >> >> diff --git a/configure.ac b/configure.ac >> index 57fb70945..a08f3285e 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=""} >> >> @@ -1342,6 +1346,7 @@ AC_ARG_ENABLE([stack-protector], >> [enable the stack protector]), >> [], >> [enable_stack_protector=no]) >> + > > I think this change can be dropped... Agreed. It's an errant white space only change. Unless someone says otherwise, I'll regenerate the request with this change removed. Thanks, Nicholas Vinson > >> if test "x$enable_stack_protector" = xno; then >> if test "x$ssp_possible" = xyes; then >> # Need that, because some distributions ship compilers that include >> @@ -1349,7 +1354,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 > > Daniel