[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101214163719.GH11400@redhat.com>
Date: Tue, 14 Dec 2010 17:37:19 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: "Suzuki K. Poulose" <suzuki@...ibm.com>
Cc: linux-kernel@...r.kernel.org,
Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>,
Christoph Hellwig <hch@....de>,
Masami Hiramatsu <mhiramat@...hat.com>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Daisuke HATAYAMA <d.hatayama@...fujitsu.com>,
Andi Kleen <andi@...stfloor.org>,
Roland McGrath <roland@...hat.com>,
Amerigo Wang <amwang@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [Patch 15/21] Collect ELF Core notes data
On 12/14, Suzuki K. Poulose wrote:
>
> @@ -164,10 +197,28 @@ static int open_gencore(struct inode *in
> list_add(&cp->list, &core_list);
> mutex_unlock(&core_mutex);
>
> + max_regset = get_max_regsets(task);
> +
> + for (i = 0; i < get_nr_threads(task); i++) {
> + tinfo = kzalloc(offsetof(struct elf_thread_core_info,
> + notes[max_regset]), GFP_KERNEL);
> + if (unlikely(!tinfo)) {
> + cleanup_cp(cp);
> + ret = -ENOMEM;
> + goto out;
> + }
> + tinfo->next = cp->tinfo;
> + cp->tinfo = tinfo;
> + }
This looks strange... Obviously we can't trust get_nr_threads()
before this process is stopped/frozen.
Just noticed... release_gencore() does thaw_process() for each
thread. But, again, if it was stopped we can race with SIGCONT
and exit. IOW, -EIO is possible. Who will thaw other threads?
Also, we can probably race with exec, but I am not sure.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists