* [PATCH] x86: mm: introduce helper function in fault.c
@ 2009-02-04 23:24 Hiroshi Shimamoto
2009-02-05 0:15 ` H. Peter Anvin
0 siblings, 1 reply; 6+ messages in thread
From: Hiroshi Shimamoto @ 2009-02-04 23:24 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel
From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Impact: cleanup
Introduce helper function fault_in_kernel_address() to make editors happy.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
arch/x86/mm/fault.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index bfac289..27ec123 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -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;
--
1.6.1.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] x86: mm: introduce helper function in fault.c
2009-02-04 23:24 [PATCH] x86: mm: introduce helper function in fault.c Hiroshi Shimamoto
@ 2009-02-05 0:15 ` H. Peter Anvin
2009-02-05 0:19 ` Ingo Molnar
0 siblings, 1 reply; 6+ messages in thread
From: H. Peter Anvin @ 2009-02-05 0:15 UTC (permalink / raw)
To: Hiroshi Shimamoto; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel
Hiroshi Shimamoto wrote:
> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>
> Impact: cleanup
>
> Introduce helper function fault_in_kernel_address() to make editors happy.
>
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Applied to tip:x86/mm, however, I had to apply the patch manually.
-hpa
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86: mm: introduce helper function in fault.c
2009-02-05 0:15 ` H. Peter Anvin
@ 2009-02-05 0:19 ` Ingo Molnar
2009-02-05 0:21 ` H. Peter Anvin
0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2009-02-05 0:19 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: Hiroshi Shimamoto, Thomas Gleixner, linux-kernel
* H. Peter Anvin <hpa@zytor.com> wrote:
> Hiroshi Shimamoto wrote:
>> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>>
>> Impact: cleanup
>>
>> Introduce helper function fault_in_kernel_address() to make editors happy.
>>
>> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86: mm: introduce helper function in fault.c
2009-02-05 0:19 ` Ingo Molnar
@ 2009-02-05 0:21 ` H. Peter Anvin
2009-02-05 0:24 ` Ingo Molnar
0 siblings, 1 reply; 6+ messages in thread
From: H. Peter Anvin @ 2009-02-05 0:21 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Hiroshi Shimamoto, Thomas Gleixner, linux-kernel
Ingo Molnar wrote:
> * H. Peter Anvin <hpa@zytor.com> wrote:
>
>> Hiroshi Shimamoto wrote:
>>> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>>>
>>> Impact: cleanup
>>>
>>> Introduce helper function fault_in_kernel_address() to make editors happy.
>>>
>>> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86: mm: introduce helper function in fault.c
2009-02-05 0:21 ` H. Peter Anvin
@ 2009-02-05 0:24 ` Ingo Molnar
2009-02-05 0:37 ` Hiroshi Shimamoto
0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2009-02-05 0:24 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: Hiroshi Shimamoto, Thomas Gleixner, linux-kernel
* H. Peter Anvin <hpa@zytor.com> wrote:
> Ingo Molnar wrote:
>> * H. Peter Anvin <hpa@zytor.com> wrote:
>>
>>> Hiroshi Shimamoto wrote:
>>>> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>>>>
>>>> Impact: cleanup
>>>>
>>>> Introduce helper function fault_in_kernel_address() to make editors happy.
>>>>
>>>> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>>> 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.)
ok :) Hiroshi, please double-check the end result in tip:master if you have
some time.
Ingo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] x86: mm: introduce helper function in fault.c
2009-02-05 0:24 ` Ingo Molnar
@ 2009-02-05 0:37 ` Hiroshi Shimamoto
0 siblings, 0 replies; 6+ messages in thread
From: Hiroshi Shimamoto @ 2009-02-05 0:37 UTC (permalink / raw)
To: Ingo Molnar; +Cc: H. Peter Anvin, Thomas Gleixner, linux-kernel
Ingo Molnar wrote:
> * H. Peter Anvin <hpa@zytor.com> wrote:
>
>> Ingo Molnar wrote:
>>> * H. Peter Anvin <hpa@zytor.com> wrote:
>>>
>>>> Hiroshi Shimamoto wrote:
>>>>> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>>>>>
>>>>> Impact: cleanup
>>>>>
>>>>> Introduce helper function fault_in_kernel_address() to make editors happy.
>>>>>
>>>>> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>>>> 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.)
>
> ok :) Hiroshi, please double-check the end result in tip:master if you have
> some time.
OK, thanks. Will look at tip:master.
Hiroshi
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-02-05 0:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-04 23:24 [PATCH] x86: mm: introduce helper function in fault.c Hiroshi Shimamoto
2009-02-05 0:15 ` H. Peter Anvin
2009-02-05 0:19 ` Ingo Molnar
2009-02-05 0:21 ` H. Peter Anvin
2009-02-05 0:24 ` Ingo Molnar
2009-02-05 0:37 ` Hiroshi Shimamoto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox