Skip to contentSkip to conversation

x86: mm: introduce helper function in fault.c

PATCH Applied Hiroshi Shimamoto 3 participants 6 messages Feb 4, 2009 – Feb 5, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: mm: introduce helper function in fault.c

From: Hiroshi Shimamoto <[email protected]>

Impact: cleanup

Introduce helper function fault_in_kernel_address() to make editors happy.

---
 arch/x86/mm/fault.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
arch/x86/mm/fault.c +10 -5
index bfac289..27ec123 100644
@@ -783,6 +783,15 @@ static inline int access_error(unsigned long error_code, int write,
 	return 0;
 }
 
+static int fault_in_kernel_space(unsigned long address)
+{
+#ifdef CONFIG_X86_32
+	return address >= TASK_SIZE;
+#else /* !CONFIG_X86_32 */
+	return address >= TASK_SIZE64;
+#endif /* CONFIG_X86_32 */
+}
+
 /*
  * This routine handles page faults.  It determines the address,
  * and the problem, and then passes it off to one of the appropriate
@@ -832,11 +841,7 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
 	 * (error_code & 4) == 0, and that the fault was not a
 	 * protection error (error_code & 9) == 0.
 	 */
-#ifdef CONFIG_X86_32
-	if (unlikely(address >= TASK_SIZE)) {
-#else
-	if (unlikely(address >= TASK_SIZE64)) {
-#endif
+	if (unlikely(fault_in_kernel_space(address))) {
 		if (!(error_code & (PF_RSVD | PF_USER | PF_PROT))) {
 			if (vmalloc_fault(address) >= 0)
 				return;
Signature · 1 line
1.6.1.2
#2 lore raw
Quoted 10 lines · H. Peter Anvin
Quoted 7 lines · Hiroshi Shimamoto

From: Hiroshi Shimamoto <[email protected]>

Impact: cleanup

Introduce helper function fault_in_kernel_address() to make editors happy.

Applied to tip:x86/mm, however, I had to apply the patch manually.

that's because the patch was against tip:master - so that's fine, we have some other topics that interact. (tip:core/locking in this case) I resolved the conflict in tip/master and pushed it out.

Ingo

#3 lore raw
Quoted 5 lines · Ingo Molnar
Quoted 3 lines · H. Peter Anvin
Quoted 2 lines · Hiroshi Shimamoto

From: Hiroshi Shimamoto <[email protected]>

Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

Impact: cleanup

Introduce helper function fault_in_kernel_address() to make editors happy.

Applied to tip:x86/mm, however, I had to apply the patch manually.

that's because the patch was against tip:master - so that's fine, we have some other topics that interact. (tip:core/locking in this case) I resolved the conflict in tip/master and pushed it out.

Of course. I mentioned it just as a warning for screwups on my part (in fact, I briefly pushed a totally bogus version since I had made an edit but forgotten to "git add" it.)

-hpa

#4 lore raw
Quoted 13 lines · H. Peter Anvin
Quoted 12 lines · Ingo Molnar
Quoted 9 lines · H. Peter Anvin
Quoted 7 lines · Hiroshi Shimamoto

From: Hiroshi Shimamoto <[email protected]>

Impact: cleanup

Introduce helper function fault_in_kernel_address() to make editors happy.

Applied to tip:x86/mm, however, I had to apply the patch manually.

Quoted 8 lines
Quoted 4 lines

that's because the patch was against tip:master - so that's fine, we have some other topics that interact. (tip:core/locking in this case) I resolved the conflict in tip/master and pushed it out.

Of course. I mentioned it just as a warning for screwups on my part (in fact, I briefly pushed a totally bogus version since I had made an edit but forgotten to "git add" it.)

ok :) Hiroshi, please double-check the end result in tip:master if you have some time.

Ingo

#5 lore raw
Quoted 18 lines · Ingo Molnar
Quoted 16 lines · H. Peter Anvin
Quoted 15 lines · Ingo Molnar
Quoted 9 lines · H. Peter Anvin
Quoted 7 lines · Hiroshi Shimamoto

From: Hiroshi Shimamoto <[email protected]>

Impact: cleanup

Introduce helper function fault_in_kernel_address() to make editors happy.

Applied to tip:x86/mm, however, I had to apply the patch manually.

that's because the patch was against tip:master - so that's fine, we have some other topics that interact. (tip:core/locking in this case) I resolved the conflict in tip/master and pushed it out.

Quoted 6 lines
Quoted 3 lines

Of course. I mentioned it just as a warning for screwups on my part (in fact, I briefly pushed a totally bogus version since I had made an edit but forgotten to "git add" it.)

ok :) Hiroshi, please double-check the end result in tip:master if you have some time.

OK, thanks. Will look at tip:master.

Hiroshi