Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp516937rwd; Wed, 31 May 2023 01:21:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4dXMnxGyLLTAQHaXP9LX/EIs5iJHAK4ulBHI67mqaEOgEN4H8R5igMYmmv6r5BjU1YSDg6 X-Received: by 2002:aca:b98b:0:b0:398:4217:e890 with SMTP id j133-20020acab98b000000b003984217e890mr3319198oif.2.1685521290585; Wed, 31 May 2023 01:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685521290; cv=none; d=google.com; s=arc-20160816; b=mX0i2YMSALJtElVAeYA1p37Hw1RdqqH67/z4DyMEInN5VGSQZn254alT0oKDGPq+UL 1EJLKnc+UvSZsMz/k43RucFKPcmBb5GOYX1y2ZbfRd3f+FqVkSOpjMO4nFdl3mUzLXkE 2Y2O5t0YtPab1b83OfG1YdBgPVDIJHVD5g5PlIBjq9biw4tZ2v0lgLLHzd4PVCzSBOO0 cyqG8H1WcFC0sPB/IjmfpnWicubIJx2BqaswvSm3qi2DgnYGmvxtOS+n3m3BmXuSsIMl C2/o4FKvcvgt7sMsjfKzkM6ucXl95MqNS7FfDs5yfXLzCq2U56DV286ahHtCea0XM0+b j71Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id; bh=ut9v7FGgc/jytugvDKOUGxVCnMTcWGgJ7KmsJNNYz0k=; b=EzWGqn2CeRw93GeU6ssykIqg/Gmb9gG22aRkS9w3AzxS08EBY9pQ7pzfOZtucFE4KH qM3Jv8w4vFZQZko5phQBi/qgBwbciM5fZrS5GqWtzZFtdaXkyDSXzJpLHSGtxxHQrhzT YxJUH2Ve77dMZqznPRBQc8i2uhEh082MrXmsDmKz7rSuJzDYeJfRvnKQX546gqGxpHkf ehu74MlfUJU2DxCr7WUR1Yuh2iN84haL4y/kK9zelI/UYIWgeKh/y5HbbkJu+QxklH88 q7Q4DGyeF3V3jG+97tUWAZmsm2vqr3q+RRtxdzNoxvmFzOCAgKgXtQ2c+BGUSQzAEXfu x5GA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020a170902d50d00b001a93c1d66e0si520532plg.269.2023.05.31.01.21.19; Wed, 31 May 2023 01:21:30 -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; 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 S235003AbjEaHx6 (ORCPT + 99 others); Wed, 31 May 2023 03:53:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235008AbjEaHxa (ORCPT ); Wed, 31 May 2023 03:53:30 -0400 Received: from wp530.webpack.hosteurope.de (wp530.webpack.hosteurope.de [80.237.130.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 131E0E53; Wed, 31 May 2023 00:52:06 -0700 (PDT) Received: from [2a02:8108:8980:2478:8cde:aa2c:f324:937e]; authenticated by wp530.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1q4Gca-0004IM-2M; Wed, 31 May 2023 09:51:52 +0200 Message-ID: Date: Wed, 31 May 2023 09:51:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Content-Language: en-US, de-DE To: Kees Cook , Thomas Gleixner Cc: =?UTF-8?Q?Joan_Bruguera_Mic=c3=b3?= , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Nick Desaulniers , Masahiro Yamada , "Peter Zijlstra (Intel)" , Alyssa Ross , Sami Tolvanen , Alexander Potapenko , "Gustavo A. R. Silva" , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20230531003345.never.325-kees@kernel.org> From: Thorsten Leemhuis Subject: Re: [PATCH] x86/purgatory: Do not use fortified string functions In-Reply-To: <20230531003345.never.325-kees@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-bounce-key: webpack.hosteurope.de;linux@leemhuis.info;1685519527;264f77ae; X-HE-SMSGID: 1q4Gca-0004IM-2M X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,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 Kees, thx for looking into this. Joan, thx for bisecting. I should have done this earlier myself... On 31.05.23 02:33, Kees Cook wrote: > With the addition of -fstrict-flex-arrays=3, struct sha256_state's > trailing array is no longer ignored by CONFIG_FORTIFY_SOURCE: > > struct sha256_state { > u32 state[SHA256_DIGEST_SIZE / 4]; > u64 count; > u8 buf[SHA256_BLOCK_SIZE]; > }; > > This means that the memcpy() calls with "buf" as a destination in > sha256.c's code will attempt to perform run-time bounds checking, which > could lead to calling missing functions, specifically a potential > WARN_ONCE, which isn't callable from purgatory. > > Reported-by: Thorsten Leemhuis > Closes: https://lore.kernel.org/lkml/175578ec-9dec-7a9c-8d3a-43f24ff86b92@leemhuis.info/ Did a test build and booted it in a Vm, everything seems fine. So thx again and feel free to add: Tested-by: Thorsten Leemhuis Ciao, Thorsten