Mail archive
alpine-devel

Re: [alpine-devel] [PATCH] apk-tools: archive: enable FIFO extraction

From: Timo Teras <timo.teras_at_iki.fi>
Date: Tue, 14 Aug 2018 17:51:17 +0300

Hi,

On Mon, 13 Aug 2018 00:57:52 -0500
Jesse Young <jlyo_at_jlyo.org> wrote:

> src/archive.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
>[...]
>
> _at_@ -431,6 +434,7 @@ int apk_archive_entry_extract(int atfd, const
> struct apk_file_info *ae, struct apk_xattr *xattr;
> char *fn = ae->name;
> int fd, r = -1, atflags = 0, ret = 0;
> + mode_t nodmask = S_IFBLK | S_IFCHR | S_IFIFO | 07777;
>
> if (suffix != NULL) {
> fn = alloca(PATH_MAX);
> _at_@ -477,11 +481,10 @@ int apk_archive_entry_extract(int atfd, const
> struct apk_file_info *ae, if (r < 0) ret = -errno;
> atflags |= AT_SYMLINK_NOFOLLOW;
> break;
> - case S_IFSOCK:
> case S_IFBLK:
> case S_IFCHR:
> case S_IFIFO:
> - r = mknodat(atfd, fn, ae->mode & 07777, ae->device);
> + r = mknodat(atfd, fn, ae->mode & nodmask,
> ae->device); if (r < 0) ret = -errno;
> break;
> }

The mode masking for mknodat() is an old bug. Let's just remove it. It
was added when the mask for other creation syscalls was changed from
0777 to 07777 to support setuid/setgid, but mknodat() really needs the
whole thing to create right type node.

Can you resubmit, or would you like me to amend your patch?

Thanks!

Timo


---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Tue Aug 14 2018 - 17:51:17 GMT