mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, Dave Jones <davej@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: lockdep: Warning & NULL ptr deref
Date: Tue, 28 Feb 2012 14:29:42 +0100	[thread overview]
Message-ID: <1330435782.11248.89.camel@twins> (raw)
In-Reply-To: <1330442692.3719.7.camel@lappy>

On Tue, 2012-02-28 at 10:24 -0500, Sasha Levin wrote:
> 
> I'll send some patches to prevent the NULL deref itself which happens
> since a chunk of the code in lockdep.c assumed hlock_class() can't
> return NULL.
> 
There's tons of code actually assuming that..

> This won't fix the actual problem though, I'm not sure exactly how a
> held lock wouldn't have a class initialized to it. 

static inline struct lock_class *hlock_class(struct held_lock *hlock)                        
{               
        if (!hlock->class_idx) {                                                             
                /*
                 * Someone passed in garbage, we give up.                                    
                 */                                                                          
                DEBUG_LOCKS_WARN_ON(1);                                                      
                return NULL;
        }
        return lock_classes + hlock->class_idx - 1; 
}

Typically that translates to severe memory corruption.

  reply	other threads:[~2012-02-28 13:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28 15:24 Sasha Levin
2012-02-28 13:29 ` Peter Zijlstra [this message]
2012-02-28 14:13   ` Sasha Levin
2012-02-28 14:19   ` Sasha Levin
2012-02-28 14:20     ` Peter Zijlstra
2012-02-28 14:23       ` Sasha Levin
2012-02-28 14:26         ` Peter Zijlstra
2012-02-28 14:55           ` Sasha Levin
2012-02-28 15:08             ` Peter Zijlstra
2012-02-28 16:02               ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1330435782.11248.89.camel@twins \
    --to=peterz@infradead.org \
    --cc=davej@redhat.com \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®