From: Al Viro <viro@zeniv.linux.org.uk>
To: Matthieu Baerts <matttbe@kernel.org>
Cc: Eric Dumazet <edumazet@google.com>,
davem@davemloft.net, geliang@kernel.org, horms@kernel.org,
kuba@kernel.org, linux-kernel@vger.kernel.org,
martineau@kernel.org, mptcp@lists.linux.dev,
netdev@vger.kernel.org, pabeni@redhat.com,
syzkaller-bugs@googlegroups.com,
syzbot <syzbot+e364f774c6f57f2c86d1@syzkaller.appspotmail.com>
Subject: Re: [syzbot] [mptcp?] general protection fault in proc_scheduler
Date: Sat, 4 Jan 2025 20:21:26 +0000 [thread overview]
Message-ID: <20250104202126.GH1977892@ZenIV> (raw)
In-Reply-To: <89c2208c-fe23-43eb-89ef-876e55731a50@kernel.org>
On Sat, Jan 04, 2025 at 08:11:49PM +0100, Matthieu Baerts wrote:
> >> + if (S_ISREG(file_inode(file)->i_mode))
^^^^^^^^^
> >> + return;
> >
> > ... won't help, since the file in question *is* a regular file. IOW, it's
> > a wrong predicate here.
>
> On my side, it looks like I'm not able to reproduce the issue with this
> patch. Without it, it is very easy to reproduce it. (But I don't know if
> there are other consequences that would avoid the issue to happen: when
> looking at the logs, with the patch, I don't have heaps of "Process
> accounting resumed" messages that I had before.)
Unsurprisingly so, since it rejects all regular files due to a typo;
fix that and you'll see that the oops is still there.
The real issue (and the one that affects more than just this scenario) is
the use of current->nsproxy->net to get to the damn thing.
Why not something like
static int proc_scheduler(const struct ctl_table *ctl, int write,
void *buffer, size_t *lenp, loff_t *ppos)
{
char (*data)[MPTCP_SCHED_NAME_MAX] = table->data;
char val[MPTCP_SCHED_NAME_MAX];
struct ctl_table tbl = {
.data = val,
.maxlen = MPTCP_SCHED_NAME_MAX,
};
int ret;
strscpy(val, *data, MPTCP_SCHED_NAME_MAX);
ret = proc_dostring(&tbl, write, buffer, lenp, ppos);
if (write && ret == 0) {
rcu_read_lock();
sched = mptcp_sched_find(val);
if (sched)
strscpy(*data, val, MPTCP_SCHED_NAME_MAX);
else
ret = -ENOENT;
rcu_read_unlock();
}
return ret;
}
seeing that the data object you really want to access is
mptcp_get_pernet(net)->scheduler and you have that pointer
stored in table->data at the registration time?
next prev parent reply other threads:[~2025-01-04 20:21 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-02 14:12 [syzbot] [mptcp?] general protection fault in proc_scheduler syzbot
2025-01-02 15:21 ` Eric Dumazet
2025-01-04 18:38 ` Matthieu Baerts
2025-01-04 18:53 ` Eric Dumazet
2025-01-04 19:00 ` Al Viro
2025-01-04 19:11 ` Matthieu Baerts
2025-01-04 20:21 ` Al Viro [this message]
2025-01-05 8:32 ` Eric Dumazet
2025-01-05 11:29 ` Al Viro
2025-01-05 16:52 ` Eric Dumazet
2025-01-05 17:03 ` Matthieu Baerts
2025-01-05 19:54 ` Al Viro
2025-01-05 20:50 ` Al Viro
2025-01-05 21:11 ` Al Viro
2025-01-05 17:03 ` Matthieu Baerts
2025-01-04 19:11 ` Matthieu Baerts
2025-01-06 13:32 ` Joel Granados
2025-01-06 14:27 ` Matthieu Baerts
2025-01-06 15:27 ` Eric Dumazet
2025-01-06 15:34 ` Matthieu Baerts
2025-01-08 14:37 ` Joel Granados
2025-01-04 20:09 ` Al Viro
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=20250104202126.GH1977892@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martineau@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+e364f774c6f57f2c86d1@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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).