[pseudo][PATCH 4/6] pseudo_client.h: Add +s to PSEUDO_DB_MODE for mkdir
Mark Hatle <[email protected]>
| Newsgroups | org.yoctoproject.lists.yocto-patches |
|---|---|
| Message-ID | <[email protected]> |
From: Mark Hatle <[email protected]> During a mkdir the kernel will automatically filter out S_ISUID and S_ISGID for non-root users. This would result in an emulated ug+s on a directory losing the +s. This resolves the issue, and we need to remember to account for it in the future. AI-Generated: Implemented with the assistance of github CoPilot (Claude Opus 4.6) Signed-off-by: Mark Hatle <[email protected]> Signed-off-by: Mark Hatle <[email protected]> --- pseudo_client.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pseudo_client.h b/pseudo_client.h index b5ec204..9d98ea1 100644 --- a/pseudo_client.h +++ b/pseudo_client.h @@ -90,7 +90,10 @@ extern int read_pidfile(FILE *, int *); * * Note: PSEUDO_DB_MODE must be kept in sync with PSEUDO_FS_MODE, as the * former defined which filesystem mode bits must be loaded from the DB. + * + * Note: S_ISUID and S_ISGID may be stripped during a mkdir as a user, + * account for this in PSEUDO_DB_MODE. */ #define PSEUDO_FS_MODE(mode, isdir) (((mode) | S_IRUSR | S_IWUSR | ((isdir) ? S_IXUSR : 0)) & ~(S_IWGRP | S_IWOTH)) -#define PSEUDO_DB_MODE(fs_mode, user_mode) (((fs_mode) & ~(S_IRUSR | S_IWUSR | S_IXUSR | S_IWGRP | S_IWOTH)) | ((user_mode) & (S_IRUSR | S_IWUSR | S_IXUSR | S_IWGRP | S_IWOTH))) +#define PSEUDO_DB_MODE(fs_mode, user_mode) (((fs_mode) & ~(S_IRUSR | S_IWUSR | S_IXUSR | S_IWGRP | S_IWOTH | S_ISUID | S_ISGID)) | ((user_mode) & (S_IRUSR | S_IWUSR | S_IXUSR | S_IWGRP | S_IWOTH | S_ISUID | S_ISGID))) -- 1.8.3.1