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

segfault when creating pool #1118

Closed
jefferai opened this issue Nov 29, 2012 · 4 comments
Closed

segfault when creating pool #1118

jefferai opened this issue Nov 29, 2012 · 4 comments
Milestone

Comments

@jefferai
Copy link

Hello,

I'm on Ubuntu 12.04 LTS using the current zfs/spl packages from the official PPA (version 0.6.0.86-0ubuntu1~precise1).

I get a repeated segmentation fault when I try to create the pool:

root@wiki:~# zpool create -o ashift=12,listsnaps=on -O atime=off,compression=lzjb,normalization=formD,utf8only=on -m /storage storage vdb
Segmentation fault

dmesg shows:

[ 2768.876276] zpool[2272]: segfault at 43c ip 00007f8f704f7d4f sp 00007fffc59f2110 error 6 in libc-2.15.so[7f8f703ef000+1b5000]

Please let me know how I can help debug this.

Thanks!

@jefferai
Copy link
Author

I don't get this segfault when I take out the "listsnaps=on" from the -o property.

@jefferai
Copy link
Author

Okay, I now realize that I had totally wrong syntax for the comment. I'd argue that it still shouldn't segfault, though.

@lundman
Copy link
Contributor

lundman commented Nov 29, 2012

Yeah it does seem to be the wrong syntax, basically it is crashing here:

#1  0x00007ffff747bf34 in vsnprintf (__ap=0x7fffffff8108, 
    __fmt=<optimized out>, __n=1024, __s=0x43c <Address 0x43c out of bounds>)
    at /usr/include/x86_64-linux-gnu/bits/stdio2.h:78
#2  zfs_error_aux (hdl=hdl@entry=0x0, fmt=<optimized out>)
    at ../../lib/libzfs/libzfs_util.c:244
#3  0x00007ffff747bfcc in str2shift (hdl=hdl@entry=0x0, 
    buf=0x61cf6a ",listsnaps=on") at ../../lib/libzfs/libzfs_util.c:1300
#4  0x00007ffff747e055 in zfs_nicestrtonum (hdl=hdl@entry=0x0, 
    value=0x61cf68 "12,listsnaps=on", num=num@entry=0x7fffffff8260)
    at ../../lib/libzfs/libzfs_util.c:1378

Which is pretty much the line trying to tell you about the syntax problem:

            zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
                                        "invalid numeric suffix '%s'"), buf);

It is easily patched with something like https://github.com/lundman/zfs-master/commit/b80557183fcbb05f4ebc0472723ae80a76403ec3

 # zpool create -f -o ashift=12,listsnaps=on -O atime=off,compression=lzjb,normalization=formD,utf8only=on -m /storage storage ~/src/pool-image.bin
 cannot create 'storage': invalid numeric suffix ',listsnaps=on'
 # zpool create -f -o ashift=12 -o listsnaps=on -O atime=off,compression=lzjb,normalization=formD,utf8only=on -m /storage storage ~/src/pool-image.bin
 cannot create 'storage': 'atime' must be one of 'on | off'
 # zpool create -f -o ashift=12 -o listsnaps=on -O atime=off -O compression=lzjb -O normalization=formD -O utf8only=on -m /storage storage ~/src/pool-image.bin 
 #
Success!

@behlendorf
Copy link
Contributor

@jefferai It absolutely shouldn't segfault regardless of your syntax.

@lundman I was going to say we should make the hdl == NULL test further up the stack, but then I looked at the code and see they're already doing this in zfs_nicestrtonum(). So in the interests of being consistent I'm OK with your patch as is, I'll get it merged. Thanks for running this down.

unya pushed a commit to unya/zfs that referenced this issue Dec 13, 2013
Incorrect syntax should never cause a segfault.  In this case
listing multiple comma delimited options after '-o' triggered
the problem.  For example:

  zpool create -o ashift=12,listsnaps=on

This patch resolves the issue by wrapping the calls which use
hdr with a NULL test.

Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#1118
pcd1193182 pushed a commit to pcd1193182/zfs that referenced this issue Sep 26, 2023
…gent (openzfs#1118)

build(deps): bump async-lock in /cmd/zfs_object_agent

Bumps [async-lock](https://github.com/smol-rs/async-lock) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/smol-rs/async-lock/releases)
- [Changelog](https://github.com/smol-rs/async-lock/blob/master/CHANGELOG.md)
- [Commits](smol-rs/async-lock@v2.7.0...v2.8.0)

---
updated-dependencies:
- dependency-name: async-lock
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.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

3 participants