public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: torvalds@linux-foundation.org, mingo@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 7/9] liblockdep: Support using LD_PRELOAD
Date: Fri, 10 May 2013 13:46:06 +0200	[thread overview]
Message-ID: <20130510114605.GA32110@dyad.programming.kicks-ass.net> (raw)
In-Reply-To: <20130510111719.GG31235@dyad.programming.kicks-ass.net>

On Fri, May 10, 2013 at 01:17:19PM +0200, Peter Zijlstra wrote:
> On Thu, May 09, 2013 at 11:58:07AM -0400, Sasha Levin wrote:
> > +	/*
> > +	 * Some programs attempt to initialize and use locks in their
> > +	 * allocation path. This means that a call to malloc() would
> > +	 * result in locks being initialized and locked.
> > +	 *
> > +	 * Why is it an issue for us? dlsym() below will try allocating to
> > +	 * give us the original function. Since this allocation will result
> > +	 * in a locking operations, we have to let pthread deal with it,
> > +	 * but we can't! we don't have the pointer to the original API
> > +	 * since we're inside dlsym() trying to get it :(
> > +	 *
> > +	 * We can work around it by telling the program that locking was
> > +	 * really okay, and just initialize those locks when we're fully
> > +	 * up and running (this is ok because this all happens during
> > +	 * initialization phase, when we have just one thread). But
> > +	 * this is a big TODO at this point.
> > +	 */
> > +	if (preload_started) {
> > +		printf(
> > +		"LOCKDEP error: It seems that the program you are trying to "
> > +		"debug is initializing locks in it's allocation path.\n"
> > +		"This means that liblockdep cannot reliably analyze this "
> > +		"program since we need the allocator to work before we can "
> > +		"debug locks.\nSorry!\n");
> > +
> > +		exit(1);
> > +	}
> 
> 
> Would something like the below cure things? Obviously this hasn't been near a
> compiler for the entire thing still isn't wanting to compile for me.

OK, that won't do indeed. Not being able to malloc is only part of the problem.

/me goes stare at it more

  parent reply	other threads:[~2013-05-10 11:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-09 15:58 [PATCH v3 0/9] liblockdep: userspace lockdep Sasha Levin
2013-05-09 15:58 ` [PATCH v3 1/9] lockdep: Be nice about building from userspace Sasha Levin
2013-05-09 15:58 ` [PATCH v3 2/9] liblockdep: Wrap kernel/lockdep.c to allow usage " Sasha Levin
2013-05-10  9:18   ` Peter Zijlstra
2013-05-10  9:38     ` Ingo Molnar
2013-05-10 10:11     ` Peter Zijlstra
2013-05-10 13:23       ` Sasha Levin
2013-05-10 14:03         ` Peter Zijlstra
2013-05-10 14:11           ` Sasha Levin
2013-05-10 14:12             ` Peter Zijlstra
2013-05-10 14:19               ` Peter Zijlstra
2013-05-10 14:23                 ` Sasha Levin
2013-05-10 13:58   ` Peter Zijlstra
2013-05-09 15:58 ` [PATCH v3 3/9] liblockdep: Add public headers for pthread_mutex_t implementation Sasha Levin
2013-05-09 15:58 ` [PATCH v3 4/9] liblockdep: Add pthread_mutex_t test suite Sasha Levin
2013-05-09 15:58 ` [PATCH v3 5/9] liblockdep: Add public headers for pthread_rwlock_t implementation Sasha Levin
2013-05-09 15:58 ` [PATCH v3 6/9] liblockdep: Add pthread_rwlock_t test suite Sasha Levin
2013-05-09 15:58 ` [PATCH v3 7/9] liblockdep: Support using LD_PRELOAD Sasha Levin
2013-05-10 11:17   ` Peter Zijlstra
2013-05-10 11:23     ` Ingo Molnar
2013-05-10 11:46     ` Peter Zijlstra [this message]
2013-05-10 13:11       ` Peter Zijlstra
2013-05-10 13:57   ` Peter Zijlstra
2013-05-10 16:06     ` Sasha Levin
2013-05-10 16:21       ` Peter Zijlstra
2013-05-10 16:42         ` Sasha Levin
2013-05-09 15:58 ` [PATCH v3 8/9] liblockdep: Add the 'lockdep' user-space utility Sasha Levin
2013-05-10  9:19   ` Peter Zijlstra
2013-05-10  9:35     ` Ingo Molnar
2013-05-10 10:41       ` Peter Zijlstra
2013-05-10 11:00         ` Ingo Molnar
2013-05-10 11:10           ` Borislav Petkov
2013-05-10 11:07             ` Ingo Molnar
2013-05-09 15:58 ` [PATCH v3 9/9] liblockdep: Add a MAINTAINERS entry 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=20130510114605.GA32110@dyad.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sasha.levin@oracle.com \
    --cc=torvalds@linux-foundation.org \
    /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