lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <acbb7dd0-3727-093f-3bae-87bda8c50266@nvidia.com>
Date:   Wed, 2 Mar 2022 00:07:22 -0800
From:   John Hubbard <jhubbard@...dia.com>
To:     Miklos Szeredi <miklos@...redi.hu>
Cc:     jhubbard.send.patches@...il.com, Jens Axboe <axboe@...nel.dk>,
        Jan Kara <jack@...e.cz>, Christoph Hellwig <hch@...radead.org>,
        Dave Chinner <dchinner@...hat.com>,
        "Darrick J . Wong" <djwong@...nel.org>,
        Theodore Ts'o <tytso@....edu>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Chaitanya Kulkarni <kch@...dia.com>,
        linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        linux-xfs <linux-xfs@...r.kernel.org>,
        linux-mm <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 6/6] fuse: convert direct IO paths to use FOLL_PIN

On 3/1/22 01:41, Miklos Szeredi wrote:
...
>>> This might work for O_DIRECT, but fuse has this mode of operation
>>> which turns normal "buffered" I/O into direct I/O.  And that in turn
>>> will break execve of such files.
>>>
>>> So AFAICS we need to keep kvec handing in some way.
>>>
>>
>> Thanks for bringing that up! Do you have any hints for me, to jump start
> 
> How about just leaving that special code in place?   It bypasses page
> refs and directly copies to the kernel buffer, so it should not have
> any affect on the user page code.
> 

Good idea, I'll go that direction.

>> a deeper look? And especially, sample programs that exercise this?
> 
> Here's one:

This is really helpful, exactly what I was looking for.


thanks!
-- 
John Hubbard
NVIDIA

> # uncomment as appropriate:
> #sudo dnf install fuse3-devel
> #sudo apt install libfuse3-dev
> 
> cat <<EOF > fuse-dio-exec.c
> #define FUSE_USE_VERSION 31
> #include <fuse.h>
> #include <errno.h>
> #include <unistd.h>
> 
> static const char *filename = "/bin/true";
> 
> static int test_getattr(const char *path, struct stat *stbuf,
>               struct fuse_file_info *fi)
> {
>      return lstat(filename, stbuf) == -1 ? -errno : 0;
> }
> 
> static int test_open(const char *path, struct fuse_file_info *fi)
> {
>      int res;
> 
>      res = open(filename, fi->flags);
>      if (res == -1)
>          return -errno;
> 
>      fi->fh = res;
>      fi->direct_io = 1;
>      return 0;
> }
> 
> static int test_read(const char *path, char *buf, size_t size, off_t offset,
>                struct fuse_file_info *fi)
> {
>      int res = pread(fi->fh, buf, size, offset);
>      return res == -1 ? -errno : res;
> }
> 
> static int test_release(const char *path, struct fuse_file_info *fi)
> {
>      close(fi->fh);
>      return 0;
> }
> 
> static const struct fuse_operations test_oper = {
>      .getattr    = test_getattr,
>      .open        = test_open,
>      .release    = test_release,
>      .read        = test_read,
> };
> 
> int main(int argc, char *argv[])
> {
>      return fuse_main(argc, argv, &test_oper, NULL);
> }
> EOF
> 
> gcc -W fuse-dio-exec.c `pkg-config fuse3 --cflags --libs` -o fuse-dio-exec
> touch /tmp/true
> 
> #run test:
> ./fuse-dio-exec /tmp/true
> /tmp/true
> umount /tmp/true

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ