From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Oskar Andero <oskar.andero@sonymobile.com>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
davem@davemloft.net, anil.s.keshavamurthy@intel.com,
ananth@in.ibm.com, radovan.lekanovic@sonymobile.com,
bjorn.davidsson@sonymobile.com,
"yrl.pp-manager.tt@hitachi.com" <yrl.pp-manager.tt@hitachi.com>
Subject: Re: [PATCH v2 2/4] kprobes: split blacklist into common and arch
Date: Fri, 05 Apr 2013 11:34:27 +0900 [thread overview]
Message-ID: <515E3833.7070505@hitachi.com> (raw)
In-Reply-To: <1365079889-21525-3-git-send-email-oskar.andero@sonymobile.com>
(2013/04/04 21:51), Oskar Andero wrote:
> Some blackpoints are only valid for specific architectures. To let each
> architecture specify its own blackpoints the list has been split in two
> lists: common and arch. The common list is kept in kernel/kprobes.c and
> the arch list is kept in the arch/ directory.
>
Here I missed one racing issue.
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 0a270e5..7654278 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
[...]
>
> /* it can take some time ( > 100ms ) to initialise the
> * blacklist so we delay this until we actually need it
> */
> static void init_kprobe_blacklist(void)
> {
> - int i;
> - unsigned long offset = 0, size = 0;
> - char *modname, namebuf[128];
> - const char *symbol_name;
> - void *addr;
> - struct kprobe_blackpoint *kb;
> + int i, j = 0;
>
> mutex_lock(&kprobe_mutex);
> - if (kprobe_blacklist_initialized)
> + if (kprobe_blacklist)
> goto out;
>
> + kprobe_blacklist_size = common_kprobes_blacksyms_size +
> + arch_kprobes_blacksyms_size;
> + kprobe_blacklist = kzalloc(sizeof(*kprobe_blacklist) *
> + kprobe_blacklist_size, GFP_KERNEL);
If you'd like to use kprobe_blacklist itself as an initialized flag,
you must prepare the "blacklist" local pointer to allocate and
initialize entries.
> @@ -151,7 +175,6 @@ static void init_kprobe_blacklist(void)
> kretprobe_blacklist[i].name);
> }
> }
> - kprobe_blacklist_initialized = 1;
And after initialized, assign blacklist to kprobe_blacklist.
Without that, other thread may refer the uninitialized (but allocated)
black list.
Thank you,
--
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
next prev parent reply other threads:[~2013-04-05 2:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-04 12:51 [PATCH v2 0/4] kprobes: split blacklist into common and arch Oskar Andero
2013-04-04 12:51 ` [PATCH v2 1/4] kprobes: delay blacklist symbol lookup until we actually need it Oskar Andero
2013-04-05 0:56 ` Joonsoo Kim
2013-04-05 2:16 ` Masami Hiramatsu
2013-04-05 2:16 ` Masami Hiramatsu
2013-04-05 10:00 ` Oskar Andero
2013-04-04 12:51 ` [PATCH v2 2/4] kprobes: split blacklist into common and arch Oskar Andero
2013-04-05 2:34 ` Masami Hiramatsu [this message]
2013-04-05 2:34 ` Masami Hiramatsu
2013-04-05 8:04 ` Vineet Gupta
2013-04-04 12:51 ` [PATCH v2 3/4] kprobes: move x86-specific blacklist symbols to arch directory Oskar Andero
2013-04-04 12:51 ` Oskar Andero
2013-04-05 2:36 ` Masami Hiramatsu
2013-04-04 12:51 ` [PATCH v2 4/4] kprobes: replace printk with pr_-functions Oskar Andero
2013-04-04 12:51 ` Oskar Andero
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=515E3833.7070505@hitachi.com \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=ananth@in.ibm.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=bjorn.davidsson@sonymobile.com \
--cc=davem@davemloft.net \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oskar.andero@sonymobile.com \
--cc=radovan.lekanovic@sonymobile.com \
--cc=yrl.pp-manager.tt@hitachi.com \
/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;
as well as URLs for NNTP newsgroup(s).