From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753661AbbCEAcz (ORCPT ); Wed, 4 Mar 2015 19:32:55 -0500 Received: from mail-wg0-f51.google.com ([74.125.82.51]:37113 "EHLO mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750AbbCEAcy (ORCPT ); Wed, 4 Mar 2015 19:32:54 -0500 Date: Thu, 5 Mar 2015 01:32:49 +0100 From: Ingo Molnar To: Borislav Petkov Cc: X86 ML , Andy Lutomirski , LKML , Linus Torvalds Subject: Re: [PATCH v2 07/15] x86/lib/copy_user_64.S: Convert to ALTERNATIVE_2 Message-ID: <20150305003249.GB20449@gmail.com> References: <1424776497-3180-1-git-send-email-bp@alien8.de> <1424776497-3180-8-git-send-email-bp@alien8.de> <20150304062552.GA16111@gmail.com> <20150304090038.GB3233@pd.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150304090038.GB3233@pd.tnic> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Borislav Petkov wrote: > > 2) in the future: we could actually do a (limited) re-link of the > > kernel during bootup, and patch up the original copy_to_user call > > sites directly to one of the three variants. Alternatives patching > > done at the symbol level. Does current tooling allow something > > like this already? > > Well, I have a patchset which uses relocs to patch vmlinux at build > time. And that was the initial approach to this but you cannot know > which features a CPU supports until boot time so you have to boot. > > BUT(!), you can replace stuff like X86_FEATURE_ALWAYS at build time > already (this is the static_cpu_has_safe() stuff). I'll look into > that later and dust off my relocs pile. We could also do a (limited) relink during early bootup, as part of the alternatives patching pass in essence: for that we need to stick the relocation info into a section and put that into the vmlinux. Thanks, Ingo