All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mm, mm/hwpoison: fix unmap kernel 1:1 pages
@ 2022-02-07  7:52 luofei
  2022-02-07  8:14 ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: luofei @ 2022-02-07  7:52 UTC (permalink / raw)
  To: stable, tony.luck, bp, tglx, mingo, hpa, x86
  Cc: linux-edac, linux-kernel, luofei

Only unmap the page when the memory error is properly handled
by calling memory_failure(), not the other way around.

Fixes: 26f8c38bb466("x86/mm, mm/hwpoison: Don't unconditionally unmap kernel 1:1 pages")

Signed-off-by: luofei <luofei@unicloud.com>
Cc: stable@vger.kernel.org #v4.14
---
 arch/x86/kernel/cpu/mcheck/mce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 95c09db1bba2..d8399a689165 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -589,7 +589,7 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
 
 	if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) {
 		pfn = mce->addr >> PAGE_SHIFT;
-		if (memory_failure(pfn, MCE_VECTOR, 0))
+		if (!memory_failure(pfn, MCE_VECTOR, 0))
 			mce_unmap_kpfn(pfn);
 	}
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/mm, mm/hwpoison: fix unmap kernel 1:1 pages
  2022-02-07  7:52 [PATCH] x86/mm, mm/hwpoison: fix unmap kernel 1:1 pages luofei
@ 2022-02-07  8:14 ` Greg KH
  2022-02-07  9:35   ` Borislav Petkov
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2022-02-07  8:14 UTC (permalink / raw)
  To: luofei
  Cc: stable, tony.luck, bp, tglx, mingo, hpa, x86, linux-edac, linux-kernel

On Mon, Feb 07, 2022 at 02:52:42AM -0500, luofei wrote:
> Only unmap the page when the memory error is properly handled
> by calling memory_failure(), not the other way around.
> 
> Fixes: 26f8c38bb466("x86/mm, mm/hwpoison: Don't unconditionally unmap kernel 1:1 pages")

This commit is not in Linus's tree.  Please use the correct commit id.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/mm, mm/hwpoison: fix unmap kernel 1:1 pages
  2022-02-07  8:14 ` Greg KH
@ 2022-02-07  9:35   ` Borislav Petkov
  2022-02-07 10:00     ` Greg KH
       [not found]     ` <2a4b69472f034fc995a047c7ec945cd3@unicloud.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Borislav Petkov @ 2022-02-07  9:35 UTC (permalink / raw)
  To: Greg KH
  Cc: luofei, stable, tony.luck, tglx, mingo, hpa, x86, linux-edac,
	linux-kernel

On Mon, Feb 07, 2022 at 09:14:23AM +0100, Greg KH wrote:
> On Mon, Feb 07, 2022 at 02:52:42AM -0500, luofei wrote:
> > Only unmap the page when the memory error is properly handled
> > by calling memory_failure(), not the other way around.
> > 
> > Fixes: 26f8c38bb466("x86/mm, mm/hwpoison: Don't unconditionally unmap kernel 1:1 pages")
> 
> This commit is not in Linus's tree.  Please use the correct commit id.

I think he's trying to fix the backport:

see 26f8c38bb466c1a2d232d7609fb4bfb4bc121678 which is the stable tree backport:

@@ -582,7 +586,8 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
 
        if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) {
                pfn = mce->addr >> PAGE_SHIFT;
-               memory_failure(pfn, MCE_VECTOR, 0);
+               if (memory_failure(pfn, MCE_VECTOR, 0))
+                       mce_unmap_kpfn(pfn);
        }


vs the upstream commit:

fd0e786d9d09024f67bd71ec094b110237dc3840

@@ -590,7 +594,8 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
 
        if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) {
                pfn = mce->addr >> PAGE_SHIFT;
-               memory_failure(pfn, 0);
+               if (!memory_failure(pfn, 0))
+                       mce_unmap_kpfn(pfn);
        }
 
        return NOTIFY_OK;

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/mm, mm/hwpoison: fix unmap kernel 1:1 pages
  2022-02-07  9:35   ` Borislav Petkov
@ 2022-02-07 10:00     ` Greg KH
       [not found]     ` <2a4b69472f034fc995a047c7ec945cd3@unicloud.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2022-02-07 10:00 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: luofei, stable, tony.luck, tglx, mingo, hpa, x86, linux-edac,
	linux-kernel

On Mon, Feb 07, 2022 at 10:35:41AM +0100, Borislav Petkov wrote:
> On Mon, Feb 07, 2022 at 09:14:23AM +0100, Greg KH wrote:
> > On Mon, Feb 07, 2022 at 02:52:42AM -0500, luofei wrote:
> > > Only unmap the page when the memory error is properly handled
> > > by calling memory_failure(), not the other way around.
> > > 
> > > Fixes: 26f8c38bb466("x86/mm, mm/hwpoison: Don't unconditionally unmap kernel 1:1 pages")
> > 
> > This commit is not in Linus's tree.  Please use the correct commit id.
> 
> I think he's trying to fix the backport:
> 
> see 26f8c38bb466c1a2d232d7609fb4bfb4bc121678 which is the stable tree backport:
> 
> @@ -582,7 +586,8 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
>  
>         if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) {
>                 pfn = mce->addr >> PAGE_SHIFT;
> -               memory_failure(pfn, MCE_VECTOR, 0);
> +               if (memory_failure(pfn, MCE_VECTOR, 0))
> +                       mce_unmap_kpfn(pfn);
>         }
> 
> 
> vs the upstream commit:
> 
> fd0e786d9d09024f67bd71ec094b110237dc3840
> 
> @@ -590,7 +594,8 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
>  
>         if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) {
>                 pfn = mce->addr >> PAGE_SHIFT;
> -               memory_failure(pfn, 0);
> +               if (!memory_failure(pfn, 0))
> +                       mce_unmap_kpfn(pfn);
>         }
>  
>         return NOTIFY_OK;
> 

Ah, ok, if so, this needs to be documented really really well in the
changelog text so no one is confused.  Like me :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 答复: [PATCH] x86/mm, mm/hwpoison: fix unmap kernel 1:1 pages
       [not found]     ` <2a4b69472f034fc995a047c7ec945cd3@unicloud.com>
@ 2022-02-07 10:18       ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2022-02-07 10:18 UTC (permalink / raw)
  To: 罗飞
  Cc: Borislav Petkov, stable, tony.luck, tglx, mingo, hpa, x86,
	linux-edac, linux-kernel

On Mon, Feb 07, 2022 at 10:03:29AM +0000, 罗飞 wrote:
> >I think he's trying to fix the backport:
> >
> >see 26f8c38bb466c1a2d232d7609fb4bfb4bc121678 which is the stable tree backport:
> >
> >@@ -582,7 +586,8 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
> >
> >       if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) {
> >               pfn = mce->addr >> PAGE_SHIFT;
> >-               memory_failure(pfn, MCE_VECTOR, 0);
> >+               if (memory_failure(pfn, MCE_VECTOR, 0))
> >+                       mce_unmap_kpfn(pfn);
>  >       }
> >
> >
> >vs the upstream commit:
> >
> >fd0e786d9d09024f67bd71ec094b110237dc3840
> >
> >@@ -590,7 +594,8 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
> >
> >        if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) {
> >               pfn = mce->addr >> PAGE_SHIFT;
> >-               memory_failure(pfn, 0);
> >+               if (!memory_failure(pfn, 0))
> >+                       mce_unmap_kpfn(pfn);
> >       }
> >
> >        return NOTIFY_OK;
> 
> 
> Sorry for my not familiar with submitting patches to stable kernel tree, and here Borislav Petkov said exactly what I meant

Great, can you please resend this and document what this patch is doing
and why it is not in upstream and why is it needed only in this one
branch?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/mm, mm/hwpoison: fix unmap kernel 1:1 pages
  2022-02-07  7:50 luofei
@ 2022-02-07  8:17 ` Greg KH
  0 siblings, 0 replies; 7+ messages in thread
From: Greg KH @ 2022-02-07  8:17 UTC (permalink / raw)
  To: luofei; +Cc: stable

On Mon, Feb 07, 2022 at 02:50:23AM -0500, luofei wrote:
> Only unmap the page when the memory error is properly handled
> by calling memory_failure(), not the other way around.
> 
> Fixes: 26f8c38bb466("x86/mm, mm/hwpoison: Don't unconditionally unmap kernel 1:1 pages")
> 
> Signed-off-by: luofei <luofei@unicloud.com>
> Cc: stable@vger.kernel.org #v4.14
> ---
>  arch/x86/kernel/cpu/mcheck/mce.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index 95c09db1bba2..d8399a689165 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -589,7 +589,7 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
>  
>  	if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) {
>  		pfn = mce->addr >> PAGE_SHIFT;
> -		if (memory_failure(pfn, MCE_VECTOR, 0))
> +		if (!memory_failure(pfn, MCE_VECTOR, 0))
>  			mce_unmap_kpfn(pfn);
>  	}
>  
> -- 
> 2.27.0
> 

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] x86/mm, mm/hwpoison: fix unmap kernel 1:1 pages
@ 2022-02-07  7:50 luofei
  2022-02-07  8:17 ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: luofei @ 2022-02-07  7:50 UTC (permalink / raw)
  To: luofei; +Cc: stable

Only unmap the page when the memory error is properly handled
by calling memory_failure(), not the other way around.

Fixes: 26f8c38bb466("x86/mm, mm/hwpoison: Don't unconditionally unmap kernel 1:1 pages")

Signed-off-by: luofei <luofei@unicloud.com>
Cc: stable@vger.kernel.org #v4.14
---
 arch/x86/kernel/cpu/mcheck/mce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 95c09db1bba2..d8399a689165 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -589,7 +589,7 @@ static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
 
 	if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) {
 		pfn = mce->addr >> PAGE_SHIFT;
-		if (memory_failure(pfn, MCE_VECTOR, 0))
+		if (!memory_failure(pfn, MCE_VECTOR, 0))
 			mce_unmap_kpfn(pfn);
 	}
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-02-07 10:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07  7:52 [PATCH] x86/mm, mm/hwpoison: fix unmap kernel 1:1 pages luofei
2022-02-07  8:14 ` Greg KH
2022-02-07  9:35   ` Borislav Petkov
2022-02-07 10:00     ` Greg KH
     [not found]     ` <2a4b69472f034fc995a047c7ec945cd3@unicloud.com>
2022-02-07 10:18       ` 答复: " Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2022-02-07  7:50 luofei
2022-02-07  8:17 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.