Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935006AbcJSCD4 (ORCPT ); Tue, 18 Oct 2016 22:03:56 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:33926 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755235AbcJSCDs (ORCPT ); Tue, 18 Oct 2016 22:03:48 -0400 From: Kyle Huey X-Google-Original-From: Kyle Huey To: "Robert O'Callahan" , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Jeff Dike , Richard Weinberger , Andy Lutomirski , Borislav Petkov , Dmitry Safonov , Peter Zijlstra , Dave Hansen , Boris Ostrovsky , Alexander Viro , Shuah Khan , "Rafael J. Wysocki" , Len Brown Cc: linux-kernel@vger.kernel.org, user-mode-linux-devel@lists.sourceforge.net, user-mode-linux-user@lists.sourceforge.net, linux-kselftest@vger.kernel.org, linux-api@vger.kernel.org Subject: [PATCH v7 0/6] x86/arch_prctl Add ARCH_[GET|SET]_CPUID for controlling the CPUID instruction Date: Tue, 18 Oct 2016 19:03:27 -0700 Message-Id: <20161019020333.3766-1-khuey@kylehuey.com> X-Mailer: git-send-email 2.10.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 967 Lines: 26 rr (http://rr-project.org/), a userspace record-and-replay reverse- execution debugger, would like to trap and emulate the CPUID instruction. This would allow us to a) mask away certain hardware features that rr does not support (e.g. RDRAND) and b) enable trace portability across machines by providing constant results. Newer Intel CPUs (Ivy Bridge and later) can fault when CPUID is executed at CPL > 0. Expose this capability to userspace as a new pair of arch_prctls, ARCH_GET_CPUID and ARCH_SET_CPUID, with two values, ARCH_CPUID_ENABLE and ARCH_CPUID_SIGSEGV. v6 did not get any feedback, so I included the changes since v5. Since v6: - Rebased to 4.9-rc1 (primarily over the new VDSO arch_prctls and the new pkey entries in the syscall table) Since v5: Patch 3: - do_arch_prctl is again do_arch_prctl_common Patch 6: - Added static qualifiers on get/set_cpuid_mode - Braced ifs in disable/enable_cpuid - Renamed arch_post_exec to arch_setup_new_exec