* [PATCH] mm/hmm: fix uninitialized use of 'entry' in hmm_vma_walk_pmd()
@ 2018-01-22 18:57 jglisse
2018-01-22 20:58 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: jglisse @ 2018-01-22 18:57 UTC (permalink / raw)
To: linux-mm; +Cc: linux-kernel, akpm, Ralph Campbell, Jérôme Glisse
From: Ralph Campbell <rcampbell@nvidia.com>
The variable 'entry' is used before being initialized in
hmm_vma_walk_pmd()
Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: JA(C)rA'me Glisse <jglisse@redhat.com>
---
mm/hmm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/hmm.c b/mm/hmm.c
index ea19742a5d60..979211c7ccc8 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -418,7 +418,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp,
}
if (!pte_present(pte)) {
- swp_entry_t entry;
+ swp_entry_t entry = pte_to_swp_entry(pte);
if (!non_swap_entry(entry)) {
if (hmm_vma_walk->fault)
@@ -426,8 +426,6 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp,
continue;
}
- entry = pte_to_swp_entry(pte);
-
/*
* This is a special swap entry, ignore migration, use
* device and report anything else as error.
--
2.14.3
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/hmm: fix uninitialized use of 'entry' in hmm_vma_walk_pmd()
2018-01-22 18:57 [PATCH] mm/hmm: fix uninitialized use of 'entry' in hmm_vma_walk_pmd() jglisse
@ 2018-01-22 20:58 ` Andrew Morton
2018-01-22 21:56 ` Jerome Glisse
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2018-01-22 20:58 UTC (permalink / raw)
To: jglisse; +Cc: linux-mm, linux-kernel, Ralph Campbell
On Mon, 22 Jan 2018 13:57:59 -0500 jglisse@redhat.com wrote:
> From: Ralph Campbell <rcampbell@nvidia.com>
>
> The variable 'entry' is used before being initialized in
> hmm_vma_walk_pmd()
>
> ...
>
> --- a/mm/hmm.c
> +++ b/mm/hmm.c
> @@ -418,7 +418,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp,
> }
>
> if (!pte_present(pte)) {
> - swp_entry_t entry;
> + swp_entry_t entry = pte_to_swp_entry(pte);
>
> if (!non_swap_entry(entry)) {
> if (hmm_vma_walk->fault)
> @@ -426,8 +426,6 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp,
> continue;
> }
>
> - entry = pte_to_swp_entry(pte);
> -
> /*
> * This is a special swap entry, ignore migration, use
> * device and report anything else as error.
Gee, how did that sneak through. gcc not clever enough...
I'll add a cc:stable to this, even though the changelog didn't tell us what
the runtime effects of the bug are. It should do so, so can you please
send us that description and I will add it, thanks.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/hmm: fix uninitialized use of 'entry' in hmm_vma_walk_pmd()
2018-01-22 20:58 ` Andrew Morton
@ 2018-01-22 21:56 ` Jerome Glisse
0 siblings, 0 replies; 3+ messages in thread
From: Jerome Glisse @ 2018-01-22 21:56 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm, linux-kernel, Ralph Campbell
On Mon, Jan 22, 2018 at 12:58:36PM -0800, Andrew Morton wrote:
> On Mon, 22 Jan 2018 13:57:59 -0500 jglisse@redhat.com wrote:
>
> > From: Ralph Campbell <rcampbell@nvidia.com>
> >
> > The variable 'entry' is used before being initialized in
> > hmm_vma_walk_pmd()
> >
> > ...
> >
> > --- a/mm/hmm.c
> > +++ b/mm/hmm.c
> > @@ -418,7 +418,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp,
> > }
> >
> > if (!pte_present(pte)) {
> > - swp_entry_t entry;
> > + swp_entry_t entry = pte_to_swp_entry(pte);
> >
> > if (!non_swap_entry(entry)) {
> > if (hmm_vma_walk->fault)
> > @@ -426,8 +426,6 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp,
> > continue;
> > }
> >
> > - entry = pte_to_swp_entry(pte);
> > -
> > /*
> > * This is a special swap entry, ignore migration, use
> > * device and report anything else as error.
>
> Gee, how did that sneak through. gcc not clever enough...
>
> I'll add a cc:stable to this, even though the changelog didn't tell us what
> the runtime effects of the bug are. It should do so, so can you please
> send us that description and I will add it, thanks.
>
No bad effect (beside performance hit) so !non_swap_entry(0) evaluate to
true which trigger a fault as if CPU was trying to access migrated memory
and migrate memory back from device memory to regular memory.
This function (hmm_vma_walk_pmd()) is call when device driver tries to
populate its own page table. For migrated memory it should not happen as
the device driver should already have populated its page table correctly
during the migration.
Only case i can think of is multi-GPU where a second GPU trigger migration
back to regular memory. Again this would just result in a performance hit,
nothing bad would happen.
(I will try to keep in mind to always add a more in depth analysis even
for small patch :))
Cheers,
Jerome
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-22 21:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 18:57 [PATCH] mm/hmm: fix uninitialized use of 'entry' in hmm_vma_walk_pmd() jglisse
2018-01-22 20:58 ` Andrew Morton
2018-01-22 21:56 ` Jerome Glisse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox