casaroli opened a new pull request, #20930:
URL: https://github.com/apache/nuttx/pull/20930

   ## Summary
   
   `chroot()` is in `syscall/syscall.csv`, but not in 
`include/sys/syscall_lookup.h`, so `SYS_chroot` does not exist. A protected or 
kernel build with `CONFIG_FS_CHROOT` fails to compile the system call proxy:
   
   ```
   proxies/PROXY_chroot.c:11:39: error: 'SYS_chroot' undeclared (first use in 
this function); did you mean 'SYS_chown'?
   ```
   
   This PR adds `chroot()` to the system call table, under `CONFIG_FS_CHROOT`, 
after the soft link calls.
   
   ## Impact
   
   Protected and kernel builds with `CONFIG_FS_CHROOT` now build, and programs 
can call `chroot()`. With `CONFIG_FS_CHROOT`, the numbers of the system calls 
after `chroot` move by one (the kernel and the user code are built together). 
Flat builds do not use the system call table: no change.
   
   ## Testing
   
   | | master | this PR |
   |---|---|---|
   | qemu-armv8a:knsh + `CONFIG_FS_CHROOT` (kernel, arm64) | build fails 
(`SYS_chroot` undeclared) | OK |
   | rv-virt:knsh64 + `CONFIG_FS_CHROOT` (kernel, rv64) | build fails 
(`SYS_chroot` undeclared) | OK |
   | rv-virt:pnsh64 + `CONFIG_FS_CHROOT` (protected, rv64) | build fails 
(`SYS_chroot` undeclared) | OK |
   | rv-virt:nsh64 + `CONFIG_FS_CHROOT` (flat, rv64) | | OK |
   
   Test program `chroot1.c` on qemu-armv8a:knsh (QEMU with HVF) with 
`CONFIG_FS_CHROOT`, `CONFIG_FS_TMPFS`, `CONFIG_FS_LINKS` and 
`CONFIG_SCHED_USER_IDENTITY`. Each case runs in a child process that calls 
`chroot()`: a jail on v9fs and on tmpfs, `..` stops at the root, an absolute 
soft link in the pseudo file system, `exec` and `fork()` inside the jail, 
`EPERM` for a user that is not root, a nested `chroot()`, `ENOENT` and 
`ENOTDIR`, and the parent stays unaffected. All 10 checks pass. On master the 
program cannot be built, because the kernel build fails.
   
   ostest exits with status 0 on qemu-armv8a:knsh and qemu-armv8a:nsh with 
these options.
   
   lm3s6965-ek:qemu-protected with `CONFIG_FS_CHROOT` compiles, but its user 
image is 2232 bytes too large for its flash.
   
   `tools/checkpatch.sh -c -u -m -g` passes. No documentation change: 
`Documentation/os/filesystem/chroot.rst` already describes the check at the 
system call boundary in protected and kernel builds.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to