lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181008233404.1909.37302.stgit@localhost.localdomain>
Date:   Mon, 08 Oct 2018 16:34:33 -0700
From:   Alexander Duyck <alexander.h.duyck@...ux.intel.com>
To:     linux-mm@...ck.org, akpm@...ux-foundation.org,
        dan.j.williams@...el.com
Cc:     pavel.tatashin@...rosoft.com, mhocko@...e.com,
        dave.jiang@...el.com, linux-nvdimm@...ts.01.org,
        linux-kernel@...r.kernel.org, dave.hansen@...el.com,
        jglisse@...hat.com, alexander.h.duyck@...ux.intel.com,
        logang@...tatee.com, mingo@...nel.org,
        kirill.shutemov@...ux.intel.com
Subject: [mm PATCH] memremap: Fix reference count for pgmap in
 devm_memremap_pages

In the earlier patch "mm: defer ZONE_DEVICE page initialization to the
point where we init pgmap" I had overlooked the reference count that was
being held per page on the pgmap. As a result on running the ndctl test
"create.sh" we would call into devm_memremap_pages_release and encounter
the following percpu reference count error and hang:
  WARNING: CPU: 30 PID: 0 at lib/percpu-refcount.c:155
  percpu_ref_switch_to_atomic_rcu+0xf3/0x120

This patch addresses that by performing an update for all of the device
PFNs in a single call. In my testing this seems to resolve the issue while
still allowing us to retain the improvements seen in memory initialization.

Reported-by: Dan Williams <dan.j.williams@...el.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@...ux.intel.com>
---
 kernel/memremap.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/memremap.c b/kernel/memremap.c
index 6ec81e0d7a33..9eced2cc9f94 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -218,6 +218,7 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap)
 	memmap_init_zone_device(&NODE_DATA(nid)->node_zones[ZONE_DEVICE],
 				align_start >> PAGE_SHIFT,
 				align_size >> PAGE_SHIFT, pgmap);
+	percpu_ref_get_many(pgmap->ref, pfn_end(pgmap) - pfn_first(pgmap));
 
 	devm_add_action(dev, devm_memremap_pages_release, pgmap);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ