Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5325411ybv; Tue, 11 Feb 2020 13:33:06 -0800 (PST) X-Google-Smtp-Source: APXvYqyJ/EYDWPPYmUC360GXe3NOcZsaldhyDDI0K9aqzEiaNHs4LE6iuJ5EJFReYLaDs70qDNIQ X-Received: by 2002:a05:6808:a11:: with SMTP id n17mr4067070oij.94.1581456786498; Tue, 11 Feb 2020 13:33:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581456786; cv=none; d=google.com; s=arc-20160816; b=cdW92wiZKlkYxfyLes7t8TenKQSrm0M+jkdli+Ql2MYfokgIo3l+QHWY2uWZReTPHy TC+HR1qljD9Re4qRTt7CIHhC1lkk1Ia88G3GzCeEifILSuNsP2USnV0Q7n7hG5QrNHu6 UZ+TsRA4jvOdvDfsZMB4u4PqDvZDDS3YPn8DbHH+Rz2/OnhZdsUg0NIg2oFbj4K7rxAN ep/2OyfzB/kT2xZpe7/z4WazfzF733+0C3YVFfBPDEMtD1aO4ztuO0nbJ0foIRZRqnIj 2C7x7nXAevpjLGgw74B5UcfnrYdVo9CQ/vm4r/MUAsKBapwR2T7ZvhZJvRyWYn4VecdR bvxQ== 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:dkim-signature; bh=79gSAJuHXd9FQgV8hkDXwq/zTEBL/3eyIbYBMFeVs/c=; b=h+iUTaCPUbksf3tzM4ZHSXcqmkk7w6p6OPQom2NOE92Rt8QJy+P2Crc/vNtiYjMnAB 2dTFi050FaVx3Elz3JHAwiNGxwI3yZmsVujG6JLSu0kHwDCLI/W7f7PJwmd8x3IFrtIW pOGI8HUDdrIQl2aows5qJhe+qPEb6kSsDcxYAjs7mzFu6gi0+3o2QNjl8DvFKWfjCn6y HulfJkOl7rlA5KXZpnBtevdX4fOyvtaD02KAWom9UHeU8zaVaHvMYzb3X8aFPZjUzSfj lurdeip8diiDuUMvFCtzvn1v8Zp5kyxXGYXzGpkHVrk3UgZQvmDp977W57PPG0YlJhMF maRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=UxHnwRmL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si2387399otn.216.2020.02.11.13.32.54; Tue, 11 Feb 2020 13:33:06 -0800 (PST) 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; dkim=pass header.i=@alien8.de header.s=dkim header.b=UxHnwRmL; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730176AbgBKSQH (ORCPT + 99 others); Tue, 11 Feb 2020 13:16:07 -0500 Received: from mail.skyhub.de ([5.9.137.197]:44084 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728951AbgBKSQG (ORCPT ); Tue, 11 Feb 2020 13:16:06 -0500 Received: from zn.tnic (p200300EC2F0955008CA74DB1104365B1.dip0.t-ipconnect.de [IPv6:2003:ec:2f09:5500:8ca7:4db1:1043:65b1]) (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 9B57F1EC0C9D; Tue, 11 Feb 2020 19:16:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1581444965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=79gSAJuHXd9FQgV8hkDXwq/zTEBL/3eyIbYBMFeVs/c=; b=UxHnwRmLLHcobz76VlQXvHRtcPfffcTdGfdsw2thwedsLEEXm3mS1ZhAJ/+e94jSLaK/om qbTgtlJ38DZM+jfpORVMmZZqIhOwwKiH8jbLzYIrNVldKUt1UYj1adSsEiBi+6UiHVkwBC oUHc2Ey+FWYuE/xEb72fxynDQ71N4wM= Date: Tue, 11 Feb 2020 19:15:59 +0100 From: Borislav Petkov To: Arvind Sankar Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Michael Matz Subject: Re: [PATCH v2] x86/boot: Use 32-bit (zero-extended) move for z_output_len Message-ID: <20200211181559.GI32279@zn.tnic> References: <20200211161739.GE32279@zn.tnic> <20200211173333.1722739-1-nivedita@alum.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200211173333.1722739-1-nivedita@alum.mit.edu> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 11, 2020 at 12:33:33PM -0500, Arvind Sankar wrote: > z_output_len is the size of the decompressed payload (i.e. vmlinux + > vmlinux.relocs) and is generated as an unsigned 32-bit quantity by > mkpiggy.c. > > The current movq $z_output_len, %r9 instruction generates a > sign-extended move to %r9. Using movl $z_output_len, %r9d will instead > zero-extend into %r9, which is appropriate for an unsigned 32-bit > quantity. This is also what we already do for z_input_len, the size of > the compressed payload. Yes, thanks. What I'll also add to this is the fact that init_size: .long INIT_SIZE # kernel initialization size where z_output_len participates in through INIT_SIZE is a 32-bit quantity determined by the ".long" so even if something made z_output_len bigger than 32-bit by explicitly using MOVABS so that it builds fine, you'd still get: arch/x86/boot/header.S: Assembler messages: arch/x86/boot/header.S:568: Warning: value 0x10103b000 truncated to 0x103b000 as a warning. Btw, while poking at this, we found out that the MOV really remains MOV and not MOVABS if gas doesn't know what the quantity behind the z_output_len symbol is, as it is a symbol assignment. Which, AFAIU, with ELF64 objects, it should be using 8-byte quantities in the symbol table to accommodate such assignments. But for some reason it doesn't. Anyway, Michael can correct me if I'm still imprecise here. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette