All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Hatle <mark.hatle@kernel.crashing.org>
To: yocto-patches@lists.yoctoproject.org
Subject: [pseudo][PATCH 06/34] ports/unix: Remove guts overridden by the Linux port
Date: Tue, 10 Nov 2026 22:20:34 -0600	[thread overview]
Message-ID: <1794370862-30908-7-git-send-email-mark.hatle@kernel.crashing.org> (raw)
In-Reply-To: <1794370862-30908-1-git-send-email-mark.hatle@kernel.crashing.org>

From: Mark Hatle <mark.hatle@amd.com>

lchown, lutimes, mknod, mknodat, tmpnam and utimes are wrapped by both
ports/unix and ports/linux.  makewrappers always uses the Linux
versions, reporting "Info: <name> from linux overriding unix", so the
ports/unix guts and wrapfuncs.in entries are never used now that Linux
is the only port.

They were removed as a single commit, so if necessary they can be
restored via a git revert if a future port requires them.

AI-Generated: Uses GitHub Copilot
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
---
 README.security           |  2 +-
 ports/unix/guts/lchown.c  | 15 -----------
 ports/unix/guts/lutimes.c | 16 ------------
 ports/unix/guts/mknod.c   | 15 -----------
 ports/unix/guts/mknodat.c | 64 -----------------------------------------------
 ports/unix/guts/tmpnam.c  | 20 ---------------
 ports/unix/guts/utimes.c  | 15 -----------
 ports/unix/wrapfuncs.in   |  6 -----
 8 files changed, 1 insertion(+), 152 deletions(-)
 delete mode 100644 ports/unix/guts/lchown.c
 delete mode 100644 ports/unix/guts/lutimes.c
 delete mode 100644 ports/unix/guts/mknod.c
 delete mode 100644 ports/unix/guts/mknodat.c
 delete mode 100644 ports/unix/guts/tmpnam.c
 delete mode 100644 ports/unix/guts/utimes.c

diff --git a/README.security b/README.security
index f4378c3..8817450 100644
--- a/README.security
+++ b/README.security
@@ -92,7 +92,7 @@ that protection in several ways:
 * Several wrappers check a path and then act on it by path in a second
   step.  For example, fchmodat (ports/unix/guts/fchmodat.c) stats the
   path and later calls the real chmod on the same path, and mknodat
-  (ports/unix/guts/mknodat.c) removes the path again by name if the
+  (ports/linux/guts/__xmknodat.c) removes the path again by name if the
   database update fails.
 
 If anything else can change the tree while pseudo is working on it, an
diff --git a/ports/unix/guts/lchown.c b/ports/unix/guts/lchown.c
deleted file mode 100644
index 3a14e2f..0000000
--- a/ports/unix/guts/lchown.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2008,2011 Wind River Systems; see
- * guts/COPYRIGHT for information.
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- * int lchown(const char *path, uid_t owner, gid_t group)
- *	int rc = -1;
- */
-
-	rc = wrap_chown(path, owner, group);
-
-/*	return rc;
- * }
- */
diff --git a/ports/unix/guts/lutimes.c b/ports/unix/guts/lutimes.c
deleted file mode 100644
index 07cab66..0000000
--- a/ports/unix/guts/lutimes.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* 
- * Copyright (c) 2010 Wind River Systems; see
- * guts/COPYRIGHT for information.
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- * static int
- * wrap_lutimes(const char *path, const struct timeval *tv) {
- *	int rc = -1;
- */
-
-	rc = real_lutimes(path, tv);
-
-/*	return rc;
- * }
- */
diff --git a/ports/unix/guts/mknod.c b/ports/unix/guts/mknod.c
deleted file mode 100644
index aff3a0b..0000000
--- a/ports/unix/guts/mknod.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2011,2014 Wind River Systems; see
- * guts/COPYRIGHT for information.
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- * int mknod(const char *path, mode_t mode, dev_t dev)
- *	int rc = -1;
- */
-
-	rc = wrap_mknodat(AT_FDCWD, path, mode, dev);
-
-/*	return rc;
- * }
- */
diff --git a/ports/unix/guts/mknodat.c b/ports/unix/guts/mknodat.c
deleted file mode 100644
index 3e8b207..0000000
--- a/ports/unix/guts/mknodat.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2011 Wind River Systems; see
- * guts/COPYRIGHT for information.
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- * int mknodat(int dirfd, const char *path, mode_t mode, dev_t dev)
- *	int rc = -1;
- */
-
- 	pseudo_msg_t *msg;
-	PSEUDO_STATBUF buf;
-        int save_errno = errno;
-
-	/* mask out mode bits appropriately */
-	mode = mode & ~pseudo_umask;
-        /* if you don't specify a type, assume regular file */
-        if (!(mode & S_IFMT)) {
-                mode |= S_IFREG;
-        }
-        pseudo_debug(PDBGF_FILE, "mknodat creating '%s', mode 0%o\n",
-                path ? path : "<no name>", (int) mode);
-
-	rc = base_fstatat(dirfd, path, &buf, AT_SYMLINK_NOFOLLOW);
-	if (rc != -1) {
-		/* if we can stat the file, you can't mknod it */
-		errno = EEXIST;
-		return -1;
-	}
-	rc = real_openat(dirfd, path, O_CREAT | O_WRONLY | O_EXCL,
-		PSEUDO_FS_MODE(mode, 0));
-	if (rc == -1) {
-		return -1;
-	}
-	real_fchmod(rc, PSEUDO_FS_MODE(mode, 0));
-	base_fstat(rc, &buf);
-	/* mknod does not really open the file.  We don't have
-	 * to use wrap_close because we've never exposed this file
-	 * descriptor to the client code.
-	 */
-	real_close(rc);
-
-	/* mask in the mode type bits again */
-	buf.st_mode = (PSEUDO_DB_MODE(buf.st_mode, mode) & 07777) |
-			(mode & ~07777);
-	buf.st_rdev = dev;
-	msg = pseudo_client_op(OP_MKNOD, 0, -1, dirfd, path, &buf);
-	if (msg && msg->result != RESULT_SUCCEED) {
-		errno = EPERM;
-		rc = -1;
-	} else {
-		/* just pretend we worked */
-                errno = save_errno;
-		rc = 0;
-	}
-	if (rc == -1) {
-                save_errno = errno;
-		real_unlinkat(dirfd, path, AT_SYMLINK_NOFOLLOW);
-		errno = save_errno;
-	}
-
-/*	return rc;
- * }
- */
diff --git a/ports/unix/guts/tmpnam.c b/ports/unix/guts/tmpnam.c
deleted file mode 100644
index 60b66e0..0000000
--- a/ports/unix/guts/tmpnam.c
+++ /dev/null
@@ -1,20 +0,0 @@
-/* 
- * Copyright (c) 2010 Wind River Systems; see
- * guts/COPYRIGHT for information.
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- * static char *
- * wrap_tmpnam(char *s) {
- *	char * rc = NULL;
- */
-
-	/* let gcc know we're ignoring this */
-	(void) s;
-	pseudo_warning("tmpnam() is so ludicrously insecure as to defy implementation.");
-	errno = ENOMEM;
-	rc = NULL;
-
-/*	return rc;
- * }
- */
diff --git a/ports/unix/guts/utimes.c b/ports/unix/guts/utimes.c
deleted file mode 100644
index ec49f02..0000000
--- a/ports/unix/guts/utimes.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* 
- * Copyright (c) 2010 Wind River Systems; see
- * guts/COPYRIGHT for information.
- *
- * SPDX-License-Identifier: LGPL-2.1-only
- *
- * static int
- * wrap_utimes(const char *path, const struct timeval *times) {
- *	int rc = -1;
- */
-	rc = real_utimes(path, times);
-
-/*	return rc;
- * }
- */
diff --git a/ports/unix/wrapfuncs.in b/ports/unix/wrapfuncs.in
index 5ffee83..95fa89c 100644
--- a/ports/unix/wrapfuncs.in
+++ b/ports/unix/wrapfuncs.in
@@ -4,7 +4,6 @@ char *getwd(char *buf);
 int close(int fd);  /* noignore_path=1 */
 int fchmod(int fd, mode_t mode);
 int fchown(int fd, uid_t owner, gid_t group);
-int lchown(const char *path, uid_t owner, gid_t group); /* flags=AT_SYMLINK_NOFOLLOW, path_lock=shared */
 int dup2(int oldfd, int newfd); /* noignore_path=1 */
 int dup(int fd); /* noignore_path=1 */
 int chdir(const char *path); /* noignore_path=1 */
@@ -18,7 +17,6 @@ FTSENT *fts_children(FTS *ftsp, int options); /* noignore_path=1, path_lock=shar
 int ftw(const char *path, int (*fn)(const char *, const struct stat *, int), int nopenfd);
 int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, struct FTW *), int nopenfd, int flag);
 int glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob);
-int lutimes(const char *path, const struct timeval *tv); /* flags=AT_SYMLINK_NOFOLLOW */
 char *mkdtemp(char *template); /* path_lock=1 */
 char *mktemp(char *template);
 long pathconf(const char *path, int name);
@@ -27,10 +25,8 @@ int remove(const char *path); /* flags=AT_SYMLINK_NOFOLLOW */
 DIR *opendir(const char *path); /* noignore_path=1 */
 int closedir(DIR *dirp); /* noignore_path=1 */
 char *tempnam(const char *template, const char *pfx);
-char *tmpnam(char *s);
 int truncate(const char *path, off_t length);
 int utime(const char *path, const struct utimbuf *buf);
-int utimes(const char *path, const struct timeval *times);
 # needed because libc stdio does horrible things with inline asm syscalls
 FILE *fopen(const char *path, const char *mode); /* noignore_path=1 */
 int fclose(FILE *fp);  /* noignore_path=1 */
@@ -47,8 +43,6 @@ int mkdir(const char *path, mode_t mode); /* flags=AT_SYMLINK_NOFOLLOW, path_loc
 int mkdirat(int dirfd, const char *path, mode_t mode); /* flags=AT_SYMLINK_NOFOLLOW, path_lock=1 */
 int mkfifo(const char *path, mode_t mode); /* flags=AT_SYMLINK_NOFOLLOW, path_lock=1 */
 int mkfifoat(int dirfd, const char *path, mode_t mode); /* flags=AT_SYMLINK_NOFOLLOW, path_lock=1 */
-int mknod(const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW, path_lock=1 */
-int mknodat(int dirfd, const char *path, mode_t mode, dev_t dev); /* flags=AT_SYMLINK_NOFOLLOW, path_lock=1 */
 int mkstemp(char *template); /* flags=AT_SYMLINK_NOFOLLOW, path_lock=1 */
 int mkostemp(char *template, int oflags); /* flags=AT_SYMLINK_NOFOLLOW, path_lock=1 */
 int mkstemps(char *template, int suffixlen); /* flags=AT_SYMLINK_NOFOLLOW, path_lock=1 */
-- 
1.8.3.1


  parent reply	other threads:[~2026-11-11  4:21 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  4:20 [pseudo][PATCH 00/34] Various fixes Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 01/34] pseudo_client: serialize path changes across clients Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 02/34] ports: hold the path lock in create and metadata wrappers Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 03/34] ports: check created files under the path lock before recording them Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 04/34] test-parallel-ops: Add a parallel create/rename/link/chmod test Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 05/34] ports: Remove PSEUDO_NO_REAL_AT_FUNCTIONS Mark Hatle
2026-11-11  4:20 ` Mark Hatle [this message]
2026-11-11  4:20 ` [pseudo][PATCH 07/34] ports: Let the port define how pseudo stats files Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 08/34] patches/yocto-older-glibc-symbols.patch: Update to latest YP version Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 09/34] Remove unused #if 0 debug code Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 10/34] Replace #if 0 strerror() debug messages with a comment Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 11/34] pseudo_util: Remove stale with_libpseudo() comment Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 12/34] ports/common/subports: Show the unknown OS name in the error Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 13/34] ports/linux: Drop redundant PSEUDO_LINK_SYMLINK_BEHAVIOR override Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 14/34] pseudo_server: Skip events for clients closed earlier in the batch Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 15/34] pseudo_server: Drop an idle client when out of file descriptors Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 16/34] pseudo_server: Always use epoll Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 17/34] configure: Fix --disable-* options Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 18/34] pseudo_server: Lower highest_client when the highest client closes Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 19/34] pseudo_server: Set highest_client to the new client when growing Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 20/34] pseudo_util: Store PSEUDO_SEVERITY as severity names Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 21/34] pseudo: Fix the -k severity option Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 22/34] pseudo_util: Make -v and numeric PSEUDO_DEBUG add debug flags Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 23/34] AGENTS.md: Add to assist future developers Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 24/34] pseudo_util: Fix the date format in the event log dump Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 25/34] pseudo: List -p in the usage message Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 26/34] pseudo_util: Write the event log to PSEUDO_EVLOG_FILE Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 27/34] pseudo.1: Update to match the current code Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 28/34] ports/linux: Don't require <linux/mount.h> Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 29/34] configure: Require GCC 5 or later Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 30/34] doc: Update README and doc/ to match the code Mark Hatle
2026-11-11  4:20 ` [pseudo][PATCH 31/34] configure: Fix the --enable-profiling default Mark Hatle
2026-11-11  4:21 ` [pseudo][PATCH 32/34] pseudo_util: Skip unneeded lstat calls when canonicalizing paths Mark Hatle
2026-11-11  4:21 ` [pseudo][PATCH 33/34] wrappers: Don't re-block signals in nested wrapper calls Mark Hatle
2026-11-11  4:21 ` [pseudo][PATCH 34/34] Wrap execvpe(), fexecve() and execveat() Mark Hatle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1794370862-30908-7-git-send-email-mark.hatle@kernel.crashing.org \
    --to=mark.hatle@kernel.crashing.org \
    --cc=yocto-patches@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.