Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace reconfigure fails on Ubuntu 16.04 #7

Closed
ykorman opened this issue Nov 8, 2016 · 4 comments
Closed

Namespace reconfigure fails on Ubuntu 16.04 #7

ykorman opened this issue Nov 8, 2016 · 4 comments

Comments

@ykorman
Copy link

ykorman commented Nov 8, 2016

I've compiled ndctl (latest) for Ubuntu 16.04 and tried to run it in a qemu-kvm virtual machine configured with virtual nvdimms like so:
root@vm:~/ndctl# ./ndctl/ndctl create-namespace --reconfig=namespace0.0 --mode=memory --map=mem --force --verbose
And got the following result:

setup_namespace:322: pfn0.0: set_align failed: -6
failed to reconfigure namespace
libndctl: ndctl_unref: context 0x19e2340 released

The original pmem device goes away after that.

Ubuntu is based on kernel 4.4, maybe it's missing some features required by the latest ndctl.

@djbw
Copy link
Member

djbw commented Nov 9, 2016

Yes, that's a bug. We should be skipping attempts to set the alignment an older kernels that did not include this capability. I'll copy you on the proposed fix.

@djbw
Copy link
Member

djbw commented Nov 10, 2016

These 2 patches fix the issue for me:

https://patchwork.kernel.org/patch/9420495/
https://patchwork.kernel.org/patch/9420497/

If they work for you I'll push them out on the pending branch.

@ykorman
Copy link
Author

ykorman commented Nov 10, 2016

They work for me as well.
Thanks!

djbw added a commit that referenced this issue Nov 10, 2016
Prior to 4.5 kernel the 'align' attribute for pfn devices did not exist.
Skip attempts to set it on those kernels.

Link: #7
Reported-by: Yigal Korman <yigal@plexistor.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
djbw added a commit that referenced this issue Nov 10, 2016
Prior to 4.5 kernel the 'align' attribute for pfn devices did not exist.
Skip attempts to set it on those kernels.

Link: #7
Reported-by: Yigal Korman <yigal@plexistor.com>
Tested-by: Yigal Korman <yigal@plexistor.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
@djbw
Copy link
Member

djbw commented Nov 10, 2016

Thanks, pushed out to the pending branch.

@djbw djbw closed this as completed Nov 10, 2016
djbw added a commit that referenced this issue Mar 22, 2022
bus_invalidate() attempts to limit the invalidation of memdevs to a single
bus scope. However, the ordering of bus_invalidate() leads to a use after
free. Unconditionally invalidate memdevs (disconnect memdevs from their
endpoints) and resotre on next lookup. Otherwise the following command
results in the following backtrace with cxl_test:

    cxl disable-memdev 5,1 --force

#2  0x00007ffff7fb97d4 in snprintf (__fmt=0x7ffff7fbc3ed "%s/driver", __n=98,
    __s=0x574d545619f7bae2 <error: Cannot access memory at address 0x574d545619f7bae2>)
    at /usr/include/bits/stdio2.h:71
#3  cxl_port_is_enabled (port=port@entry=0x422eb0) at ../cxl/lib/libcxl.c:1379
#4  0x00007ffff7fb99a9 in cxl_port_get_bus (port=0x422eb0) at ../cxl/lib/libcxl.c:1339
#5  0x00007ffff7fba3d0 in bus_invalidate (bus=bus@entry=0x421740) at ../cxl/lib/libcxl.c:549
#6  0x00007ffff7fba4e7 in cxl_memdev_disable_invalidate (memdev=0x416fd0) at ../cxl/lib/libcxl.c:596
#7  0x000000000040624e in memdev_action (argc=<optimized out>, argv=<optimized out>, ctx=0x4152a0,
    action=action@entry=0x406b70 <action_disable>, options=options@entry=0x40fca0 <disable_options>,
    usage=usage@entry=0x40f4b0 "cxl disable-memdev <mem0> [<mem1>..<memN>] [<options>]")
    at ../cxl/memdev.c:506
#8  0x0000000000406d57 in cmd_disable_memdev (argc=<optimized out>, argv=<optimized out>,

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
stellarhopper pushed a commit that referenced this issue Jun 16, 2022
bus_invalidate() attempts to limit the invalidation of memdevs to a single
bus scope. However, the ordering of bus_invalidate() leads to a use after
free. Unconditionally invalidate memdevs (disconnect memdevs from their
endpoints) and resotre on next lookup. Otherwise the following command
results in the following backtrace with cxl_test:

    cxl disable-memdev 5,1 --force

#2  0x00007ffff7fb97d4 in snprintf (__fmt=0x7ffff7fbc3ed "%s/driver", __n=98,
    __s=0x574d545619f7bae2 <error: Cannot access memory at address 0x574d545619f7bae2>)
    at /usr/include/bits/stdio2.h:71
#3  cxl_port_is_enabled (port=port@entry=0x422eb0) at ../cxl/lib/libcxl.c:1379
#4  0x00007ffff7fb99a9 in cxl_port_get_bus (port=0x422eb0) at ../cxl/lib/libcxl.c:1339
#5  0x00007ffff7fba3d0 in bus_invalidate (bus=bus@entry=0x421740) at ../cxl/lib/libcxl.c:549
#6  0x00007ffff7fba4e7 in cxl_memdev_disable_invalidate (memdev=0x416fd0) at ../cxl/lib/libcxl.c:596
#7  0x000000000040624e in memdev_action (argc=<optimized out>, argv=<optimized out>, ctx=0x4152a0,
    action=action@entry=0x406b70 <action_disable>, options=options@entry=0x40fca0 <disable_options>,
    usage=usage@entry=0x40f4b0 "cxl disable-memdev <mem0> [<mem1>..<memN>] [<options>]")
    at ../cxl/memdev.c:506
#8  0x0000000000406d57 in cmd_disable_memdev (argc=<optimized out>, argv=<optimized out>,

Link: https://lore.kernel.org/r/165118383756.1676208.5717187278816036969.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants