All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH pseudo] ports/linux: wrap faccessat()
@ 2019-08-01 16:02 Max Kellermann
  2019-08-01 16:17 ` Seebs
  2019-08-01 16:31 ` ✗ patchtest: failure for ports/linux: wrap faccessat() Patchwork
  0 siblings, 2 replies; 6+ messages in thread
From: Max Kellermann @ 2019-08-01 16:02 UTC (permalink / raw)
  To: openembedded-core; +Cc: Max Kellermann

From: Max Kellermann <max.kellermann@gmail.com>

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
---
 ports/linux/guts/faccessat.c | 33 +++++++++++++++++++++++++++++++++
 ports/linux/wrapfuncs.in     |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 ports/linux/guts/faccessat.c

diff --git a/ports/linux/guts/faccessat.c b/ports/linux/guts/faccessat.c
new file mode 100644
index 0000000..be13bbc
--- /dev/null
+++ b/ports/linux/guts/faccessat.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2019 Max Kellermann <max.kellermann@gmail.com>
+ * guts/COPYRIGHT for information.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ * static int
+ * wrap_access(int dirfd, const char *path, int mode, int flags) {
+ *	int rc = -1;
+ */
+	struct stat64 buf;
+
+	/* note:  no attempt to handle the case where user isn't
+	 * root.
+	 */
+	rc = real___fxstatat64(_STAT_VER, dirfd, path, &buf, AT_SYMLINK_NOFOLLOW);
+	if (rc == -1)
+		return rc;
+
+	if (mode & X_OK) {
+		if (buf.st_mode & 0111) {
+			return 0;
+		} else {
+			errno = EPERM;
+			return -1;
+		}
+	} else {
+		return 0;
+	}
+
+/*	return rc;
+ * }
+ */
diff --git a/ports/linux/wrapfuncs.in b/ports/linux/wrapfuncs.in
index a129eba..2a118fc 100644
--- a/ports/linux/wrapfuncs.in
+++ b/ports/linux/wrapfuncs.in
@@ -56,3 +56,4 @@ int getgrent_r(struct group *gbuf, char *buf, size_t buflen, struct group **gbuf
 int capset(cap_user_header_t hdrp, const cap_user_data_t datap); /* real_func=pseudo_capset */
 long syscall(long nr, ...); /* hand_wrapped=1 */
 int renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, unsigned int flags); /* flags=AT_SYMLINK_NOFOLLOW */
+int faccessat(int dirfd, const char *path, int mode, int flags);
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH pseudo] ports/linux: wrap faccessat()
  2019-08-01 16:02 [PATCH pseudo] ports/linux: wrap faccessat() Max Kellermann
@ 2019-08-01 16:17 ` Seebs
  2019-08-01 16:19   ` Max Kellermann
                     ` (2 more replies)
  2019-08-01 16:31 ` ✗ patchtest: failure for ports/linux: wrap faccessat() Patchwork
  1 sibling, 3 replies; 6+ messages in thread
From: Seebs @ 2019-08-01 16:17 UTC (permalink / raw)
  To: Max Kellermann; +Cc: Max Kellermann, openembedded-core

On Thu,  1 Aug 2019 18:02:06 +0200
Max Kellermann <max+openembedded@blarg.de> wrote:

> + * wrap_access(int dirfd, const char *path, int mode, int flags) {

This should probably say "faccessat". I know it's just a comment, but
I try to be consistent about these.

> +	rc = real___fxstatat64(_STAT_VER, dirfd, path, &buf, AT_SYMLINK_NOFOLLOW);

We should probably be using flags here, not AT_SYMLINK_NOFOLLOW.
Or possibly (flags & AT_SYMLINK_NOFOLLOW). Otherwise, we'll get the wrong
results if called with flags not including AT_SYMLINK_NOFOLLOW.

-s


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH pseudo] ports/linux: wrap faccessat()
  2019-08-01 16:17 ` Seebs
@ 2019-08-01 16:19   ` Max Kellermann
  2019-08-01 16:20   ` [PATCH pseudo v2] " Max Kellermann
  2019-08-01 16:31   ` ✗ patchtest: failure for ports/linux: wrap faccessat() (rev2) Patchwork
  2 siblings, 0 replies; 6+ messages in thread
From: Max Kellermann @ 2019-08-01 16:19 UTC (permalink / raw)
  To: Seebs; +Cc: openembedded-core

On 2019/08/01 18:17, Seebs <seebs@seebs.net> wrote:
> > +	rc = real___fxstatat64(_STAT_VER, dirfd, path, &buf, AT_SYMLINK_NOFOLLOW);
> 
> We should probably be using flags here, not AT_SYMLINK_NOFOLLOW.
> Or possibly (flags & AT_SYMLINK_NOFOLLOW). Otherwise, we'll get the wrong
> results if called with flags not including AT_SYMLINK_NOFOLLOW.

Thanks, I missed that there was indeed a "flags" parameter which can
be forwarded.  Will resend the patch.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH pseudo v2] ports/linux: wrap faccessat()
  2019-08-01 16:17 ` Seebs
  2019-08-01 16:19   ` Max Kellermann
@ 2019-08-01 16:20   ` Max Kellermann
  2019-08-01 16:31   ` ✗ patchtest: failure for ports/linux: wrap faccessat() (rev2) Patchwork
  2 siblings, 0 replies; 6+ messages in thread
From: Max Kellermann @ 2019-08-01 16:20 UTC (permalink / raw)
  To: openembedded-core; +Cc: Max Kellermann

From: Max Kellermann <max.kellermann@gmail.com>

Signed-off-by: Max Kellermann <max.kellermann@gmail.com>
---
 ports/linux/guts/faccessat.c | 33 +++++++++++++++++++++++++++++++++
 ports/linux/wrapfuncs.in     |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644 ports/linux/guts/faccessat.c

diff --git a/ports/linux/guts/faccessat.c b/ports/linux/guts/faccessat.c
new file mode 100644
index 0000000..64189fa
--- /dev/null
+++ b/ports/linux/guts/faccessat.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2019 Max Kellermann <max.kellermann@gmail.com>
+ * guts/COPYRIGHT for information.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-only
+ *
+ * static int
+ * wrap_faccessat(int dirfd, const char *path, int mode, int flags) {
+ *	int rc = -1;
+ */
+	struct stat64 buf;
+
+	/* note:  no attempt to handle the case where user isn't
+	 * root.
+	 */
+	rc = real___fxstatat64(_STAT_VER, dirfd, path, &buf, flags);
+	if (rc == -1)
+		return rc;
+
+	if (mode & X_OK) {
+		if (buf.st_mode & 0111) {
+			return 0;
+		} else {
+			errno = EPERM;
+			return -1;
+		}
+	} else {
+		return 0;
+	}
+
+/*	return rc;
+ * }
+ */
diff --git a/ports/linux/wrapfuncs.in b/ports/linux/wrapfuncs.in
index a129eba..2a118fc 100644
--- a/ports/linux/wrapfuncs.in
+++ b/ports/linux/wrapfuncs.in
@@ -56,3 +56,4 @@ int getgrent_r(struct group *gbuf, char *buf, size_t buflen, struct group **gbuf
 int capset(cap_user_header_t hdrp, const cap_user_data_t datap); /* real_func=pseudo_capset */
 long syscall(long nr, ...); /* hand_wrapped=1 */
 int renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, unsigned int flags); /* flags=AT_SYMLINK_NOFOLLOW */
+int faccessat(int dirfd, const char *path, int mode, int flags);
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* ✗ patchtest: failure for ports/linux: wrap faccessat()
  2019-08-01 16:02 [PATCH pseudo] ports/linux: wrap faccessat() Max Kellermann
  2019-08-01 16:17 ` Seebs
@ 2019-08-01 16:31 ` Patchwork
  1 sibling, 0 replies; 6+ messages in thread
From: Patchwork @ 2019-08-01 16:31 UTC (permalink / raw)
  To: Max Kellermann; +Cc: openembedded-core

== Series Details ==

Series: ports/linux: wrap faccessat()
Revision: 1
URL   : https://patchwork.openembedded.org/series/19012/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             Series does not apply on top of target branch [test_series_merge_on_head] 
  Suggested fix    Rebase your series on top of targeted branch
  Targeted branch  master (currently at fc634c41e4)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 6+ messages in thread

* ✗ patchtest: failure for ports/linux: wrap faccessat() (rev2)
  2019-08-01 16:17 ` Seebs
  2019-08-01 16:19   ` Max Kellermann
  2019-08-01 16:20   ` [PATCH pseudo v2] " Max Kellermann
@ 2019-08-01 16:31   ` Patchwork
  2 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2019-08-01 16:31 UTC (permalink / raw)
  To: Max Kellermann; +Cc: openembedded-core

== Series Details ==

Series: ports/linux: wrap faccessat() (rev2)
Revision: 2
URL   : https://patchwork.openembedded.org/series/19012/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             Series does not apply on top of target branch [test_series_merge_on_head] 
  Suggested fix    Rebase your series on top of targeted branch
  Targeted branch  master (currently at fc634c41e4)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Guidelines:     https://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-08-01 16:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-01 16:02 [PATCH pseudo] ports/linux: wrap faccessat() Max Kellermann
2019-08-01 16:17 ` Seebs
2019-08-01 16:19   ` Max Kellermann
2019-08-01 16:20   ` [PATCH pseudo v2] " Max Kellermann
2019-08-01 16:31   ` ✗ patchtest: failure for ports/linux: wrap faccessat() (rev2) Patchwork
2019-08-01 16:31 ` ✗ patchtest: failure for ports/linux: wrap faccessat() Patchwork

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.