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]
Message-ID: <fd764cff-f4bc-a13d-96dc-a7eaab8434f2@redhat.com>
Date:   Thu, 28 Sep 2023 19:14:29 +0200
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Sean Christopherson <seanjc@...gle.com>,
        Isaku Yamahata <isaku.yamahata@...ux.intel.com>
Cc:     isaku.yamahata@...el.com, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, isaku.yamahata@...il.com,
        Michael Roth <michael.roth@....com>, erdemaktas@...gle.com,
        Sagi Shahar <sagis@...gle.com>,
        David Matlack <dmatlack@...gle.com>,
        Kai Huang <kai.huang@...el.com>,
        Zhi Wang <zhi.wang.linux@...il.com>, chen.bo@...el.com,
        linux-coco@...ts.linux.dev,
        Chao Peng <chao.p.peng@...ux.intel.com>,
        Ackerley Tng <ackerleytng@...gle.com>,
        Vishal Annapurve <vannapurve@...gle.com>,
        Yuan Yao <yuan.yao@...ux.intel.com>,
        Jarkko Sakkinen <jarkko@...nel.org>,
        Xu Yilun <yilun.xu@...el.com>,
        Quentin Perret <qperret@...gle.com>, wei.w.wang@...el.com,
        Fuad Tabba <tabba@...gle.com>
Subject: Re: [RFC PATCH v2 0/6] KVM: gmem: Implement test cases for
 error_remove_page

On 9/22/23 22:32, Sean Christopherson wrote:
> Unless we can't extend fadvise() for some reason, I think we should pursue
> FADV_HWPOISION.  The enabling should be downright trivial, e.g. just implement
> file_operations.fadvise() for guest_memfd, have it handle FADV_HWPOISON, and pass
> everything else to generic_fadvise().
> 
> It'll basically be your ioctl() just without a dedicated ioctl().
> 
> At the very least, we should run the idea past the fs maintainers.

fadvise() is different from madvise() though and not necessarily a great 
match.  Looking at the list of flags in advise(), something like 
FADV_POPULATE_READ, FADV_PAGEOUT or FADV_COLD would make sense, but I 
can't really think of any other flag that would be useful in a general 
case for fadvise.  Everything else would have to be very spcific to 
memfd or guest_memfd.

In particular FADV_HWPOISON would not make sense for anything that is 
not backend by memory.  There are some flags that could be useful on 
gmem file descriptors, such as hypothetically {WIPE,KEEP}ONFORK or 
SOFT_OFFLINE, but again they're not something that can be applied to 
fadvise().

So a ioctl implementation does have some advantages after all.  I 
suggest that we reuse MADV_* flags in the ioctl arguments, to leave the 
door open for future extensions and avoid ioctl proliferation.  The 
ioctl could be implemented by memfd, too, and perhaps even by /dev/zero.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ