Commit-ID:  ed40a10431701d683bfd59f7ca01a8c97408cf67
Gitweb:     https://git.kernel.org/tip/ed40a10431701d683bfd59f7ca01a8c97408cf67
Author:     Ricardo Neri <[email protected]>
AuthorDate: Fri, 27 Oct 2017 13:25:31 -0700
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 1 Nov 2017 21:50:08 +0100

uprobes/x86: Use existing definitions for segment override prefixes

Rather than using hard-coded values of the segment override prefixes,
leverage the existing definitions provided in inat.h.

Suggested-by: Borislav Petkov <[email protected]>
Signed-off-by: Ricardo Neri <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Borislav Petkov <[email protected]>
Cc: Srikar Dronamraju <[email protected]>
Cc: "Michael S. Tsirkin" <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: [email protected]
Cc: Paul Gortmaker <[email protected]>
Cc: Huang Rui <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Jonathan Corbet <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: "Ravi V. Shankar" <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: Chris Metcalf <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Chen Yucong <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Paolo Bonzini <[email protected]>
Cc: Andrew Morton <[email protected]>
Link: 
https://lkml.kernel.org/r/1509135945-13762-5-git-send-email-ricardo.neri-calde...@linux.intel.com

---
 arch/x86/kernel/uprobes.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
index 495c776..a3755d2 100644
--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -271,12 +271,15 @@ static bool is_prefix_bad(struct insn *insn)
        int i;
 
        for (i = 0; i < insn->prefixes.nbytes; i++) {
-               switch (insn->prefixes.bytes[i]) {
-               case 0x26:      /* INAT_PFX_ES   */
-               case 0x2E:      /* INAT_PFX_CS   */
-               case 0x36:      /* INAT_PFX_DS   */
-               case 0x3E:      /* INAT_PFX_SS   */
-               case 0xF0:      /* INAT_PFX_LOCK */
+               insn_attr_t attr;
+
+               attr = inat_get_opcode_attribute(insn->prefixes.bytes[i]);
+               switch (attr) {
+               case INAT_MAKE_PREFIX(INAT_PFX_ES):
+               case INAT_MAKE_PREFIX(INAT_PFX_CS):
+               case INAT_MAKE_PREFIX(INAT_PFX_DS):
+               case INAT_MAKE_PREFIX(INAT_PFX_SS):
+               case INAT_MAKE_PREFIX(INAT_PFX_LOCK):
                        return true;
                }
        }

Reply via email to