Skip to content

perf: fix: unify ZTS and NTS filesystem behaviour when possible - #25864

Open
henderkes wants to merge 4 commits into
php:masterfrom
henderkes:zts/unshare-chdir
Open

henderkes wants to merge 4 commits into
php:masterfrom
henderkes:zts/unshare-chdir

Conversation

@henderkes

@henderkes henderkes commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

meaning, for now, on Linux.

calls unshare(CLONE_FS), which detaches the calling thread from the parent threads filesystem state. This means a few things:

sadly dockers default security policy means this doesn't work in containers (by default)... not sure what to do about that yet.

@henderkes henderkes changed the title WIP: unify ZTS and NTS filesystem behaviour when possible perf: fix: unify ZTS and NTS filesystem behaviour when possible Nov 29, 2026
@henderkes
henderkes marked this pull request as ready for review November 29, 2026 05:43
Comment on lines +2697 to 2698
#if (defined(HAVE_CHROOT) && (!defined(ZTS) || defined(ZEND_HAVE_UNSHARE_FS)) && defined(ENABLE_CHROOT_FUNC))
function chroot(string $directory): bool {}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be fair, I'm not sure php should even have chroot, but there shouldn't be a difference between ZTS and NTS, so I included it in the PR.

Comment thread Zend/zend_virtual_cwd.c
static void cwd_globals_ctor(virtual_cwd_globals *cwd_g) /* {{{ */
{
CWD_STATE_COPY(&cwd_g->cwd, &main_cwd_state);
cwd_state_init(&cwd_g->cwd);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small fix for the existing virtual cwd handling as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant