Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756648Ab3DZQlW (ORCPT ); Fri, 26 Apr 2013 12:41:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1701 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751909Ab3DZQlU (ORCPT ); Fri, 26 Apr 2013 12:41:20 -0400 Date: Fri, 26 Apr 2013 18:38:02 +0200 From: Oleg Nesterov To: "H. Peter Anvin" Cc: Ingo Molnar , Linus Torvalds , Cyrill Gorcunov , Peter Zijlstra , Thomas Gleixner , David Miller , "Theodore Ts'o" , Linux Kernel Mailing List , the arch/x86 maintainers , Network Development , "linux-ext4@vger.kernel.org" , Fr??d??ric Weisbecker Subject: [PATCH v2] x86: make DR*_RESERVED unsigned long Message-ID: <20130426163802.GA30351@redhat.com> References: <20130424072630.GB1780@gmail.com> <20130424170702.GA1867@redhat.com> <5178282D.9030902@zytor.com> <20130425144818.GA25921@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130425144818.GA25921@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1814 Lines: 58 DR6_RESERVED and DR_CONTROL_RESERVED are used to clear the set bits in the "unsigned long" data, make them long to ensure that "&~" doesn't clear the upper bits. This is only cleanup, the usage of ~DR*_RESERVED is safe but doesn't look clean and the pattern is error prone. - do_debug: dr6 &= ~DR6_RESERVED; this also wrongly clears 32-63 bits. Fortunately these bits are reserved and must be zero. - ptrace_write_dr7: data &= ~DR_CONTROL_RESERVED; on __i386__ this mixes long/int but sizeof should be the same. Reported-by: Linus Torvalds Signed-off-by: Oleg Nesterov --- arch/x86/include/uapi/asm/debugreg.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/uapi/asm/debugreg.h b/arch/x86/include/uapi/asm/debugreg.h index 3c0874d..c0c1b89 100644 --- a/arch/x86/include/uapi/asm/debugreg.h +++ b/arch/x86/include/uapi/asm/debugreg.h @@ -15,7 +15,7 @@ are either reserved or not of interest to us. */ /* Define reserved bits in DR6 which are always set to 1 */ -#define DR6_RESERVED (0xFFFF0FF0) +#define DR6_RESERVED (0xFFFF0FF0UL) #define DR_TRAP0 (0x1) /* db0 */ #define DR_TRAP1 (0x2) /* db1 */ @@ -65,7 +65,7 @@ gdt or the ldt if we want to. I am not sure why this is an advantage */ #ifdef __i386__ -#define DR_CONTROL_RESERVED (0xFC00) /* Reserved by Intel */ +#define DR_CONTROL_RESERVED (0xFC00UL) /* Reserved by Intel */ #else #define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00UL) /* Reserved */ #endif -- 1.5.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/