aboutsummaryrefslogtreecommitdiff
path: root/utils/podman/patches
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2020-12-21 12:01:07 +0000
committerDaniel Golle <dangowrt@users.noreply.github.com>2021-01-15 23:37:57 +0000
commit83d81616c5c5a2505fb171f1d97942baa3a83e63 (patch)
tree2a85976f316f9e84337700c014673f726fede2da /utils/podman/patches
parentbe75f779737dc09328eb60896f477fde27a21e4f (diff)
podman: fix build on MIPS
Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'utils/podman/patches')
-rw-r--r--utils/podman/patches/010-Fix-build-for-mips-architecture.patch134
-rw-r--r--utils/podman/patches/020-vendor-containers-psgo-v1.5.2.patch169
-rw-r--r--utils/podman/patches/030-Fix-build-for-mips-architecture-followup.patch24
-rw-r--r--utils/podman/patches/040-mips.patch70
4 files changed, 397 insertions, 0 deletions
diff --git a/utils/podman/patches/010-Fix-build-for-mips-architecture.patch b/utils/podman/patches/010-Fix-build-for-mips-architecture.patch
new file mode 100644
index 000000000..d568c2a7f
--- /dev/null
+++ b/utils/podman/patches/010-Fix-build-for-mips-architecture.patch
@@ -0,0 +1,134 @@
+From 1ad796677e1ce3f03463c791818176586987c389 Mon Sep 17 00:00:00 2001
+From: Paul Holzinger <paul.holzinger@web.de>
+Date: Mon, 21 Dec 2020 12:30:06 +0100
+Subject: [PATCH] Fix build for mips architecture
+
+The signal SIGSTKFLT does not exists on mips architectures.
+Also RTMIN and RTMAX are different.
+
+This code is copied from docker.
+
+Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
+---
+ pkg/signal/signal_linux.go | 1 +
+ pkg/signal/signal_linux_mipsx.go | 106 +++++++++++++++++++++++++++++++
+ 2 files changed, 107 insertions(+)
+ create mode 100644 pkg/signal/signal_linux_mipsx.go
+
+--- a/pkg/signal/signal_linux.go
++++ b/pkg/signal/signal_linux.go
+@@ -1,4 +1,5 @@
+ // +build linux
++// +build !mips,!mipsle,!mips64,!mips64le
+
+ // Signal handling for Linux only.
+ package signal
+--- /dev/null
++++ b/pkg/signal/signal_linux_mipsx.go
+@@ -0,0 +1,106 @@
++// +build linux
++// +build mips mipsle mips64 mips64le
++
++// Special signal handling for mips architecture
++package signal
++
++// Copyright 2013-2018 Docker, Inc.
++
++// NOTE: this package has originally been copied from github.com/docker/docker.
++
++import (
++ "os"
++ "os/signal"
++ "syscall"
++
++ "golang.org/x/sys/unix"
++)
++
++const (
++ sigrtmin = 34
++ sigrtmax = 127
++)
++
++// signalMap is a map of Linux signals.
++var signalMap = map[string]syscall.Signal{
++ "ABRT": unix.SIGABRT,
++ "ALRM": unix.SIGALRM,
++ "BUS": unix.SIGBUS,
++ "CHLD": unix.SIGCHLD,
++ "CLD": unix.SIGCLD,
++ "CONT": unix.SIGCONT,
++ "FPE": unix.SIGFPE,
++ "HUP": unix.SIGHUP,
++ "ILL": unix.SIGILL,
++ "INT": unix.SIGINT,
++ "IO": unix.SIGIO,
++ "IOT": unix.SIGIOT,
++ "KILL": unix.SIGKILL,
++ "PIPE": unix.SIGPIPE,
++ "POLL": unix.SIGPOLL,
++ "PROF": unix.SIGPROF,
++ "PWR": unix.SIGPWR,
++ "QUIT": unix.SIGQUIT,
++ "SEGV": unix.SIGSEGV,
++ "EMT": unix.SIGEMT,
++ "STOP": unix.SIGSTOP,
++ "SYS": unix.SIGSYS,
++ "TERM": unix.SIGTERM,
++ "TRAP": unix.SIGTRAP,
++ "TSTP": unix.SIGTSTP,
++ "TTIN": unix.SIGTTIN,
++ "TTOU": unix.SIGTTOU,
++ "URG": unix.SIGURG,
++ "USR1": unix.SIGUSR1,
++ "USR2": unix.SIGUSR2,
++ "VTALRM": unix.SIGVTALRM,
++ "WINCH": unix.SIGWINCH,
++ "XCPU": unix.SIGXCPU,
++ "XFSZ": unix.SIGXFSZ,
++ "RTMIN": sigrtmin,
++ "RTMIN+1": sigrtmin + 1,
++ "RTMIN+2": sigrtmin + 2,
++ "RTMIN+3": sigrtmin + 3,
++ "RTMIN+4": sigrtmin + 4,
++ "RTMIN+5": sigrtmin + 5,
++ "RTMIN+6": sigrtmin + 6,
++ "RTMIN+7": sigrtmin + 7,
++ "RTMIN+8": sigrtmin + 8,
++ "RTMIN+9": sigrtmin + 9,
++ "RTMIN+10": sigrtmin + 10,
++ "RTMIN+11": sigrtmin + 11,
++ "RTMIN+12": sigrtmin + 12,
++ "RTMIN+13": sigrtmin + 13,
++ "RTMIN+14": sigrtmin + 14,
++ "RTMIN+15": sigrtmin + 15,
++ "RTMAX-14": sigrtmax - 14,
++ "RTMAX-13": sigrtmax - 13,
++ "RTMAX-12": sigrtmax - 12,
++ "RTMAX-11": sigrtmax - 11,
++ "RTMAX-10": sigrtmax - 10,
++ "RTMAX-9": sigrtmax - 9,
++ "RTMAX-8": sigrtmax - 8,
++ "RTMAX-7": sigrtmax - 7,
++ "RTMAX-6": sigrtmax - 6,
++ "RTMAX-5": sigrtmax - 5,
++ "RTMAX-4": sigrtmax - 4,
++ "RTMAX-3": sigrtmax - 3,
++ "RTMAX-2": sigrtmax - 2,
++ "RTMAX-1": sigrtmax - 1,
++ "RTMAX": sigrtmax,
++}
++
++// CatchAll catches all signals and relays them to the specified channel.
++func CatchAll(sigc chan os.Signal) {
++ handledSigs := make([]os.Signal, 0, len(signalMap))
++ for _, s := range signalMap {
++ handledSigs = append(handledSigs, s)
++ }
++ signal.Notify(sigc, handledSigs...)
++}
++
++// StopCatch stops catching the signals and closes the specified channel.
++func StopCatch(sigc chan os.Signal) {
++ signal.Stop(sigc)
++ close(sigc)
++}
diff --git a/utils/podman/patches/020-vendor-containers-psgo-v1.5.2.patch b/utils/podman/patches/020-vendor-containers-psgo-v1.5.2.patch
new file mode 100644
index 000000000..255d9d869
--- /dev/null
+++ b/utils/podman/patches/020-vendor-containers-psgo-v1.5.2.patch
@@ -0,0 +1,169 @@
+From 21f5154399fc33959a4f3c42e29cade6757015c9 Mon Sep 17 00:00:00 2001
+From: Valentin Rothberg <rothberg@redhat.com>
+Date: Tue, 5 Jan 2021 10:44:16 +0100
+Subject: [PATCH] vendor containers/psgo@v1.5.2
+
+Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
+---
+ go.mod | 2 +-
+ go.sum | 4 ++--
+ .../internal/capabilities/capabilities.go | 2 +-
+ .../containers/psgo/internal/dev/tty.go | 5 ++--
+ .../containers/psgo/internal/proc/status.go | 2 +-
+ .../psgo/internal/process/process.go | 4 ++--
+ vendor/github.com/containers/psgo/psgo.go | 24 +++++++++----------
+ vendor/modules.txt | 2 +-
+ 8 files changed, 23 insertions(+), 22 deletions(-)
+
+--- a/go.mod
++++ b/go.mod
+@@ -14,7 +14,7 @@ require (
+ github.com/containers/common v0.29.0
+ github.com/containers/conmon v2.0.20+incompatible
+ github.com/containers/image/v5 v5.9.0
+- github.com/containers/psgo v1.5.1
++ github.com/containers/psgo v1.5.2
+ github.com/containers/storage v1.24.1
+ github.com/coreos/go-systemd/v22 v22.1.0
+ github.com/cri-o/ocicni v0.2.1-0.20201102180012-75c612fda1a2
+--- a/go.sum
++++ b/go.sum
+@@ -109,8 +109,8 @@ github.com/containers/libtrust v0.0.0-20
+ github.com/containers/libtrust v0.0.0-20190913040956-14b96171aa3b/go.mod h1:9rfv8iPl1ZP7aqh9YA68wnZv2NUDbXdcdPHVz0pFbPY=
+ github.com/containers/ocicrypt v1.0.3 h1:vYgl+RZ9Q3DPMuTfxmN+qp0X2Bj52uuY2vnt6GzVe1c=
+ github.com/containers/ocicrypt v1.0.3/go.mod h1:CUBa+8MRNL/VkpxYIpaMtgn1WgXGyvPQj8jcy0EVG6g=
+-github.com/containers/psgo v1.5.1 h1:MQNb7FLbXqBdqz6u4lI2QWizVz4RSTzs1+Nk9XT1iVA=
+-github.com/containers/psgo v1.5.1/go.mod h1:2ubh0SsreMZjSXW1Hif58JrEcFudQyIy9EzPUWfawVU=
++github.com/containers/psgo v1.5.2 h1:3aoozst/GIwsrr/5jnFy3FrJay98uujPCu9lTuSZ/Cw=
++github.com/containers/psgo v1.5.2/go.mod h1:2ubh0SsreMZjSXW1Hif58JrEcFudQyIy9EzPUWfawVU=
+ github.com/containers/storage v1.23.6/go.mod h1:haFs0HRowKwyzvWEx9EgI3WsL8XCSnBDb5f8P5CAxJY=
+ github.com/containers/storage v1.23.7/go.mod h1:cUT2zHjtx+WlVri30obWmM2gpqpi8jfPsmIzP1TVpEI=
+ github.com/containers/storage v1.24.0 h1:Fo2LkF7tkMLmo38sTZ/G8wHjcn8JfUFPfyTxM4WwMfk=
+--- a/vendor/github.com/containers/psgo/internal/capabilities/capabilities.go
++++ b/vendor/github.com/containers/psgo/internal/capabilities/capabilities.go
+@@ -13,7 +13,7 @@
+ // limitations under the License.
+
+ // Package capabilities provides a mapping from common kernel bit masks to the
+-// alphanumerical represenation of kernel capabilities. See capabilities(7)
++// alphanumerical representation of kernel capabilities. See capabilities(7)
+ // for additional information.
+ package capabilities
+
+--- a/vendor/github.com/containers/psgo/internal/dev/tty.go
++++ b/vendor/github.com/containers/psgo/internal/dev/tty.go
+@@ -113,8 +113,9 @@ func TTYs() (*[]TTY, error) {
+ }
+ s := fi.Sys().(*syscall.Stat_t)
+ t := TTY{
+- Minor: minDevNum(s.Rdev),
+- Major: majDevNum(s.Rdev),
++ // Rdev is type uint32 on mips arch so we have to cast to uint64
++ Minor: minDevNum(uint64(s.Rdev)),
++ Major: majDevNum(uint64(s.Rdev)),
+ Path: dev,
+ }
+ ttys = append(ttys, t)
+--- a/vendor/github.com/containers/psgo/internal/proc/status.go
++++ b/vendor/github.com/containers/psgo/internal/proc/status.go
+@@ -24,7 +24,7 @@ import (
+ "github.com/pkg/errors"
+ )
+
+-// Status is a direct translation of a `/proc/[pid]/status`, wich provides much
++// Status is a direct translation of a `/proc/[pid]/status`, which provides much
+ // of the information in /proc/[pid]/stat and /proc/[pid]/statm in a format
+ // that's easier for humans to parse.
+ type Status struct {
+--- a/vendor/github.com/containers/psgo/internal/process/process.go
++++ b/vendor/github.com/containers/psgo/internal/process/process.go
+@@ -31,9 +31,9 @@ type Process struct {
+ Pid string
+ // Stat contains data from /proc/$pid/stat.
+ Stat proc.Stat
+- // Status containes data from /proc/$pid/status.
++ // Status contains data from /proc/$pid/status.
+ Status proc.Status
+- // CmdLine containes data from /proc/$pid/cmdline.
++ // CmdLine contains data from /proc/$pid/cmdline.
+ CmdLine []string
+ // Label containers data from /proc/$pid/attr/current.
+ Label string
+--- a/vendor/github.com/containers/psgo/psgo.go
++++ b/vendor/github.com/containers/psgo/psgo.go
+@@ -482,7 +482,7 @@ func JoinNamespaceAndProcessInfoByPidsWi
+ // catch race conditions
+ continue
+ }
+- return nil, errors.Wrapf(err, "error extracing PID namespace")
++ return nil, errors.Wrapf(err, "error extracting PID namespace")
+ }
+ if _, exists := nsMap[ns]; !exists {
+ nsMap[ns] = true
+@@ -759,7 +759,7 @@ func processVSZ(p *process.Process, ctx
+ }
+
+ // parseCAP parses cap (a string bit mask) and returns the associated set of
+-// capabilities. If all capabilties are set, "full" is returned. If no
++// capabilities. If all capabilities are set, "full" is returned. If no
+ // capability is enabled, "none" is returned.
+ func parseCAP(cap string) (string, error) {
+ mask, err := strconv.ParseUint(cap, 16, 64)
+@@ -777,36 +777,36 @@ func parseCAP(cap string) (string, error
+ return strings.Join(caps, ","), nil
+ }
+
+-// processCAPAMB returns the set of ambient capabilties associated with
+-// process p. If all capabilties are set, "full" is returned. If no
++// processCAPAMB returns the set of ambient capabilities associated with
++// process p. If all capabilities are set, "full" is returned. If no
+ // capability is enabled, "none" is returned.
+ func processCAPAMB(p *process.Process, ctx *psContext) (string, error) {
+ return parseCAP(p.Status.CapAmb)
+ }
+
+-// processCAPINH returns the set of inheritable capabilties associated with
+-// process p. If all capabilties are set, "full" is returned. If no
++// processCAPINH returns the set of inheritable capabilities associated with
++// process p. If all capabilities are set, "full" is returned. If no
+ // capability is enabled, "none" is returned.
+ func processCAPINH(p *process.Process, ctx *psContext) (string, error) {
+ return parseCAP(p.Status.CapInh)
+ }
+
+-// processCAPPRM returns the set of permitted capabilties associated with
+-// process p. If all capabilties are set, "full" is returned. If no
++// processCAPPRM returns the set of permitted capabilities associated with
++// process p. If all capabilities are set, "full" is returned. If no
+ // capability is enabled, "none" is returned.
+ func processCAPPRM(p *process.Process, ctx *psContext) (string, error) {
+ return parseCAP(p.Status.CapPrm)
+ }
+
+-// processCAPEFF returns the set of effective capabilties associated with
+-// process p. If all capabilties are set, "full" is returned. If no
++// processCAPEFF returns the set of effective capabilities associated with
++// process p. If all capabilities are set, "full" is returned. If no
+ // capability is enabled, "none" is returned.
+ func processCAPEFF(p *process.Process, ctx *psContext) (string, error) {
+ return parseCAP(p.Status.CapEff)
+ }
+
+-// processCAPBND returns the set of bounding capabilties associated with
+-// process p. If all capabilties are set, "full" is returned. If no
++// processCAPBND returns the set of bounding capabilities associated with
++// process p. If all capabilities are set, "full" is returned. If no
+ // capability is enabled, "none" is returned.
+ func processCAPBND(p *process.Process, ctx *psContext) (string, error) {
+ return parseCAP(p.Status.CapBnd)
+--- a/vendor/modules.txt
++++ b/vendor/modules.txt
+@@ -160,7 +160,7 @@ github.com/containers/ocicrypt/keywrap/p
+ github.com/containers/ocicrypt/keywrap/pkcs7
+ github.com/containers/ocicrypt/spec
+ github.com/containers/ocicrypt/utils
+-# github.com/containers/psgo v1.5.1
++# github.com/containers/psgo v1.5.2
+ github.com/containers/psgo
+ github.com/containers/psgo/internal/capabilities
+ github.com/containers/psgo/internal/cgroups
diff --git a/utils/podman/patches/030-Fix-build-for-mips-architecture-followup.patch b/utils/podman/patches/030-Fix-build-for-mips-architecture-followup.patch
new file mode 100644
index 000000000..0c4942ef0
--- /dev/null
+++ b/utils/podman/patches/030-Fix-build-for-mips-architecture-followup.patch
@@ -0,0 +1,24 @@
+From fcba0df068d07ee7a26ec9d891220233d7d17dfd Mon Sep 17 00:00:00 2001
+From: Paul Holzinger <paul.holzinger@web.de>
+Date: Wed, 6 Jan 2021 23:32:40 +0100
+Subject: [PATCH] Fix build for mips architecture followup
+
+Followup to commit (1ad796677e1c). The build on mips is still
+failing because SIGWINCH was not defined in the signal pkg.
+
+Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
+---
+ pkg/signal/signal_linux_mipsx.go | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/pkg/signal/signal_linux_mipsx.go
++++ b/pkg/signal/signal_linux_mipsx.go
+@@ -19,6 +19,8 @@ import (
+ const (
+ sigrtmin = 34
+ sigrtmax = 127
++
++ SIGWINCH = syscall.SIGWINCH
+ )
+
+ // signalMap is a map of Linux signals.
diff --git a/utils/podman/patches/040-mips.patch b/utils/podman/patches/040-mips.patch
new file mode 100644
index 000000000..ce0017244
--- /dev/null
+++ b/utils/podman/patches/040-mips.patch
@@ -0,0 +1,70 @@
+--- a/pkg/spec/config_linux.go
++++ b/pkg/spec/config_linux.go
+@@ -294,8 +294,8 @@ func (c *CreateConfig) createBlockIO() (
+ lwd := spec.LinuxWeightDevice{
+ Weight: &wd.Weight,
+ }
+- lwd.Major = int64(unix.Major(wdStat.Rdev))
+- lwd.Minor = int64(unix.Minor(wdStat.Rdev))
++ lwd.Major = int64(unix.Major(uint64(wdStat.Rdev))) //nolint: unconvert
++ lwd.Minor = int64(unix.Minor(uint64(wdStat.Rdev))) //nolint: unconvert
+ lwds = append(lwds, lwd)
+ }
+ bio.WeightDevice = lwds
+@@ -357,8 +357,8 @@ func makeThrottleArray(throttleInput []s
+ ltd := spec.LinuxThrottleDevice{
+ Rate: t.rate,
+ }
+- ltd.Major = int64(unix.Major(ltdStat.Rdev))
+- ltd.Minor = int64(unix.Minor(ltdStat.Rdev))
++ ltd.Major = int64(unix.Major(uint64(ltdStat.Rdev))) // nolint: unconvert
++ ltd.Minor = int64(unix.Minor(uint64(ltdStat.Rdev))) // nolint: unconvert
+ ltds = append(ltds, ltd)
+ }
+ return ltds, nil
+--- a/pkg/specgen/generate/container.go
++++ b/pkg/specgen/generate/container.go
+@@ -282,8 +282,8 @@ func finishThrottleDevices(s *specgen.Sp
+ if err := unix.Stat(k, &statT); err != nil {
+ return err
+ }
+- v.Major = (int64(unix.Major(statT.Rdev)))
+- v.Minor = (int64(unix.Minor(statT.Rdev)))
++ v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert
++ v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert
+ s.ResourceLimits.BlockIO.ThrottleReadBpsDevice = append(s.ResourceLimits.BlockIO.ThrottleReadBpsDevice, v)
+ }
+ }
+@@ -293,8 +293,8 @@ func finishThrottleDevices(s *specgen.Sp
+ if err := unix.Stat(k, &statT); err != nil {
+ return err
+ }
+- v.Major = (int64(unix.Major(statT.Rdev)))
+- v.Minor = (int64(unix.Minor(statT.Rdev)))
++ v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert
++ v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert
+ s.ResourceLimits.BlockIO.ThrottleWriteBpsDevice = append(s.ResourceLimits.BlockIO.ThrottleWriteBpsDevice, v)
+ }
+ }
+@@ -304,8 +304,8 @@ func finishThrottleDevices(s *specgen.Sp
+ if err := unix.Stat(k, &statT); err != nil {
+ return err
+ }
+- v.Major = (int64(unix.Major(statT.Rdev)))
+- v.Minor = (int64(unix.Minor(statT.Rdev)))
++ v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert
++ v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert
+ s.ResourceLimits.BlockIO.ThrottleReadIOPSDevice = append(s.ResourceLimits.BlockIO.ThrottleReadIOPSDevice, v)
+ }
+ }
+@@ -315,8 +315,8 @@ func finishThrottleDevices(s *specgen.Sp
+ if err := unix.Stat(k, &statT); err != nil {
+ return err
+ }
+- v.Major = (int64(unix.Major(statT.Rdev)))
+- v.Minor = (int64(unix.Minor(statT.Rdev)))
++ v.Major = (int64(unix.Major(uint64(statT.Rdev)))) // nolint: unconvert
++ v.Minor = (int64(unix.Minor(uint64(statT.Rdev)))) // nolint: unconvert
+ s.ResourceLimits.BlockIO.ThrottleWriteIOPSDevice = append(s.ResourceLimits.BlockIO.ThrottleWriteIOPSDevice, v)
+ }
+ }