Skip to content

close_range: implement it rather than return ENOSYS

Babanpreet Singh yocto-patches 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 0 repliesNew
  2. v22 patches 8 repliesSuperseded
  3. v12 patches 2 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2ports/linux/guts: Implement close_range() instead of returning ENOSYSenums/op.in ports/linux/guts/close_range.c ports/linux/guts/closefrom.c +2 more+99 -190 replies
2/2tests: Add close_range() testtest/test-close-range.c test/test-close-range.sh+307 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [pseudo] [PATCH v3 0/2] close_range: implement it rather than return ENOSYS

Richard, I took the writing rather than leave it to you. This is the one op version.

close_range() and closefrom() both go through OP_CLOSE_RANGE now. Based on the two commits you have on master-next (5ce47e3 + 2d235dd), and the only changes from those are:

- OP_CLOSEFROM dropped from enums/op.in.
- Its case in pseudo_client_op() went with it. OP_CLOSE_RANGE already does the same walk over pseudo's own descriptors, and the ignore-path exemption now names one op instead of two.
- closefrom() calls the op with INT_MAX for the maximum.
- pseudo_client_closefrom() folded into pseudo_client_close_range(), which clamps to nfds anyway, so INT_MAX means what closefrom() wants.

The rest is your version, tweaks and all. pseudo_client.c comes out at +28/-10 against master rather than +67/-1.

2/2 is your test commit with nothing touched in it. I dropped your Signed-off-by from both, since 1/2 is no longer the code you signed off on and carrying it on 2/2 alone looked worse than dropping both.

Tested on x86_64, glibc 2.39, kernel 6.17.0-22:

- ./run_tests.sh: 45 tests, 5 skipped for missing xattr and acl support in this container, everything else passing except test-parallel-rename and test-parallel-symlinks. Those two are flaky here rather than broken by this: they fail on pristine 2a5521e as well, and across three runs of this branch one of them passed once.
- The probe matrix from July, run against this branch and against a build of your master-next version: byte identical output. It covers close_range(fd, ~0U, 0) with no path lists, under PSEUDO_IGNORE_PATHS, and under an OE-style PSEUDO_INCLUDE_PATHS, the maxfd variants (~0U, UINT_MAX-1, INT_MAX, 4096, fd), closefrom() under that same include list, and pseudo still faking ownership after both calls.
- linux-libc-headers do_install, with pseudo-native built from this
branch: succeeds. That is the task that died on valkyrie in July.

One gap I should name: the suite has no closefrom() test, so what the rewiring did to closefrom is covered by that probe and not by anything in the tree. I left it out because closefrom() is not declared before glibc 2.34 and I did not want to guess at what that does to the test build on older hosts. Happy to add a case to 2/2 if you would rather have it.

Babanpreet Singh (2):
ports/linux/guts: Implement close_range() instead of returning ENOSYS
tests: Add close_range() test

 enums/op.in                    |   2 +-
 ports/linux/guts/close_range.c |  59 ++++++-
 ports/linux/guts/closefrom.c   |   3 +-
 ports/linux/portdefs.h         |  16 ++
 pseudo_client.c                |  38 +++--
 test/test-close-range.c        | 283 +++++++++++++++++++++++++++++++++
 test/test-close-range.sh       |  24 +++
 7 files changed, 406 insertions(+), 19 deletions(-)
 create mode 100644 test/test-close-range.c
 create mode 100755 test/test-close-range.sh
Signature · 1 line
2.43.0