[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yi/LaZ5id4ZjqFmL@zeniv-ca.linux.org.uk>
Date: Mon, 14 Mar 2022 23:10:33 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Hao Luo <haoluo@...gle.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
KP Singh <kpsingh@...nel.org>,
Shakeel Butt <shakeelb@...gle.com>,
Joe Burton <jevburton.kernel@...il.com>,
Tejun Heo <tj@...nel.org>, joshdon@...gle.com, sdf@...gle.com,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next v1 1/9] bpf: Add mkdir, rmdir, unlink syscalls
for prog_bpf_syscall
On Mon, Mar 14, 2022 at 10:07:31AM -0700, Hao Luo wrote:
> Hello Al,
> > In which contexts can those be called?
> >
>
> In a sleepable context. The plan is to introduce a certain tracepoints
> as sleepable, a program that attaches to sleepable tracepoints is
> allowed to call these functions. In particular, the first sleepable
> tracepoint introduced in this patchset is one at the end of
> cgroup_mkdir(). Do you have any advices?
Yes - don't do it, unless you really want a lot of user-triggerable
deadlocks.
Pathname resolution is not locking-agnostic. In particular, you can't
do it if you are under any ->i_rwsem, whether it's shared or exclusive.
That includes cgroup_mkdir() callchains. And if the pathname passed
to these functions will have you walk through the parent directory,
you would get screwed (e.g. if the next component happens to be
inexistent, triggering a lookup, which takes ->i_rwsem shared).
Powered by blists - more mailing lists