Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5892049rwb; Wed, 7 Sep 2022 09:24:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR4kWlNoNLXB96NmABVQcmlhp2z0al2Y6RVyj+BP34qGvZCNPsrLY59RY0JfVhJXvcBylNsb X-Received: by 2002:a17:906:fd8b:b0:770:7d4c:3486 with SMTP id xa11-20020a170906fd8b00b007707d4c3486mr2830018ejb.518.1662567842286; Wed, 07 Sep 2022 09:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662567842; cv=none; d=google.com; s=arc-20160816; b=DuxCDMDa9oV0AsosHQl8SPM/Y0kTOo66ulA3Fl0bTZFbuRXsupgv90EmI1RYhsSigq 4+1EobGAOSvxhNZAwZ8K4TWYt7R/BngQNk9iICJIV2FUnadGaOvDs57PCg3trQdPr8BU VdeRhRhLI6XOygpYeKY/oWiScOgCLl25q+MlLxAZj0TbngV/6OsiJFgKRLfvSNkS1HGJ KbVeSKOpQi1/EIphhoz9/sIw2jpEwdbipISs/4jIB2Gr69cc48Yb/mvjLpWroBygkHbK 1JCWo4KAyXd/3YdDNkI8NFps6feplf7DZV6qThyIENqAgqFVOGOG7jXZSnBdpU4zV1IE 2bPQ== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:dkim-signature; bh=vrsXd+bIvOt3zs7xld8Fn4DZIx7cnr+PjAHywJzUMzo=; b=Rr+hKKdpOgy6ZIDx58vgYJe9iqv5v80zl7nRRcIAZYw2PqWSZh4SjnY7RMH/Svv5ZE E1D7NSw8+tFwlp5uErmTtYAxKywZKfSzzx6J+/kSF2kHLvcdTsdSPGSj2hVm2aq2PSeN wv94v4YUchr/9kxGFGkoj8m/E9mNz5RUvdTzO2v3U9+gU6/86kn5/9vXn7ZQAbYE3IdR Oy+Es4AWwzhQNy8jbG9IY7/kiwveP3bxlEKGa9ZWDlH2bjTQGe6nseCmCsJMvOR7sTPO rNHuKuzoo89SdFs/9sGHlEgZvQ5zNR3Y7W5ptIwEWe2BTSyIdWMrZL/qgc2WJKvKZIf4 ysOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=wN6WLAEJ; dkim=neutral (no key) header.i=@suse.de header.b=QIU7xYDN; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fg6-20020a056402548600b0044edb6925a4si3627271edb.368.2022.09.07.09.23.36; Wed, 07 Sep 2022 09:24:02 -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=@suse.de header.s=susede2_rsa header.b=wN6WLAEJ; dkim=neutral (no key) header.i=@suse.de header.b=QIU7xYDN; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229652AbiIGQJP (ORCPT + 99 others); Wed, 7 Sep 2022 12:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230132AbiIGQJM (ORCPT ); Wed, 7 Sep 2022 12:09:12 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F21BAFD0B for ; Wed, 7 Sep 2022 09:09:06 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8C20320585; Wed, 7 Sep 2022 16:09:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1662566944; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vrsXd+bIvOt3zs7xld8Fn4DZIx7cnr+PjAHywJzUMzo=; b=wN6WLAEJiWw+RJdC6PceDP7mhQbvHHUMCQ/rNYisyZ9oyjsJCEdAq6tWgiqNvBt8MHiJwa I18skYmmRVbWdv+GgrpRovBEDbz4f0Jga0bjAbaEHQD2DF2qfQKSrSX1TNsmQgDMO4B/WQ vMpDp3UFT7Y1ojPl3qZ0PswP3KtwDdg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1662566944; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vrsXd+bIvOt3zs7xld8Fn4DZIx7cnr+PjAHywJzUMzo=; b=QIU7xYDNrn2poUZutLzb1YhkmZZ4nFpwBDW+wukE76KZDWunx7eLSCe8cPuqSEdHoJ2LHb xNwL+GthjA96ogBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6856013486; Wed, 7 Sep 2022 16:09:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eUDoFyDCGGODawAAMHmgww (envelope-from ); Wed, 07 Sep 2022 16:09:04 +0000 Date: Wed, 7 Sep 2022 18:09:03 +0200 From: Jean Delvare To: Andy Shevchenko Cc: LKML , Linus Torvalds Subject: Re: [PATCH] firmware: dmi: Fortify entry point length checks Message-ID: <20220907180903.5a14d3c4@endymion.delvare> In-Reply-To: References: <20220907103041.0a88d5c4@endymion.delvare> <20220907172146.72460eda@endymion.delvare> Organization: SUSE Linux X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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, 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, -- Jean Delvare SUSE L3 Support