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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 16 Jul 2020 20:04:05 +0100
From:   Joao Martins <joao.m.martins@...cle.com>
To:     Dan Williams <dan.j.williams@...el.com>
Cc:     linux-nvdimm <linux-nvdimm@...ts.01.org>,
        Vishal Verma <vishal.l.verma@...el.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Ard Biesheuvel <ard.biesheuvel@...aro.org>,
        Linux MM <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux ACPI <linux-acpi@...r.kernel.org>,
        Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v2 22/22] device-dax: Introduce 'mapping' devices

On 7/16/20 5:00 PM, Dan Williams wrote:
> On Thu, Jul 16, 2020 at 6:19 AM Joao Martins <joao.m.martins@...cle.com> wrote:
>> On 7/12/20 5:28 PM, Dan Williams wrote:
>>> In support of interrogating the physical address layout of a device with
>>> dis-contiguous ranges, introduce a sysfs directory with 'start', 'end',
>>> and 'page_offset' attributes. The alternative is trying to parse
>>> /proc/iomem, and that file will not reflect the extent layout until the
>>> device is enabled.
>>>
>>> Cc: Vishal Verma <vishal.l.verma@...el.com>
>>> Signed-off-by: Dan Williams <dan.j.williams@...el.com>
>>> ---
>>>  drivers/dax/bus.c         |  191 +++++++++++++++++++++++++++++++++++++++++++++
>>>  drivers/dax/dax-private.h |   14 +++
>>>  2 files changed, 203 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
>>> index f342e36c69a1..8b6c4ddc5f42 100644
>>> --- a/drivers/dax/bus.c
>>> +++ b/drivers/dax/bus.c
>>> @@ -579,6 +579,167 @@ struct dax_region *alloc_dax_region(struct device *parent, int region_id,
>>>  }
>>>  EXPORT_SYMBOL_GPL(alloc_dax_region);
>>>
>>> +static void dax_mapping_release(struct device *dev)
>>> +{
>>> +     struct dax_mapping *mapping = to_dax_mapping(dev);
>>> +     struct dev_dax *dev_dax = to_dev_dax(dev->parent);
>>> +
>>> +     ida_free(&dev_dax->ida, mapping->id);
>>> +     kfree(mapping);
>>> +}
>>> +
>>> +static void unregister_dax_mapping(void *data)
>>> +{
>>> +     struct device *dev = data;
>>> +     struct dax_mapping *mapping = to_dax_mapping(dev);
>>> +     struct dev_dax *dev_dax = to_dev_dax(dev->parent);
>>> +     struct dax_region *dax_region = dev_dax->region;
>>> +
>>> +     dev_dbg(dev, "%s\n", __func__);
>>> +
>>> +     device_lock_assert(dax_region->dev);
>>> +
>>> +     dev_dax->ranges[mapping->range_id].mapping = NULL;
>>> +     mapping->range_id = -1;
>>> +
>>> +     device_del(dev);
>>> +     put_device(dev);
>>> +}
>>> +
>>> +static struct dev_dax_range *get_dax_range(struct device *dev)
>>> +{
>>> +     struct dax_mapping *mapping = to_dax_mapping(dev);
>>> +     struct dev_dax *dev_dax = to_dev_dax(dev->parent);
>>> +     struct dax_region *dax_region = dev_dax->region;
>>> +
>>> +     device_lock(dax_region->dev);
>>> +     if (mapping->range_id < 1) {
>>             ^^^^^^^^^^^^^^^^^^^^^ it's 'mapping->range_id < 0'
>>
>> Otherwise 'mapping0' sysfs entries won't work.
>> Disabled ranges use id -1.
> 
> Whoops, yes. Needs a unit test.
> 
If it helps, this particular patch for daxctl:

https://lore.kernel.org/linux-nvdimm/20200716184707.23018-7-joao.m.martins@oracle.com/

May help in the immediate term: if it's broken no mappings are listed.

But yeah, a unit test in 'test/daxctl-create.sh' should be added.

	Joao

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ