From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752278AbeAJUUr (ORCPT + 1 other); Wed, 10 Jan 2018 15:20:47 -0500 Received: from mail-it0-f48.google.com ([209.85.214.48]:35247 "EHLO mail-it0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751664AbeAJUUq (ORCPT ); Wed, 10 Jan 2018 15:20:46 -0500 X-Google-Smtp-Source: ACJfBotPnWzS1j5KNtTPmAgBL7DUZUxZdRIOvAVKc/DdBcJepyCbVMXP06O0KGBc5rEvXU7Y0R2SxwdrlLUH+7HLExM= MIME-Version: 1.0 In-Reply-To: <20180110200519.w7r367aqnjptgjbn@pd.tnic> References: <20180110003139.10531-1-andi@firstfloor.org> <1515568506.22302.72.camel@infradead.org> <1515578735.22302.91.camel@infradead.org> <20180110112815.mgciyf5acwacphkq@pd.tnic> <20180110200519.w7r367aqnjptgjbn@pd.tnic> From: Linus Torvalds Date: Wed, 10 Jan 2018 12:20:40 -0800 X-Google-Sender-Auth: bRdpNZhAlLkJEMKv_U3kIxHgAvc Message-ID: Subject: Re: [PATCH] x86/alternatives: Fix optimize_nops() checking To: Borislav Petkov Cc: David Woodhouse , Andi Kleen , Thomas Gleixner , "the arch/x86 maintainers" , Linux Kernel Mailing List , Paul Turner , Andrew Lutomirski , Peter Zijlstra , Tom Lendacky , Tim Chen , Greg Kroah-Hartman , Dave Hansen , Jiri Kosina , Andi Kleen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Wed, Jan 10, 2018 at 12:05 PM, Borislav Petkov wrote: > > I did this: > > alternative("", "xor %%rdi, %%rdi; .byte 0xe9; .long 2f; 2: jmp startup_64", X86_FEATURE_K8); No, that's not valid. That could never work anyway. The ".long 2f" would be the absolute address in the alternative section, but opcode E9 takes a relative 32-bit offset. So the error you get isn't because relocations wouldn't work in alternatives, it's because you tried to fit an absolute 64-biy value in a 32-bit relocation, and it was wrong _regardless_ of which section you were in. Linus