Re: [PATCH 0/3] extend get/setrlimit to support setting rlimitsexternal to a process (v7)
From: Oleg Nesterov
Date: Mon Nov 09 2009 - 11:48:21 EST
On 11/09, Jiri Slaby wrote:
>
> + ppid = find_get_pid(pid);
> + if (!ppid)
> + goto out;
> +
> + tsk = get_pid_task(ppid, PIDTYPE_PID);
> +
> + if (!tsk)
> + goto out_put_pid;
> +
> + if (resource >= RLIM_NLIMITS)
> + goto out_put_all;
> +
> + retval = -EBUSY;
> + if (!lock_task_sighand(tsk, &flags))
>
> X task_lock below cannot nest inside sighand (according to Oleg)
Yes, this is deadlockable.
Also, I don't understand why wthis code get's both pid and task_struct().
And the "if (resource >= RLIM_NLIMITS)" check is racy afaics, see
http://marc.info/?l=linux-kernel&m=125200862124872
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/