Russell King
32385c7cf6
kernel: fix hlist_bl again
...
__d_rehash is dereferencing an almost-NULL pointer on my ARM926.
CONFIG_SMP=n and CONFIG_DEBUG_SPINLOCK=y.
The faulting instruction is: strne r3, [r2, #4 ]
and as can be seen from the register dump below, r2 is 0x00000001, hence
the faulting 0x00000005 address.
__d_rehash is essentially:
spin_lock_bucket(b);
entry->d_flags &= ~DCACHE_UNHASHED;
hlist_bl_add_head_rcu(&entry->d_hash, &b->head);
spin_unlock_bucket(b);
which is:
bit_spin_lock(0, (unsigned long *)&b->head.first);
entry->d_flags &= ~DCACHE_UNHASHED;
hlist_bl_add_head_rcu(&entry->d_hash, &b->head);
__bit_spin_unlock(0, (unsigned long *)&b->head.first);
bit_spin_lock(0, ptr) sets bit 0 of *ptr, in this case b->head.first if
CONFIG_SMP or CONFIG_DEBUG_SPINLOCK is set:
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
while (unlikely(test_and_set_bit_lock(bitnum, addr))) {
while (test_bit(bitnum, addr)) {
preempt_enable();
cpu_relax();
preempt_disable();
}
}
#endif
So, b->head.first starts off NULL, and becomes a non-NULL (address 1).
hlist_bl_add_head_rcu() does this:
static inline void hlist_bl_add_head_rcu(struct hlist_bl_node *n,
struct hlist_bl_head *h)
{
first = hlist_bl_first(h);
n->next = first;
if (first)
first->pprev = &n->next;
It is the store to first->pprev which is faulting.
hlist_bl_first():
static inline struct hlist_bl_node *hlist_bl_first(struct hlist_bl_head *h)
{
return (struct hlist_bl_node *)
((unsigned long)h->first & ~LIST_BL_LOCKMASK);
}
but:
#if defined(CONFIG_SMP)
#define LIST_BL_LOCKMASK 1UL
#else
#define LIST_BL_LOCKMASK 0UL
#endif
So, we have one piece of code which sets bit 0 of addresses, and another
bit of code which doesn't clear it before dereferencing the pointer if
!CONFIG_SMP && CONFIG_DEBUG_SPINLOCK. With the patch below, I can again
sucessfully boot the kernel on my Versatile PB/926 platform.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk >
2011-01-14 13:12:45 +00:00
..
2010-10-27 19:04:36 -07:00
2010-06-20 19:46:07 -07:00
2010-10-18 15:16:08 +02:00
2010-12-17 09:54:40 -08:00
2010-08-14 22:26:51 +02:00
2010-11-03 10:44:20 -07:00
2010-10-13 07:49:27 -07:00
2010-02-16 16:01:22 -08:00
2010-11-15 20:44:26 -05:00
2010-12-06 12:43:02 +00:00
2010-10-26 17:54:22 -07:00
2010-11-27 07:16:29 +09:00
2010-10-30 08:31:35 -07:00
2010-10-23 11:47:02 -07:00
2010-10-28 22:40:31 +01:00
2010-11-01 07:50:43 -04:00
2010-12-16 18:11:00 +00:00
2010-11-02 17:13:52 -04:00
2010-12-22 19:43:34 -08:00
2010-11-05 14:13:32 +02:00
2008-02-06 10:41:02 -08:00
2010-12-11 01:28:58 -05:00
2010-10-22 10:20:08 -07:00
2009-09-01 01:14:07 -07:00
2005-06-21 19:07:41 -07:00
2009-09-08 17:42:50 -07:00
2010-10-21 20:21:03 -04:00
2010-12-10 15:45:05 -08:00
2010-11-12 07:55:30 -08:00
2010-10-30 08:45:43 -04:00
2010-08-09 00:13:34 +02:00
2009-01-08 08:31:12 -08:00
2005-04-16 15:20:36 -07:00
2010-10-26 16:52:10 -07:00
2010-10-27 18:03:06 -07:00
2010-10-25 04:54:25 -04:00
2010-11-30 17:56:38 -08:00
2010-11-10 14:54:09 +01:00
2011-01-07 17:50:31 +11:00
2010-05-30 09:00:03 -07:00
2008-06-06 11:29:10 -07:00
2010-11-10 14:54:09 +01:00
2010-12-17 08:36:01 +01:00
2009-01-04 13:33:20 -08:00
2010-12-13 16:11:13 -08:00
2008-11-28 12:38:38 +01:00
2005-04-16 15:20:36 -07:00
2010-10-25 21:18:20 -04:00
2009-06-16 19:47:48 -07:00
2010-03-03 11:25:58 +01:00
2010-08-02 15:34:57 +10:00
2009-06-11 21:36:09 -04:00
2005-04-16 15:20:36 -07:00
2009-01-30 23:44:08 +05:30
2009-12-03 19:28:51 +01:00
2010-10-27 18:03:09 -07:00
2009-01-30 23:44:41 +05:30
2010-03-24 16:31:22 -07:00
2010-07-27 12:40:55 +02:00
2010-12-20 09:07:35 -08:00
2005-04-16 15:20:36 -07:00
2010-10-25 08:02:40 -07:00
2011-01-07 17:50:29 +11:00
2010-10-25 08:02:40 -07:00
2010-05-25 08:07:00 -07:00
2010-09-14 16:08:45 -07:00
2007-10-17 08:42:47 -07:00
2010-08-19 17:17:59 -07:00
2010-10-26 17:32:41 -07:00
2005-04-16 15:20:36 -07:00
2010-10-24 14:20:01 -07:00
2010-08-10 13:47:42 -07:00
2008-01-30 13:32:42 +01:00
2010-08-08 14:55:26 -04:00
2010-11-10 16:57:11 -08:00
2010-09-30 21:19:22 -04:00
2010-05-19 22:03:14 +03:00
2005-04-16 15:20:36 -07:00
2011-01-07 17:50:32 +11:00
2010-10-28 10:27:00 -07:00
2010-08-17 09:11:10 +02:00
2010-05-19 22:41:57 -04:00
2010-08-04 11:00:45 +02:00
2010-03-30 22:02:32 +09:00
2010-10-22 10:16:43 -07:00
2007-05-08 11:15:26 -07:00
2010-09-22 17:22:38 -07:00
2011-01-03 01:41:40 -08:00
2007-02-09 17:39:36 -05:00
2010-11-26 09:57:36 +01:00
2009-11-04 09:50:58 -08:00
2010-10-14 18:38:42 +02:00
2010-10-22 15:55:22 +02:00
2010-10-22 17:03:12 -07:00
2009-01-30 23:46:40 +05:30
2010-10-24 22:06:02 +02:00
2010-05-17 10:00:15 +02:00
2010-05-25 08:07:02 -07:00
2009-11-04 09:50:58 -08:00
2010-09-23 14:33:39 -07:00
2010-10-21 01:26:54 -07:00
2010-01-25 12:26:38 -02:00
2010-10-23 09:24:34 +09:00
2010-12-15 13:56:33 -05:00
2010-11-17 14:55:45 +09:00
2008-10-09 08:56:19 +02:00
2008-11-20 20:29:48 -08:00
2010-05-24 00:36:13 -07:00
2010-03-06 11:26:25 -08:00
2010-05-21 09:37:28 -07:00
2010-08-09 20:45:09 -07:00
2009-12-17 10:58:17 -05:00
2011-01-07 17:50:27 +11:00
2008-08-23 12:14:12 -07:00
2011-01-07 17:50:31 +11:00
2010-07-11 22:22:23 +02:00
2010-10-22 10:22:17 -07:00
2010-11-15 13:49:51 +09:00
2011-01-07 17:50:23 +11:00
2011-01-07 17:50:23 +11:00
2010-07-12 14:41:40 +02:00
2011-01-07 17:50:29 +11:00
2009-01-02 10:19:38 -08:00
2010-10-24 22:06:02 +02:00
2006-09-30 01:47:55 +02:00
2010-12-06 23:52:08 +01:00
2010-12-06 17:15:15 -08:00
2010-10-25 14:11:37 -07:00
2010-11-18 10:56:29 -08:00
2008-02-06 10:41:00 -08:00
2009-06-26 10:48:34 +02:00
2010-10-23 22:49:32 +02:00
2010-09-24 14:03:44 +02:00
2009-01-04 01:00:51 +01:00
2010-11-12 07:55:30 -08:00
2006-04-26 12:56:16 +01:00
2010-03-07 22:17:09 +01:00
2010-11-12 14:51:55 +01:00
2010-11-15 22:40:38 +01:00
2010-11-15 22:40:38 +01:00
2007-01-30 08:26:45 -08:00
2010-10-26 17:40:56 -07:00
2009-11-04 09:50:58 -08:00
2010-08-24 14:46:53 -07:00
2010-11-12 12:30:57 -08:00
2010-02-02 07:32:29 -08:00
2008-08-02 18:36:10 +01:00
2008-07-09 12:09:28 -04:00
2010-10-27 18:03:12 -07:00
2010-10-22 10:21:26 -07:00
2010-12-14 23:55:21 -08:00
2010-10-27 18:48:00 -07:00
2010-10-26 16:52:08 -07:00
2006-10-05 15:10:12 +01:00
2010-11-11 13:40:11 +01:00
2005-04-16 15:20:36 -07:00
2010-12-17 10:01:09 -08:00
2010-10-04 22:45:24 +09:00
2010-03-12 15:52:40 -08:00
2009-04-21 13:41:48 -07:00
2006-10-04 00:31:09 -07:00
2009-01-30 23:59:44 +05:30
2010-10-26 10:33:27 +02:00
2010-10-28 11:58:39 +02:00
2010-10-27 21:25:12 -04:00
2010-08-10 11:49:21 -07:00
2010-05-20 23:05:28 -07:00
2010-10-29 14:45:29 -04:00
2010-10-28 17:22:13 -04:00
2010-10-22 15:34:12 -05:00
2007-07-31 15:39:40 -07:00
2007-04-04 21:12:47 -07:00
2010-10-27 18:03:13 -07:00
2009-12-16 12:19:59 +01:00
2010-11-15 13:37:37 -08:00
2010-02-16 16:01:21 -08:00
2010-08-19 17:18:00 -07:00
2009-09-02 21:29:22 +10:00
2010-10-27 18:03:18 -07:00
2010-10-29 13:14:41 -05:00
2009-12-31 19:45:04 +00:00
2010-10-22 10:16:44 -07:00
2010-05-21 09:37:29 -07:00
2010-12-22 10:27:53 +01:00
2010-10-24 12:47:25 -07:00
2010-10-24 10:50:49 +02:00
2010-10-24 10:52:19 +02:00
2005-04-16 15:20:36 -07:00
2010-11-12 07:55:32 -08:00
2010-11-12 07:55:32 -08:00
2010-11-12 07:55:32 -08:00
2010-11-16 13:33:23 -08:00
2009-09-17 23:23:45 -07:00
2007-07-17 10:23:03 -07:00
2009-06-16 19:47:57 -07:00
2010-10-25 14:11:39 -07:00
2011-01-14 13:12:45 +00:00
2010-10-25 21:24:15 -04:00
2008-02-06 10:41:03 -08:00
2009-04-28 07:37:28 +02:00
2010-06-16 18:03:15 +02:00
2010-10-28 09:08:47 -05:00
2008-12-29 04:59:31 -08:00
2009-02-27 16:07:32 +09:00
2010-11-22 08:34:23 -08:00
2010-10-26 16:52:19 -07:00
2010-08-09 16:48:45 -04:00
2008-03-27 14:51:39 -04:00
2007-05-09 12:30:49 -07:00
2010-08-11 08:59:19 -07:00
2010-12-02 14:51:15 -08:00
2010-10-22 10:16:44 -07:00
2009-09-22 07:17:35 -07:00
2009-01-09 16:54:41 -08:00
2009-06-16 08:40:20 +02:00
2009-09-22 07:17:37 -07:00
2010-10-26 16:52:05 -07:00
2010-10-26 16:52:09 -07:00
2010-08-09 20:44:58 -07:00
2010-10-28 09:02:15 -07:00
2010-10-26 16:52:07 -07:00
2010-05-21 17:15:44 -07:00
2010-11-24 15:21:11 +10:30
2009-01-05 08:40:13 +10:30
2010-10-26 16:52:13 -07:00
2011-01-07 17:50:33 +11:00
2009-04-01 07:38:54 -04:00
2006-11-30 04:40:22 +01:00
2010-10-03 21:50:53 -07:00
2008-06-06 11:29:12 -07:00
2010-10-12 16:53:34 +02:00
2008-02-13 16:21:18 -08:00
2011-01-07 17:50:27 +11:00
2011-01-07 17:50:19 +11:00
2011-01-07 17:50:26 +11:00
2010-11-08 12:17:07 -08:00
2010-11-12 08:26:06 +01:00
2010-12-17 12:03:14 -08:00
2010-10-26 09:55:25 -07:00
2010-10-24 18:07:10 -04:00
2011-01-07 17:50:29 +11:00
2010-12-07 23:02:44 -05:00
2010-11-22 13:24:48 -05:00
2010-10-23 09:24:39 +09:00
2010-11-10 16:57:11 -08:00
2010-08-19 17:18:02 -07:00
2009-03-31 23:00:27 -04:00
2010-10-21 11:10:10 -06:00
2010-08-06 09:25:50 -06:00
2010-08-11 08:59:19 -07:00
2010-11-25 06:50:40 +09:00
2009-04-01 08:59:13 -07:00
2010-10-25 16:10:15 +02:00
2010-10-26 16:52:05 -07:00
2010-10-26 16:52:09 -07:00
2005-04-16 15:20:36 -07:00
2008-10-13 10:10:37 -07:00
2011-01-07 17:50:33 +11:00
2010-02-22 16:15:17 -08:00
2010-11-29 14:36:33 -08:00
2010-10-27 21:30:13 -04:00
2010-10-27 17:53:25 +02:00
2010-10-22 17:31:36 -07:00
2010-12-08 20:14:08 +01:00
2005-04-16 15:20:36 -07:00
2008-01-23 19:33:58 -06:00
2010-10-24 15:07:11 -07:00
2009-01-08 08:31:12 -08:00
2009-01-08 08:31:12 -08:00
2009-02-14 22:58:35 -08:00
2010-11-28 16:27:19 -08:00
2010-10-22 10:16:42 -07:00
2010-12-16 17:12:25 +01:00
2010-10-17 01:57:48 +02:00
2010-10-27 18:03:18 -07:00
2011-01-07 17:50:29 +11:00
2006-10-03 23:01:26 +02:00
2008-06-11 21:00:38 -07:00
2009-06-18 13:04:04 -07:00
2009-07-29 19:10:36 -07:00
2009-10-04 03:23:17 +02:00
2010-11-15 13:37:37 -08:00
2010-10-27 18:03:10 -07:00
2010-11-12 07:55:33 -08:00
2008-09-02 19:21:38 -07:00
2010-11-12 07:55:32 -08:00
2010-02-08 18:19:41 -06:00
2010-10-29 04:16:31 -04:00
2010-10-27 18:03:18 -07:00
2010-10-26 16:52:16 -07:00
2009-06-11 08:51:08 -07:00
2011-01-14 02:36:43 +00:00
2010-09-08 18:16:55 -07:00
2008-01-30 13:31:47 +01:00
2010-11-17 08:59:32 -08:00
2011-01-07 17:50:29 +11:00
2009-09-24 07:20:57 -07:00
2010-11-12 07:55:30 -08:00
2010-10-20 13:37:56 -04:00
2010-10-27 18:03:16 -07:00
2010-10-27 18:03:16 -07:00
2010-10-27 18:03:16 -07:00
2010-10-26 16:52:09 -07:00
2009-04-17 20:37:21 -07:00
2010-03-12 15:52:28 -08:00
2010-03-12 15:53:10 -08:00
2010-11-15 11:29:30 -08:00
2010-03-13 01:21:21 +01:00
2009-07-31 12:28:45 +02:00
2006-04-26 12:56:16 +01:00
2010-12-08 20:15:04 +01:00
2009-04-19 10:47:45 -07:00
2009-10-30 08:27:25 +11:00
2011-01-07 17:50:27 +11:00
2010-10-22 10:20:06 -07:00
2010-05-27 09:12:49 -07:00
2010-10-30 12:12:50 +02:00
2010-02-22 15:45:54 -08:00
2011-01-07 17:50:27 +11:00
2008-02-07 08:42:34 -08:00
2010-10-22 10:20:10 -07:00
2010-10-25 13:46:56 -07:00
2010-08-10 13:47:46 -07:00
2010-09-03 17:29:04 -07:00
2006-04-26 12:56:16 +01:00
2010-11-15 18:48:25 +09:00
2010-11-09 16:38:20 +09:00
2010-10-31 10:40:39 -04:00
2010-10-20 03:02:23 -07:00
2011-01-07 17:50:16 +11:00
2010-11-17 14:58:36 -08:00
2010-10-27 17:28:36 +01:00
2010-12-08 12:16:33 -08:00
2010-10-28 11:47:52 -07:00
2005-04-16 15:20:36 -07:00
2009-12-14 23:55:33 +01:00
2009-12-14 23:55:32 +01:00
2010-05-21 21:12:40 +02:00
2008-05-26 16:15:32 +02:00
2009-06-12 23:04:12 +02:00
2006-12-07 02:14:08 +01:00
2007-05-08 11:15:18 -07:00
2010-10-14 08:55:28 +02:00
2010-01-14 22:38:09 -05:00
2009-04-10 15:48:52 +02:00
2010-10-26 16:52:05 -07:00
2010-10-27 18:03:14 -07:00
2005-04-16 15:20:36 -07:00
2010-10-27 18:03:10 -07:00
2010-03-07 17:04:47 -08:00
2010-10-17 01:57:44 +02:00
2010-03-30 22:02:32 +09:00
2010-12-22 19:43:34 -08:00
2010-05-19 11:36:34 +03:00
2008-10-13 09:51:40 -07:00
2010-05-27 09:12:51 -07:00
2010-05-09 19:35:27 +02:00
2010-08-03 09:48:45 -04:00
2009-02-18 15:37:53 -08:00
2010-10-21 04:11:07 -07:00
2009-10-29 11:17:40 +11:00
2009-02-26 18:44:06 +01:00
2010-10-27 18:03:12 -07:00
2010-10-22 10:20:04 -07:00
2010-12-02 12:58:16 -08:00
2010-10-26 16:52:03 -07:00
2010-11-10 16:57:11 -08:00
2010-10-22 10:22:05 -07:00
2010-11-22 12:55:02 +02:00
2009-11-29 22:03:04 +01:00
2005-04-16 15:20:36 -07:00
2007-12-26 19:36:35 -08:00
2010-01-15 01:43:29 -08:00
2010-12-11 02:01:35 -05:00
2009-03-30 12:43:15 -03:00
2010-10-27 18:03:18 -07:00
2010-05-19 22:15:46 +09:30
2010-12-02 14:51:15 -08:00
2006-04-26 12:56:16 +01:00
2010-03-19 07:17:52 -07:00
2010-10-26 16:52:14 -07:00
2010-10-30 09:05:48 -07:00