Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752414AbdHPWS2 (ORCPT ); Wed, 16 Aug 2017 18:18:28 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33174 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752266AbdHPWS1 (ORCPT ); Wed, 16 Aug 2017 18:18:27 -0400 Date: Thu, 17 Aug 2017 01:18:23 +0300 From: "Kirill A. Shutemov" To: Alexander Potapenko Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/boot/64: clang: use fixup_pointer() to access next_early_pgt Message-ID: <20170816221823.fzewgtfijqh4jfdn@node.shutemov.name> References: <20170816190808.131748-1-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170816190808.131748-1-glider@google.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 816 Lines: 22 On Wed, Aug 16, 2017 at 09:08:08PM +0200, Alexander Potapenko wrote: > __startup_64() is normally using fixup_pointer() to access globals in a > position-independent fashion. However |next_early_pgt| was accessed > directly, which wasn't guaranteed to work. > > Luckily GCC was generating a R_X86_64_PC32 PC-relative relocation for > |next_early_pgt|, but Clang emitted a R_X86_64_32S, which led to > accessing invalid memory and rebooting the kernel. Thanks for tracking this down. Acked-by: Kirill A. Shutemov > Cc: Kirill A. Shutemov > Cc: Dmitry Vyukov > Cc: Michael Davidson > Fixes: c88d71508e36 ("x86/boot/64: Rewrite startup_64() in C") Cc: # 4.12 -- Kirill A. Shutemov