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

Fix ztest vdev file paths #1001

Closed
wants to merge 2 commits into from
Closed

Conversation

dechamps
Copy link
Contributor

@dechamps dechamps commented Oct 1, 2012

Currently, in several instances (but not all), ztest generates vdev file paths using a statement similar to this:

snprintf(path, sizeof (path), ztest_dev_template, ...);

This worked fine until 40b84e7, which changed path to be a pointer to the heap instead of an array allocated on the stack. Before this change, sizeof(path) would return the size of the array; now, it returns the size of the pointer instead.

As a result, the aforementioned sprintf statement uses the wrong size and truncates the vdev file path to the first 4 or 8 bytes (depending on the architecture). Typically, with default settings, the file path will become /tmp/zt instead of /test/ztest.XXX.

This issue only exists in ztest_vdev_attach_detach() and ztest_fault_inject(), which explains why ztest doesn't fail right away.

Currently, in several instances (but not all), ztest generates vdev
file paths using a statement similar to this:

    snprintf(path, sizeof (path), ztest_dev_template, ...);

This worked fine until 40b84e7, which
changed path to be a pointer to the heap instead of an array allocated
on the stack. Before this change, sizeof(path) would return the size of
the array; now, it returns the size of the pointer instead.

As a result, the aforementioned sprintf statement uses the wrong size
and truncates the vdev file path to the first 4 or 8 bytes (depending
on the architecture). Typically, with default settings, the file path
will become "/tmp/zt" instead of "/test/ztest.XXX".

This issue only exists in ztest_vdev_attach_detach() and
ztest_fault_inject(), which explains why ztest doesn't fail right away.
@dechamps dechamps mentioned this pull request Oct 1, 2012
@behlendorf
Copy link
Contributor

Squashed and merged as commit 6aec1cd

@behlendorf behlendorf closed this Oct 3, 2012
pcd1193182 pushed a commit to pcd1193182/zfs that referenced this pull request Sep 26, 2023
…#1001)

Bumps [rustix](https://github.com/bytecodealliance/rustix) from 0.37.22 to 0.37.23.
- [Release notes](https://github.com/bytecodealliance/rustix/releases)
- [Commits](bytecodealliance/rustix@v0.37.22...v0.37.23)

---
updated-dependencies:
- dependency-name: rustix
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
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

Successfully merging this pull request may close these issues.

2 participants