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

OpenatTest.WithFlag / ForkedOpenatTest_WithFlagInCapabilityMode._ fail fails on FreeBSD #28

Open
ngie-eign opened this issue Feb 5, 2019 · 2 comments

Comments

@ngie-eign
Copy link
Contributor

Stock FreeBSD fails OpenatTest.WithFlag / ForkedOpenatTest_WithFlagInCapabilityMode._ for two reasons:

  1. The testcases are expecting -1/EPERM instead of -1/ENOTCAPABLE`:
openat.cc:264: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:265: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:266: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:275: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
...
openat.cc:280: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:281: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:282: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:283: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:284: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
...
openat.cc:288: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:289: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:290: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:291: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:292: Failure
Expected equality of these values:
  1
  (* __error())
    Which is: 93
openat.cc:353: Failure
Expected equality of these values:
  0
  rc
    Which is: 1
  1. These testcases don't fail when O_BENEATH is passed:
openat.cc:280: Failure
Expected: (0) > (result), actual: 0 vs 49
...
openat.cc:288: Failure
Expected: (0) > (result), actual: 0 vs 50

Item 1. is a test bug. I'm unsure if item 2 is a kernel bug or a test bug.

These issues can be triggered out of the box on a FreeBSD 13.0-CURRENT image.

@ngie-eign ngie-eign changed the title OpenatTest.WithFlag / ForkedOpenatTest_WithFlagInCapabilityMode._ fail because they pass improper flags combo OpenatTest.WithFlag / ForkedOpenatTest_WithFlagInCapabilityMode._ fail Feb 5, 2019
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Feb 5, 2019
Per open(2), the errno that should be tested is `ENOTCAPABLE`, not
`EPERM`.

This addresses the first set of failures noted in google#28, which account for
all failures in the openat(2) testcases, sans two in the second set of
failures.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Feb 5, 2019
Per open(2), the errno that should be tested is `ENOTCAPABLE`, not
`EPERM`.

This addresses the first set of failures noted in google#28, which account for
all failures in the openat(2) testcases, sans two in the second set of
failures.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
daviddrysdale pushed a commit that referenced this issue Feb 5, 2019
Per open(2), the errno that should be tested is `ENOTCAPABLE`, not
`EPERM`.

This addresses the first set of failures noted in #28, which account for
all failures in the openat(2) testcases, sans two in the second set of
failures.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Feb 6, 2019
The absolute symlink failure to traverse testcases were buggy.

They were trying to verify that openat(2) would fail when opening a path
outside a sandbox, when in reality it was testing using a directory fd that
was in the sandbox (`TOPDIR`). An easy to implement change was to instead test
the absolute path resolution failure from the subdirectory (`SUBDIR`).

Reindent the directory hierarchy comment and reorder the elements in the
comments and tests to support the change.

While here, rename `SUBDIR_ABS` to `SUBDIR`, as `SUBDIR` was not an
absolute path.

This fixes the rest of google#28, along with
5eb909a.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Feb 6, 2019
The absolute symlink failure to traverse testcases were buggy.

They were trying to verify that openat(2) would fail when opening a path
outside a sandbox, when in reality it was testing using a directory (`TOPDIR`)
fd that was in the sandbox. An easy to implement change was to instead test
the absolute path resolution failure using the subdirectory (`SUBDIR`)
fd.

Reindent the directory hierarchy comment and reorder the elements in the
comments and tests to support the change.

While here, rename `SUBDIR_ABS` to `SUBDIR`, as `SUBDIR` was not an
absolute path.

This fixes the rest of google#28, along with
5eb909a.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Feb 12, 2019
The absolute symlink failure to traverse testcases were buggy.

They were trying to verify that openat(2) would fail when opening a path
outside a sandbox, when in reality it was testing using a directory (`TOPDIR`)
fd that was in the sandbox. An easy to implement change was to instead test
the absolute path resolution failure using the subdirectory (`SUBDIR`)
fd.

Reindent the directory hierarchy comment and reorder the elements in the
comments and tests to support the change.

While here, rename `SUBDIR_ABS` to `SUBDIR`, as `SUBDIR` was not an
absolute path.

This fixes the rest of google#28, along with
5eb909a.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Feb 12, 2019
The absolute symlink failure to traverse testcases were buggy.

They were trying to verify that openat(2) would fail when opening a path
outside a sandbox, when in reality it was testing using a directory fd that
was in the sandbox (`TOPDIR`). An easy to implement change was to instead test
the absolute path resolution failure from the subdirectory (`SUBDIR`).

Reindent the directory hierarchy comment and reorder the elements in the
comments and tests to support the change.

While here, rename `SUBDIR_ABS` to `SUBDIR`, as `SUBDIR` was not an
absolute path.

This fixes the rest of google#28, along with
5eb909a.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Feb 13, 2019
The absolute symlink failure to traverse testcases were buggy.

They were trying to verify that openat(2) would fail when opening a path
outside a sandbox, when in reality it was testing using a directory (`TOPDIR`)
fd that was in the sandbox. An easy to implement change was to instead test
the absolute path resolution failure using the subdirectory (`SUBDIR`)
fd.

Reindent the directory hierarchy comment and reorder the elements in the
comments and tests to support the change.

While here, rename `SUBDIR_ABS` to `SUBDIR`, as `SUBDIR` was not an
absolute path.

This fixes the rest of google#28, along with
5eb909a.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Mar 21, 2019
The absolute symlink failure to traverse testcases were buggy.

They were trying to verify that openat(2) would fail when opening a path
outside a sandbox, when in reality it was testing using a directory (`TOPDIR`)
fd that was in the sandbox. An easy to implement change was to instead test
the absolute path resolution failure using the subdirectory (`SUBDIR`)
fd.

Reindent the directory hierarchy comment and reorder the elements in the
comments and tests to support the change.

While here, rename `SUBDIR_ABS` to `SUBDIR`, as `SUBDIR` was not an
absolute path.

This fixes the rest of google#28, along with
5eb909a.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Mar 22, 2019
The absolute symlink failure to traverse testcases were buggy.

They were trying to verify that openat(2) would fail when opening a path
outside a sandbox, when in reality it was testing using a directory (`TOPDIR`)
fd that was in the sandbox. An easy to implement change was to instead test
the absolute path resolution failure using the subdirectory (`SUBDIR`)
fd.

Reindent the directory hierarchy comment and reorder the elements in the
comments and tests to support the change.

While here, rename `SUBDIR_ABS` to `SUBDIR`, as `SUBDIR` was not an
absolute path.

This fixes the rest of google#28, along with
5eb909a.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Mar 22, 2019
The absolute symlink failure to traverse testcases were buggy.

They were trying to verify that openat(2) would fail when opening a path
outside a sandbox, when in reality it was testing using a directory (`TOPDIR`)
fd that was in the sandbox. An easy to implement change was to instead test
the absolute path resolution failure using the subdirectory (`SUBDIR`)
fd.

Reindent the directory hierarchy comment and reorder the elements in the
comments and tests to support the change.

While here, rename `SUBDIR_ABS` to `SUBDIR`, as `SUBDIR` was not an
absolute path.

This fixes the rest of google#28, along with
5eb909a.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Mar 22, 2019
The absolute symlink failure to traverse testcases were buggy on FreeBSD.

They were trying to verify that openat(2) would fail when opening a path
outside a sandbox, when in reality it was testing using a directory (`TOPDIR`)
fd that was in the sandbox. An easy to implement change was to instead test
the absolute path resolution failure using the subdirectory (`SUBDIR`)
fd.

Since Capsicum-Linux implements the previous behavior, conditionalize
the fixes under `__FreeBSD__`, per @daviddrysdale's request.

Reindent the directory hierarchy comment and reorder the elements in the
comments and tests to support the change.

While here, rename `SUBDIR_ABS` to `SUBDIR`, as `SUBDIR` was not an
absolute path.

This fixes the rest of google#28, along with
5eb909a.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Apr 1, 2019
The absolute symlink failure to traverse testcases were buggy on FreeBSD.

They were trying to verify that openat(2) would fail when opening a path
outside a sandbox, when in reality it was testing using a directory (`TOPDIR`)
fd that was in the sandbox. An easy to implement change was to instead test
the absolute path resolution failure using the subdirectory (`SUBDIR`)
fd.

Since Capsicum-Linux implements the previous behavior, conditionalize
the fixes under `__FreeBSD__`, per @daviddrysdale's request.

Reindent the directory hierarchy comment and reorder the elements in the
comments and tests to support the change.

While here, rename `SUBDIR_ABS` to `SUBDIR`, as `SUBDIR` was not an
absolute path.

This fixes the rest of google#28, along with
5eb909a.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
@ngie-eign ngie-eign changed the title OpenatTest.WithFlag / ForkedOpenatTest_WithFlagInCapabilityMode._ fail OpenatTest.WithFlag / ForkedOpenatTest_WithFlagInCapabilityMode._ fail fails on FreeBSD Apr 1, 2019
ngie-eign added a commit to ngie-eign/capsicum-test that referenced this issue Apr 4, 2019
The absolute symlink failure to traverse testcases were buggy.

They were trying to verify that openat(2) would fail when opening a path
outside a sandbox, when in reality it was testing using a directory (`TOPDIR`)
fd that was in the sandbox. An easy to implement change was to instead test
the absolute path resolution failure using the subdirectory (`SUBDIR`)
fd.

Reindent the directory hierarchy comment and reorder the elements in the
comments and tests to support the change.

While here, rename `SUBDIR_ABS` to `SUBDIR`, as `SUBDIR` was not an
absolute path.

This fixes the rest of google#28, along with
5eb909a.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
@emaste
Copy link
Contributor

emaste commented Feb 18, 2020

Currently one failed test running 50a6d30 on FreeBSD Feb 6 snapshot (r357606):

[ RUN      ] OpenatTest.WithFlag
openat.cc:284: Failure
Expected: (0) > (result), actual: 0 vs 51
openat.cc:292: Failure
Expected: (0) > (result), actual: 0 vs 52
[  FAILED  ] OpenatTest.WithFlag (9 ms)

@daviddrysdale
Copy link
Contributor

What about if #40 were to be merged? Would that get us to a state where everything worked on both Linux and FreeBSD?

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