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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 8 Jul 2020 22:11:16 +0530
From:   Kanchan Joshi <joshi.k@...sung.com>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Jens Axboe <axboe@...nel.dk>, viro@...iv.linux.org.uk,
        bcrl@...ck.org, hch@...radead.org, Damien.LeMoal@....com,
        asml.silence@...il.com, linux-fsdevel@...r.kernel.org,
        mb@...htnvm.io, linux-kernel@...r.kernel.org, linux-aio@...ck.org,
        io-uring@...r.kernel.org, linux-block@...r.kernel.org,
        Selvakumar S <selvakuma.s1@...sung.com>,
        Nitesh Shetty <nj.shetty@...sung.com>,
        Javier Gonzalez <javier.gonz@...sung.com>
Subject: Re: [PATCH v3 4/4] io_uring: add support for zone-append

On Wed, Jul 08, 2020 at 03:22:51PM +0100, Matthew Wilcox wrote:
>On Wed, Jul 08, 2020 at 06:28:05PM +0530, Kanchan Joshi wrote:
>> The last thing is about the flag used to trigger this processing. Will it be
>> fine to intoduce new flag (RWF_APPEND2 or RWF_APPEND_OFFSET)
>> instead of using RWF_APPEND?
>>
>> New flag will do what RWF_APPEND does and will also return the
>> written-location (and therefore expects pointer setup in application).
>
>I think it's simpler to understand if it's called RWF_INDIRECT_OFFSET
>Then it'd look like:
>
>+	rwf_t rwf = READ_ONCE(sqe->rw_flags);
>...
>-	iocb->ki_pos = READ_ONCE(sqe->off);
>+	if (rwf & RWF_INDIRECT_OFFSET) {
>+		loff_t __user *loffp = u64_to_user_ptr(sqe->addr2);
>+
>+		if (get_user(iocb->ki_pos, loffp)
>+			return -EFAULT;
>+		iocb->ki_loffp = loffp;
>+	} else {
>+		iocb->ki_pos = READ_ONCE(sqe->off);
>+	}
>...
>-	ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags));
>+	ret = kiocb_set_rw_flags(kiocb, rwf);

It will sure go like this in io_uring, except I was thinking to use
io_kiocb rather than iocb for "loffp". 
I am fine with RWF_INDIRECT_OFFSET, but wondering - whether to build
this over base-behavior offered by RWF_APPEND.
This is what I mean in code (I used RWF_APPEND2 here)- 

static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
        ki->ki_flags |= (IOCB_DSYNC | IOCB_SYNC);
        if (flags & RWF_APPEND)
                ki->ki_flags |= IOCB_APPEND;
+       if (flags & RWF_APPEND2) {
+               /*
+                * RWF_APPEND2 is "file-append + return write-location"
+                * Use IOCB_APPEND for file-append, and new IOCB_ZONE_APPEND
+                * to return where write landed
+                */
+               ki->ki_flags |= IOCB_APPEND;
+               if (ki->ki_filp->f_mode & FMODE_ZONE_APPEND) /*revisit the need*/
+                       ki->ki_flags |= IOCB_ZONE_APPEND;
+       }
+


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ