Commit Graph

13 Commits

Author SHA1 Message Date
Minseo Kim 5015968dd8 pkg/system: fix `EOPNOTSUPP` to `ENOTSUP` for xattr syscalls
The lgetxattr(2), lsetxattr(2), and llistxattr(2) syscalls on Linux
return ENOTSUP instead of EOPNOTSUPP. The same applies to getxattr(2),
setxattr(2), and listxattr(2) on macOS.

Note that EOPNOTSUPP and ENOTSUP have the same value in Linux (refer to
errno(3)).

Signed-off-by: Minseo Kim <kimminss0@outlook.kr>
2024-11-29 18:32:32 +09:00
Robert Zaage 28f3ba9b89 fix storage-chown-by-maps doesnt handle -EOVERFLOW return by lgetxattr [Closes #1183]
Signed-off-by: Robert Zaage <robert@zaage.it>
2022-04-07 00:11:21 +02:00
Kir Kolyshkin 3bf3251882 system.*xattr: wrap errors into os.PathError
This way the error messages are more informative.

Convert all the users accordingly (assuming there are no users outside
of this repo).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-10-29 03:30:02 -07:00
Kir Kolyshkin 1c3c00d5f4 pkg/system: improve Llistxattr
The current code
 * is hard to read (at least for me, that is);
 * is suboptimal (always calls unix.Llistxattr() twice);
 * doesn't handle the condition when attributes size
   is changed in between the two calls to unix.Llistxattr()
   (see the detailed description in previous patch)

Fix all three issues by reusing the logic from Lgetxattr().

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-04 10:01:31 -08:00
Kir Kolyshkin dfa83c3e8f pkg/system: handle changed size case
lgetxattr(2) man page says:

> If size is specified as zero, these calls return the  current  size  of
> the  named extended attribute (and leave value unchanged).  This can be
> used to determine the size of the buffer that should be supplied  in  a
> subsequent  call.   (But, bear in mind that there is a possibility that
> the attribute value may change between the two calls,  so  that  it  is
> still necessary to check the return status from the second call.)

The current code does not handle the "bear in mind" case, i.e. when
the size changes between the two calls, and the new size is larger.

Fix the above problem, and slightly simplify the code.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-04 09:56:05 -08:00
Kir Kolyshkin f6e4402eb7 pkg/system/xattrs: minor cleanup
Types unix.Errno and syscall.Errno are identical
(as x/sys/unix says "type Errno = syscall.Errno"),
so we can use unix.Errno and save a line in imports.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-04 09:49:54 -08:00
Sascha Grunert aca03d333c
Fix possible runtime panic in Lgetxattr
Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-12-04 11:15:21 +01:00
Zac Medico 091491bbf7 pkg/archive: limit user xattr value size to math.MaxUint16 bytes
This should avoid the following panic in Lgetxattr:

    panic: runtime error: makeslice: len out of range

Fixes: 0da4bc60b3 ("pkg/archive: strictly handle errors reading xattrs")
See: https://travis-ci.org/containers/buildah/jobs/617652963
Signed-off-by: Zac Medico <zmedico@gmail.com>
2019-11-27 14:41:08 -08:00
Zac Medico 0da4bc60b3 pkg/archive: strictly handle errors reading xattrs
Suggested-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Zac Medico <zmedico@gmail.com>
2019-11-22 11:05:31 -08:00
Zac Medico 5fc095c06d VFS support for user.* xattrs
Preservation of user.* xattrs is supported by most (if not all) other
drivers, and it's especially useful for containers that run under a
PaX kernel where "user.pax.flags" is used to store PaX flags.

Signed-off-by: Zac Medico <zmedico@gmail.com>
2019-11-20 22:15:20 -08:00
Daniel J Walsh f39066fe1b Update packages to match latest code in moby/pkg
Had to vendor in a new version of golang.org/x/net to build
Also had to make some changes to drivers to handle
archive.Reader -> io.Reader
archive.Archive -> io.ReadCloser

Also update .gitingore to ignore emacs files, containers-storage.*
and generated man pages.

Also no longer test travis against golang 1.7, cri-o, moby have also
done this.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2017-09-12 18:00:29 +00:00
Zhang Wei 7e420ad850 fix golint warnings/errors on `pkg/system` and `pkg/stdcopy`
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2015-08-13 18:47:13 +08:00
Alexander Larsson d6114c0da0 Create pkg/system and move stuff there from archive
This is a package for generic system calls etc that for some reason
is not yet supported by "syscall", or where it is different enough
for the different ports to need portability wrappers.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-03-05 14:05:32 +01:00