Commit Graph

6954 Commits

Author SHA1 Message Date
Sebastiaan van Stijn 5b09a71228 libct/userns: change RunningInUserNS to a wrapper instead of an alias
This was a poor decision on my side; 4316df8b53
moved this utility to a separate package, and split the exported function
from the implementation (and stubs). Out of convenience, I used an alias
for the latter part, but there's two downsides to that;

- `RunningInUserNS` being an exported var means that (technically) it can
  be replaced by other code; perhaps that's a "feature", but not one we
  intended it to be used for.
- `RunningInUserNS` being implemented through a var / alias means it's
  also documented as such on [pkg.go.dev], which is confusing.

This patch changes it to a regular function, acting as a wrapper for
the underlying implementations. While at it, also slightly touching
up the GoDoc to describe its functionality / behavior.

[pkg.go.dev]: https://pkg.go.dev/github.com/opencontainers/runc@v1.1.13/libcontainer/userns#RunningInUserNS

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-01 19:20:35 +02:00
Kir Kolyshkin 7bcb61118b Merge pull request #4329 from thaJeztah/rm_old_buildtags
remove pre-go1.17 build-tags
2024-07-01 10:18:11 -07:00
Sebastiaan van Stijn c14213399a remove pre-go1.17 build-tags
Removed pre-go1.17 build-tags with go fix;

    go fix -mod=readonly ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-29 15:45:25 +02:00
Kir Kolyshkin ab010ae1ef Merge pull request #4319 from lifubang/fix-execfifo-delete-error
Try to delete exec fifo file when failure in creation
2024-06-26 11:53:34 -07:00
Kir Kolyshkin 213fefd25d Merge pull request #4317 from lifubang/release-1.2.0-rc.2
Release 1.2.0-rc.2
2024-06-26 10:23:31 -07:00
lifubang 5ea7625401 VERSION: back to development
Signed-off-by: lifubang <lifubang@acmcoder.com>
2024-06-26 20:03:03 +08:00
lifubang f2d2ee5e45 VERSION: release 1.2.0-rc.2
Signed-off-by: lifubang <lifubang@acmcoder.com>
v1.2.0-rc.2
2024-06-26 20:03:03 +08:00
Kir Kolyshkin 095e9e5c02 Merge pull request #4324 from kolyshkin/michael
MAINTAINERS: move crosbymichael to EMERITUS; remove chief maintainer role
2024-06-24 18:21:38 -07:00
Kir Kolyshkin ee601b87f9 MAINTAINERS_GUIDE: rm chief maintainer role
Since Michael Crosby is stepping down, and we don't want to nominate
someone else to be a chief maintainer, let's remove the position.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-24 16:50:52 -07:00
Kir Kolyshkin d6563f6bcd MAINTAINERS: move crosbymichael to EMERITUS
I talked to Michael, he says he is stepping down as a maintainer, being
busy with other stuff.

Thank you for all the hard work that you did!

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-23 12:53:57 -07:00
Kir Kolyshkin 90ebcca8f1 Merge pull request #4314 from kolyshkin/maint-rata
MAINTAINERS: add Rodrigo Campos

LGTMs: crosbymichael mrunalp dqminh hqhq cyphar AkihiroSuda kolyshkin thaJeztah lifubang
Vote: +8 -0 #1
2024-06-20 17:00:07 -07:00
Akihiro Suda 8256a9384f Merge pull request #4322 from lifubang/changelog-sortby-ver
Put the changelog of v1.1.13 after v1.2.0-rc.1
2024-06-20 14:55:10 +09:00
lfbzhm ad976aa155 put the changelog of v1.1.13 after v1.2.0-rc.1
Signed-off-by: lfbzhm <lifubang@acmcoder.com>
2024-06-19 14:09:02 +00:00
Sebastiaan van Stijn fd5675e386 Merge pull request #4321 from lifubang/update-changelog-release-1.1.13
update changelog after v1.1.13 released
2024-06-14 01:35:57 +02:00
Akihiro Suda ac26d3d158 Merge pull request #4320 from kolyshkin/nits
Some nits I found from older PRs
2024-06-14 07:45:34 +09:00
lfbzhm 4e2d7c0a6e update changelog after v1.1.13 released
Signed-off-by: lfbzhm <lifubang@acmcoder.com>
2024-06-13 22:45:00 +00:00
Kir Kolyshkin 2cb46c6e0d script/keyring_validate.sh: fix a typo
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-13 08:03:08 -07:00
Kir Kolyshkin d6e427e1ea runc exec: avoid stuttering in error messages
An error from strconv.Atoi already contains the text it fails to parse.
Because of that, errors look way too verbose, e.g.:

	[root@kir-rhat runc-tst]# ./runc exec --user 1:1:1 2345 true
	ERRO[0000] exec failed: parsing 1:1 as int for gid failed: strconv.Atoi: parsing "1:1": invalid syntax

With this patch, the error looks like this now:

	[root@kir-rhat runc]# ./runc exec --user 1:1:1 2345 true
	ERRO[0000] exec failed: bad gid: strconv.Atoi: parsing "1:1": invalid syntax

Still not awesome, but better.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-12 21:03:10 -07:00
Kir Kolyshkin a6d46ed1a7 runc exec: improve options parsing
1. Do not ask for the same option value twice.

2. For tty, we always want false, unless specified, and this is what
   GetBool gets us.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-12 20:59:01 -07:00
lfbzhm 9d600197be Merge pull request #4271 from kolyshkin/two-inits
libct.Start: fix locking, do not allow a second container init
2024-06-11 18:37:40 +08:00
Kir Kolyshkin 42cea2ecb4 libct: don't allow to start second init process
By definition, every container has only 1 init (i.e. PID 1) process.

Apparently, libcontainer API supported running more than 1 init, and
at least one tests mistakenly used it.

Let's not allow that, erroring out if we already have init. Doing
otherwise _probably_ results in some confusion inside the library.

Fix two cases in libct/int which ran two inits inside a container.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-10 22:30:03 -07:00
Kir Kolyshkin e3e1072575 libct: fix locking in Start/Run/Exec
1. The code to call c.exec from c.Run was initially added by commit
   3aacff695. At the time, there was a lock in c.Run. That lock was
   removed by commit bd3c4f84, which resulted in part of c.Run executing
   without the lock.

2. All the Start/Run/Exec calls were a mere wrappers for start/run/exec
   adding a lock, but some more code crept into Start at some point,
   e.g. by commits 805b8c73 and 108ee85b8. Since the reason mentioned in
   commit 805b8c73 is no longer true after refactoring, we can fix this.

Fix both issues by moving code out of wrappers, and adding locking into
c.Run.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-10 22:30:03 -07:00
Kir Kolyshkin 304a4c0fee libct: createExecFifo: rm unneeded os.Stat
In case file already exists, mknod(2) will return EEXIST.

This os.Stat call was (inadvertently?) added by commit 805b8c73.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-10 22:30:03 -07:00
lifubang e7294527e2 try to delete exec fifo file when failure in creation
Signed-off-by: lifubang <lifubang@acmcoder.com>
2024-06-10 19:51:48 +08:00
lfbzhm 349e5ab7c1 Merge pull request #4283 from kolyshkin/revert-cpu-aff
Revert "Set temporary single CPU affinity before cgroup cpuset transition"
2024-06-10 06:54:53 +08:00
Kir Kolyshkin 1c505fffdc Revert "Set temporary single CPU affinity..."
There's too much logic here figuring out which CPUs to use. Runc is a
low level tool and is not supposed to be that "smart". What's worse,
this logic is executed on every exec, making it slower. Some of the
logic in (*setnsProcess).start is executed even if no annotation is set,
thus making ALL execs slow.

Also, this should be a property of a process, rather than annotation.

The plan is to rework this.

This reverts commit afc23e3397.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-10 06:31:03 +08:00
Kir Kolyshkin 67a1477959 Merge pull request #4285 from kolyshkin/f40
Vagrantfile.fedora: bump to F40
2024-06-09 15:26:38 -07:00
Akihiro Suda 30a7d9b863 Merge pull request #4186 from kolyshkin/multi-line
libct/cg: write unified resources line by line
2024-06-10 06:27:07 +09:00
Kir Kolyshkin f8f1bc9a30 Vagrantfile.fedora: bump to F40
Get the image from Fedora directly.

Also, remove the comment about cgroup v2 as it is also tested on Ubuntu
22.04 now.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-09 14:15:18 -07:00
Kir Kolyshkin 771903608c libct/cg: write unified resources line by line
It has been pointed out that some controllers can not accept multiple
lines of output at once. In particular, io.max can only set one device
at a time.

Practically, the only multi-line resource values we can get come from
unified.* -- let's write those line by line.

Add a test case.

Reported-by: Tao Shen <shentaoskyking@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-09 14:01:45 -07:00
Akihiro Suda 30b7b63974 Merge pull request #4311 from lifubang/fix-debug-msg-in-nsexec
fix a debug msg for user ns in nsexec
2024-06-08 19:57:50 +09:00
Akihiro Suda 865224d4e3 Merge pull request #4292 from kolyshkin/go122
Stop blacklisting Go 1.22+, drop Go < 1.21 support, use Go 1.22 in CI
2024-06-08 18:01:30 +09:00
lfbzhm a35a4c6807 Merge pull request #4189 from kolyshkin/fix-gpg-validate
script/*: fix gpg usage wrt keyboxd
2024-06-08 08:19:03 +08:00
Kir Kolyshkin 40dd884a00 MAINTAINERS: add Rodrigo Campos
I am nominating @rata for the role of runc maintainer.

He is pretty active in the project, did some substantial work
and is helping with PR review and releases.

As noted in MAINTAINERS_GUIDE.md, we have a week to vote, and need to
get 66% of current maintainers' votes.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-07 14:23:14 -07:00
Kir Kolyshkin 3019e842de libct/cg: use clear built-in
As we no longer support Go < 1.21.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-07 10:18:59 -07:00
Kir Kolyshkin b7fdd524cb libct: use slices package
As we're no longer supporting Go < 1.21.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-07 10:18:59 -07:00
Kir Kolyshkin a1e87f8d76 libct: rm eaccess
It is not needed since Go 1.20 (which was released in February 2023 and
is no longer supported since February 2024).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-07 10:18:59 -07:00
Kir Kolyshkin 6b2eb52fb0 go.mod,README: require Go 1.21
Go 1.20 was released in February 2023 and is no longer supported since
February 2024. Time to move on.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-07 10:18:59 -07:00
Kir Kolyshkin 17380da277 Dockerfile: switch to Go 1.22 and Debian 12
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-07 10:18:59 -07:00
Kir Kolyshkin a3302f2054 ci: switch to go 1.22 as main version
Now when Go 1.22.4 is out it should no longer be a problem.

Leave Go 1.21 for CentOS testing (CentOS 7 and 8 have older glibc)
and Dockerfile (Debian 11 have older glibc).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-07 10:18:59 -07:00
Kir Kolyshkin e660ef61a5 libct/nsenter: stop blacklisting go 1.22+
Go 1.23 includes a fix (https://go.dev/cl/587919) so go1.23.x can be
used. This fix is also backported to 1.22.4, so go1.22.x can also be
used (when x >= 4). Finally, for glibc >= 2.32 it doesn't really matter.

Add a note about Go 1.22.x > 1.22.4 to README as well.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-07 10:18:56 -07:00
lfbzhm a4b0857529 Merge pull request #4188 from kolyshkin/ci-swap
tests/int: swap-related fixes
2024-06-07 22:03:31 +08:00
lfbzhm 24c2d28d1f fix a debug msg for user ns in nsexec
Signed-off-by: lfbzhm <lifubang@acmcoder.com>
2024-06-06 14:30:29 +00:00
Kir Kolyshkin 3083bd443f tests/cgroups: separate cgroup v2 swap test
There are cgroup v2 systems out there that do not have cgroup swap enabled,
and this test will probably fail in there.

Move it to a separate case, guarded with requires cgroups_swap.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-06 18:52:34 +08:00
Kir Kolyshkin 4209439b5f libct/cg/fs/v2: ignore setting swap in some cases
When swap is being disabled (as set to 0), or set to max, ignore
non-existent memory.swap.max cgroup file.

If swap is being set explicitly to some value, do return an error like
before.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-06 18:52:34 +08:00
Kir Kolyshkin dbb011ecd9 tests/int/helpers: fix cgroups_swap check for v2
In case of cgroup v2, there's no memory.swap.max in the top-level
cgroup, so we have to use find.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-06 18:52:34 +08:00
Kir Kolyshkin 8626c7173e tests/int: fixup find statements
1. Add "-maxdepth 2" to not dive too deep into cgroup hierarchy.

2. Add "-type f" to look for a regular file.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-06 18:52:34 +08:00
Kir Kolyshkin e530b2a668 tests/int/update: fix v2 swap check
If swap is disabled, we should not run swap tests.

Fixes 4166.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-06-06 18:52:34 +08:00
Akihiro Suda 8fc5be4e60 Merge pull request #3908 from deitch/trimpath-optional
make trimpath optional
2024-06-06 11:23:09 +09:00
Avi Deitcher 024c2711f3 make trimpath optional
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2024-06-05 18:56:20 -07:00