Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5911985rwb; Wed, 7 Sep 2022 09:42:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR7duL6eYYFvKBayzj6rMN1/1OpPYckrjHknCdVLjUgpBmvse+SFPR/GQ386wu5ctB0o8bYC X-Received: by 2002:a17:907:1de9:b0:771:56a9:acda with SMTP id og41-20020a1709071de900b0077156a9acdamr958590ejc.135.1662568948017; Wed, 07 Sep 2022 09:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662568948; cv=none; d=google.com; s=arc-20160816; b=iVPLXvxJd4xvIr8JvW7eGrT2oTMdXtsxp0JGJeZimgcg0g5WyGq6hFgWg5GU7bud3k fWEpVTedfoVOxyn/DotzZZ7N5b/2dheJNLTVn7/r86ngGdNnfNJQ37HU1fLX0SQqbE6i Z8QLbRgqpGmlrVmoJnXcR/zgHzdZzR2IWtn7rS2pzn89Ia00XfA7eLX5+/+0KLUJt7ie 0cbChbCwVZVJXGUMBmDK18+w5phM+Glwh49KIEp2WPW9F0xTdoeMPmpbmz08v6M9U7jp L8QB4Lp8YnEDmswdMlINzJt4NS1SSUH80GpsDi8Xyhvw87J5wgJt9d5cKM8cS8IB/2xI pdWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=nekiICsot4RR9hlxDU0J5imMIsaSvcgmKZwZKGl6pNA=; b=RLV1SWpw2S0ig1O09+3SLhZoDnNnEXQr2Jk3yfx1QLf3sadTEbB9GC2GHEJ42SjA+L 46qQEAb3i4Y7VoSG0zfkQdcwYTtsW44T7+H4zDSK/DgdRl5c2ywdkUx9WmMSrQoBQ3k5 hpS6vF/Y8/EiLsBnBfGimcyQsFnZoJDUeOzyYX7GyYeq3hO1JahwXYN6sKVBjg630FtE lUeQHndboCcXuwmOfcSC3+bUEnNR/eyCAPKRZ/OVg9DhFzMc9HIjBsspWxBgaC83AUVp oAWXbo24RRcUFTSpMc09lIxAiV2hCaffgpWkqBmqICz+pQ9fdhM0jPbzNN71JGS4SReN lO7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JcFqAmqs; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm5-20020a0564020c8500b0044f025c1390si2165305edb.501.2022.09.07.09.42.03; Wed, 07 Sep 2022 09:42:28 -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=@gmail.com header.s=20210112 header.b=JcFqAmqs; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229682AbiIGQW4 (ORCPT + 99 others); Wed, 7 Sep 2022 12:22:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbiIGQWy (ORCPT ); Wed, 7 Sep 2022 12:22:54 -0400 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC4D5481CF for ; Wed, 7 Sep 2022 09:22:53 -0700 (PDT) Received: by mail-qk1-x735.google.com with SMTP id b2so10836676qkh.12 for ; Wed, 07 Sep 2022 09:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=nekiICsot4RR9hlxDU0J5imMIsaSvcgmKZwZKGl6pNA=; b=JcFqAmqsQUkw7LgrQ4hUzAYMoKZIjWv5PCiszH2shugD/deCxUNFP9dASl4i126T3u 2HMZks0zHvY46rfLovkHzV+LqA/f1YERXnYg1r7XNfoflpnt+N+2v0BE7/0xpGn+Gbop EhNcDbm8m5Zc27vGbrdR1ssMvK6NGzhXHzZg+osmX+cagrT9ibXmNeiw71xFctIDp8tx a/8yz5JXwZlFG4okD7eTYVREq2Esdi4cS5DC9tnDKS8+pVwrlRsLxrZPuuRyF3RlMlAb B/qESnh8+xTmrLlYsG28sbNBX6G2fVhURAF9sWTVWuDktdBYKBS65+XBm52exkgUlbUe ZGhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=nekiICsot4RR9hlxDU0J5imMIsaSvcgmKZwZKGl6pNA=; b=W2XjlfSml9aAmKzXFzTfYDDGoU31biuVXkwHilG4CLTy7Xzc4x44ElKQutahgSoQbr ezjNdyyfg5FoN3rLHcgC/Jkk2t8I4Jnabyw6V1DbeKB1VtEoZz1vxwz/TPHCom3Ikt9r g4ejE9iYdS1ckvcQ4Ay5LNGom+FAeIaMTvCSUFULLNneVRtiKZzvQwUrUkkZ7MJhtSjk t1gDb8vA/jqQoOOwn8qdZQi/wxIjBv2ILWegPr5/6EEt9SLuzty0yVJ0YKCTwy6PEYCe ZE7n9n4M6L0gZSwl/kU+clk6TZFhoozltzsEpP1KbnukT2EG3+E6XgSiMmBzDm2NZoSW pdnA== X-Gm-Message-State: ACgBeo2tPVuRm0s1+tI5eSrFs2d5DV6KtBstBXQEi5ZcnlxFFAtax/Ui s5O6MBM6m7zujeh1wmkzxX8uN8mjqjt6UOPZ9gaHcLDJQig= X-Received: by 2002:ae9:e311:0:b0:6ba:e711:fb27 with SMTP id v17-20020ae9e311000000b006bae711fb27mr3355681qkf.320.1662567772754; Wed, 07 Sep 2022 09:22:52 -0700 (PDT) MIME-Version: 1.0 References: <20220907103041.0a88d5c4@endymion.delvare> <20220907172146.72460eda@endymion.delvare> <20220907180903.5a14d3c4@endymion.delvare> In-Reply-To: <20220907180903.5a14d3c4@endymion.delvare> From: Andy Shevchenko Date: Wed, 7 Sep 2022 19:22:16 +0300 Message-ID: Subject: Re: [PATCH] firmware: dmi: Fortify entry point length checks To: Jean Delvare Cc: LKML , Linus Torvalds Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, 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 On Wed, Sep 7, 2022 at 7:09 PM Jean Delvare wrote: > On Wed, 7 Sep 2022 18:48:03 +0300, Andy Shevchenko wrote: > > On Wed, Sep 7, 2022 at 6:21 PM Jean Delvare wrote: > > > On Wed, 7 Sep 2022 17:52:10 +0300, Andy Shevchenko wrote: ... > > > > "NOTE: This value was incorrectly stated in version 2.1 of this specification as > > > > 1Eh. Because of this, there might be version 2.1 implementations that > > > > use either the 1Eh or the 1Fh value, but version 2.2 or later > > > > implementations must use the 1Fh value." > > > > > > Good point, so maybe we should accept 0x1E and treat is silently as > > > 0x1F (which is what we have been doing implicitly so far) for maximum > > > compatibility? > > > > At least the previous comparison covers this case, if I'm not mistaken. > > Before my proposed change, yes. After my proposed change, no longer. > Let's not risk a regression, I'll change the check to: > > if (memcmp(buf, "_SM_", 4) == 0 && > buf[5] >= 30 && buf[5] <= 32 && > dmi_checksum(buf, buf[5])) { > > I'll also add a comment stating why we are allowing length 30. > > Thanks for the valuable feedback, You're welcome! You may add Reviewed-by: Andy Shevchenko to the resulting patch. -- With Best Regards, Andy Shevchenko