Thread (5 messages) flat view 5 messages, 3 authors, 2018-02-26

Re: Fwd: Re: Kernel panic with 4.16-rc1 (and 4.16-rc2) running selftest

From: Matthew Wilcox <willy@infradead.org>
Date: 2018-02-24 01:15:31
Also in: lkml
Subsystem: library code, the rest, xarray · Maintainers: Andrew Morton, Linus Torvalds, Matthew Wilcox

Possibly related (same subject, not in this thread)

On Fri, Feb 23, 2018 Randy Dunlap wrote:
[add Matthew Wilcox; hopefully he can look/see]
Thanks, Randy.  I don't understand why nobody else thought to cc the
author of the patch that it was bisected to ...
On 02/23/2018 04:13 PM, Cong Wang wrote:
quoted
On Fri, Feb 23, 2018 at 3:27 PM, Cong Wang [off-list ref]
wrote:
quoted
quoted
On Fri, Feb 23, 2018 at 11:00 AM, Randy Dunlap [off-list ref]
wrote:
quoted
quoted
quoted
On 02/23/2018 08:05 AM, Khalid Aziz wrote:
quoted
Same selftest does not cause panic on 4.15. git bisect pointed to
commit 6ce711f2750031d12cec91384ac5cfa0a485b60a ("idr: Make 1-based IDRs
more efficient").
quoted
quoted
quoted
quoted
Kernel config is attached.
Looks like something horribly wrong with u32 key id idr...
Adding a few printk's, I got:

[   31.231560] requested handle = ffe00000
[   31.232426] allocated handle = 0
...
[   31.246475] requested handle = ffd00000
[   31.247555] allocated handle = 1


So the bug is here where we can't allocate a specific handle:

                        err = idr_alloc_u32(&tp_c->handle_idr, ht,
&handle,
quoted
                                            handle, GFP_KERNEL);
                        if (err) {
                                kfree(ht);
                                return err;
                        }
Please try this patch.  It fixes ffe00000, but there may be more things
tested that it may not work for.

Chris Mi, what happened to that set of testcases you promised to write
for me?
diff --git a/lib/idr.c b/lib/idr.c
index c98d77fcf393..10d9b8d47c33 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -36,8 +36,8 @@ int idr_alloc_u32(struct idr *idr, void *ptr, u32 *nextid,
 {
 	struct radix_tree_iter iter;
 	void __rcu **slot;
-	int base = idr->idr_base;
-	int id = *nextid;
+	unsigned int base = idr->idr_base;
+	unsigned int id = *nextid;
 
 	if (WARN_ON_ONCE(radix_tree_is_internal_node(ptr)))
 		return -EINVAL;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help