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-next>] [day] [month] [year] [list]
Message-ID: <1630389.Mmh9faUyQX@number-5>
Date:   Tue, 26 Sep 2017 17:50:55 +0200
From:   Federico Vaga <federico.vaga@...a.pv.it>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Tejun Heo <tj@...nel.org>
Cc:     linux-kernel@...r.kernel.org
Subject: kernFS/sysfs: mmap and vm_operations close

Hello,

I'm writing a sysfs binary attribute that makes use of the `mmap` operation.
I would like to implement my own `open()` and `close()` `vm_ops` but 
apparently I'm not allowed to do it.

-------- kernfs/file.c - kernfs_fop_mmap () - modern kernel -----
-------- sysfs/bin.c - mmap () - old kernel -----

        /*
         * It is not possible to successfully wrap close.
         * So error if someone is trying to use close.
         */
        rc = -EINVAL;
        if (vma->vm_ops && vma->vm_ops->close)
                goto out_put;
----------------------------------------------------------

What is the reason behind this choice?
Why "it is not possible to successfully wrap close" ?

Is there an alternative/hack in order to be notified when the mmap is not used 
anymore and I can properly release my resources?

Due to HW resources limitation I "cannot" keep the device memory mapped when 
nobody is using it, that's why I would like to be able to use vm_ops->close(). 
In general, I would like to run my routine that release resources when the 
user does `munmap` or `close`


thank you very much :)

-- 
Federico Vaga
http://www.federicovaga.it

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ