Received: by 10.213.65.68 with SMTP id h4csp63280imn; Mon, 12 Mar 2018 06:50:31 -0700 (PDT) X-Google-Smtp-Source: AG47ELvIKm+RKYjgtwBpnOH0ppPZzTNhmDArIiaTv6Z3Vt6EVlsJ3rE2q9YquFuIhYe5rpgRaqAp X-Received: by 2002:a17:902:7d93:: with SMTP id a19-v6mr8398826plm.160.1520862631642; Mon, 12 Mar 2018 06:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520862631; cv=none; d=google.com; s=arc-20160816; b=lv0VGwBa5qvo/cgzsdtLZXQPzWMTLY1744csT9rl48A01ZJKP+BxtEwZMribs0vUFu zDGfN6fqxggazDD26VphLRU3b3NH2RvX8kqb79EvPYAYA73YUgZa2yxyRRDWWAhvWtJy Tk4GbyLjZ8oAUuV8YfmYuEgATPds6x13ajn3PyxUB80hl0zNOV/XfYjHQmvji4FI/xVr Pc/KKjgMVdGmBrJgzlLwclfmHGO4tineXw9RGxDQnWOoAz3yVhzcxvPDsxGvHdj+SSju ncjydbrdl8n/GDCi3y9l8kKIFy4TSAuRHRDy4Wd4IbYaGtAWTLVe8rjqnOZofFnxdVyh 7cCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=YoGQtekK7qYnIV5kXbGl33DDZifRbo+c73TYNQ/wfws=; b=G6/0MwrTqD6DQhjIDqbQUDIcjwYHJqLS8dLPPhSDv5Cp1MIMf9ikM3KUr/aunjT5K3 RGWgoOhgwjJKNG86jqLNxYhADGDUL/gETexrJLbcZhQISMM3Ey+CAmFtDipqETRxh007 Ao1MF8+csfCkXfJ23Rb14rCBmLpmheHvER2WXqSThcZcqCIaWGU3/4Lfmlg7I6Rktp6+ Z9SJJmKTxQH84CtLnfKyLM+eQ7DuHSse4M/6k2N6rWa5Qrl6bAeR5chUJ8FW6MtynYA2 KBpBv4KaL/uN8JxagV42/BRnTZkKp44T+twgPFB/ntQQIzz4uSsS7P3Zqv6eRSnz3Xz0 8TZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si5031299pgf.172.2018.03.12.06.50.16; Mon, 12 Mar 2018 06:50:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751878AbeCLNtO (ORCPT + 99 others); Mon, 12 Mar 2018 09:49:14 -0400 Received: from mail.skyhub.de ([5.9.137.197]:54432 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753AbeCLNtM (ORCPT ); Mon, 12 Mar 2018 09:49:12 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id MV7FGDTugUYl; Mon, 12 Mar 2018 14:49:11 +0100 (CET) Received: from pd.tnic (p200300EC2BC5BE00D8383C045719CF88.dip0.t-ipconnect.de [IPv6:2003:ec:2bc5:be00:d838:3c04:5719:cf88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 706031EC0136; Mon, 12 Mar 2018 14:49:11 +0100 (CET) Date: Mon, 12 Mar 2018 14:48:53 +0100 From: Borislav Petkov To: "Maciej S. Szmigiero" Cc: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] x86/microcode/AMD: check microcode file sanity before loading it Message-ID: <20180312134853.GD9431@pd.tnic> References: <787b0ecc-8c1a-3b5a-82e0-9840c7b7c595@maciej.szmigiero.name> <20180312095336.GB9431@pd.tnic> <20180312130653.GC9431@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 12, 2018 at 02:32:30PM +0100, Maciej S. Szmigiero wrote: > "microcode_amd.bin" in linux-firmware. That is the microcode container for all families < 0x15. And it *happens* to have 18 entries. So purely arbitrary: Equivalence table (magic: AMD, type: 0, length: 288 (0x120)) ============================================================ | inst_cpu | err_msk | err_cmp | eq_cpu | res | ========================================================== | 0x00100f80 | 0x00000000 | 0x00000000 | 0x1080 | 0x0000 | | 0x00100f81 | 0x00000000 | 0x00000000 | 0x1081 | 0x0000 | | 0x00100f62 | 0x00000000 | 0x00000000 | 0x1062 | 0x0000 | | 0x00100f23 | 0x00000000 | 0x00000000 | 0x1022 | 0x0000 | | 0x00100f43 | 0x00000000 | 0x00000000 | 0x1043 | 0x0000 | | 0x00100f91 | 0x00000000 | 0x00000000 | 0x1081 | 0x0000 | | 0x00100f2a | 0x00000000 | 0x00000000 | 0x1020 | 0x0000 | | 0x00100f63 | 0x00000000 | 0x00000000 | 0x1043 | 0x0000 | | 0x00100f42 | 0x00000000 | 0x00000000 | 0x1041 | 0x0000 | | 0x00300f10 | 0x00000000 | 0x00000000 | 0x3010 | 0x0000 | | 0x00200f31 | 0x00000000 | 0x00000000 | 0x2031 | 0x0000 | | 0x00100f52 | 0x00000000 | 0x00000000 | 0x1041 | 0x0000 | | 0x00100fa0 | 0x00000000 | 0x00000000 | 0x10a0 | 0x0000 | | 0x00100f53 | 0x00000000 | 0x00000000 | 0x1043 | 0x0000 | | 0x00100f22 | 0x00000000 | 0x00000000 | 0x1022 | 0x0000 | | 0x00500f10 | 0x00000000 | 0x00000000 | 0x5010 | 0x0000 | | 0x00500f20 | 0x00000000 | 0x00000000 | 0x5020 | 0x0000 | | 0x00000000 | 0x00000000 | 0x00000000 | 0x0000 | 0x0000 | > There is no problem raising this value in that (future) case. > As I wrote previously, currently the maximum used count is 18. There is a problem because not everyone can upgrade their kernels like you. Distros and big deployments can't just up and update their kernels at a whim just because you imposed an arbitrary limit which you determined would be ok. > Not really, since even in the existing code CONTAINER_HDR_SZ (12) gets > added to this size, then the sum is cast to a (signed) int. > If this value is negative then the file get rejected. That is a bug in install_equiv_cpu_table() - it should return unsigned int. > It can be changed to the current maximum across sizes for particular What is the "current maximum across sizes"? -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.