| Date | Tue, 14 Dec 2010 17:37:19 +0100 | From | Oleg Nesterov <> | 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.
|