mirror of
git://git.yoctoproject.org/meta-virtualization.git
synced 2025-07-05 05:15:25 +02:00
runc: drop runc-docker
The changes carried in runc-docker are no longer required, and if they become relevant again, they don't belong in the base recipe. This is the first part of the change, we drop runc-docker + patches and update runc-opencontainers to RPROVIDE runc-docker in case there are referenced that we don't know about. There shouldn't be any, since virtual-runc has been the RPROVIDE of choice for some time. We keep runc-opencontainers for now, since there may be alternate runc implementations in the future. In about a year, we'll unify the .inc and .bb if no new implementations have been proposed. Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
parent
79db703e34
commit
ea15fd0614
|
@ -1,32 +0,0 @@
|
|||
From 3fff2a3505fba1d1ff0074edff15708a77f6cfa9 Mon Sep 17 00:00:00 2001
|
||||
From: Jason Wessel <jason.wessel@windriver.com>
|
||||
Date: Wed, 12 Jul 2017 13:35:03 -0700
|
||||
Subject: [PATCH] runc: Add --console-socket=/dev/null
|
||||
|
||||
This allows for setting up a detached session where you do not want to
|
||||
set the terminal to false in the config.json. More or less this is a
|
||||
runtime override.
|
||||
|
||||
Upstream-Status: Inappropriate [embedded specific]
|
||||
|
||||
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
|
||||
---
|
||||
utils_linux.go | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
Index: git/src/import/utils_linux.go
|
||||
===================================================================
|
||||
--- git.orig/src/import/utils_linux.go
|
||||
+++ git/src/import/utils_linux.go
|
||||
@@ -267,6 +267,11 @@
|
||||
}
|
||||
|
||||
func (r *runner) run(config *specs.Process) (int, error) {
|
||||
+ if (r.consoleSocket == "/dev/null") {
|
||||
+ r.detach = false
|
||||
+ r.consoleSocket = ""
|
||||
+ config.Terminal = false
|
||||
+ }
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
|
@ -1,133 +0,0 @@
|
|||
From cd7d76a6d1ecb1856f6ed666fb5c30dc105aa94e Mon Sep 17 00:00:00 2001
|
||||
From: Jason Wessel <jason.wessel@windriver.com>
|
||||
Date: Tue, 5 Dec 2017 18:28:28 -0800
|
||||
Subject: [PATCH] runc-docker: Allow "run start ..." to daemonize with $SIGUSR1_PARENT_PID
|
||||
|
||||
The runc-docker has all the code in it to properly run a stop hook if
|
||||
you use it in the foreground. It doesn't work in the back ground
|
||||
because there is no way for a golang application to fork a child exit
|
||||
out of the parent process because all the golang threads stay with the
|
||||
parent.
|
||||
|
||||
This patch has three parts that happen ONLY when $SIGUSR1_PARENT_PID
|
||||
is set.
|
||||
|
||||
1) The code was copied which performs the normal the signal handling
|
||||
block which is used for the foreground operation of runc.
|
||||
|
||||
2) At the point where runc start would normally exit, it closes
|
||||
stdin/stdout/stderr so it would be possible to daemonize "runc start ...".
|
||||
|
||||
3) The code to send a SIGUSR1 to the parent process was added. The
|
||||
idea being that a parent process would simply exit at that point
|
||||
because it was blocking until runc performed everything it was
|
||||
required to perform.
|
||||
|
||||
Upstream-Status: Inappropriate [embedded specific]
|
||||
|
||||
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
|
||||
---
|
||||
signals.go | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
utils_linux.go | 2 +-
|
||||
2 files changed, 51 insertions(+), 5 deletions(-)
|
||||
|
||||
Index: git/src/import/signals.go
|
||||
===================================================================
|
||||
--- git.orig/src/import/signals.go
|
||||
+++ git/src/import/signals.go
|
||||
@@ -5,7 +5,9 @@
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
+ "syscall" // only for Signal
|
||||
|
||||
+ "strconv"
|
||||
"github.com/opencontainers/runc/libcontainer"
|
||||
"github.com/opencontainers/runc/libcontainer/system"
|
||||
"github.com/opencontainers/runc/libcontainer/utils"
|
||||
@@ -55,9 +57,6 @@
|
||||
func (h *signalHandler) forward(process *libcontainer.Process, tty *tty, detach bool) (int, error) {
|
||||
// make sure we know the pid of our main process so that we can return
|
||||
// after it dies.
|
||||
- if detach && h.notifySocket == nil {
|
||||
- return 0, nil
|
||||
- }
|
||||
|
||||
pid1, err := process.Pid()
|
||||
if err != nil {
|
||||
@@ -67,12 +66,61 @@
|
||||
if h.notifySocket != nil {
|
||||
if detach {
|
||||
_ = h.notifySocket.run(pid1)
|
||||
- return 0, nil
|
||||
}
|
||||
_ = h.notifySocket.run(os.Getpid())
|
||||
go func() { _ = h.notifySocket.run(0) }()
|
||||
}
|
||||
|
||||
+ if (detach) {
|
||||
+ // This allows the parent process to daemonize this process
|
||||
+ // so long as stdin/stderr/stdout are closed
|
||||
+ if envVal := os.Getenv("SIGUSR1_PARENT_PID"); envVal != "" {
|
||||
+ // Close stdin/stdout/stderr
|
||||
+ os.Stdin.Close()
|
||||
+ os.Stdout.Close()
|
||||
+ os.Stderr.Close()
|
||||
+ // Notify parent to detach
|
||||
+ i, err := strconv.Atoi(envVal)
|
||||
+ if (err != nil) {
|
||||
+ return 0, nil
|
||||
+ }
|
||||
+ unix.Kill(i, unix.SIGUSR1)
|
||||
+ // Loop waiting on the child to signal or exit,
|
||||
+ // after which all stop hooks will be run
|
||||
+ for s := range h.signals {
|
||||
+ switch s {
|
||||
+ case unix.SIGCHLD:
|
||||
+ exits, err := h.reap()
|
||||
+ if err != nil {
|
||||
+ logrus.Error(err)
|
||||
+ }
|
||||
+ for _, e := range exits {
|
||||
+ logrus.WithFields(logrus.Fields{
|
||||
+ "pid": e.pid,
|
||||
+ "status": e.status,
|
||||
+ }).Debug("process exited")
|
||||
+ if e.pid == pid1 {
|
||||
+ // call Wait() on the process even though we already have the exit
|
||||
+ // status because we must ensure that any of the go specific process
|
||||
+ // fun such as flushing pipes are complete before we return.
|
||||
+ process.Wait()
|
||||
+ if h.notifySocket != nil {
|
||||
+ h.notifySocket.Close()
|
||||
+ }
|
||||
+ return e.status, nil
|
||||
+ }
|
||||
+ }
|
||||
+ default:
|
||||
+ logrus.Debugf("sending signal to process %s", s)
|
||||
+ if err := unix.Kill(pid1, s.(syscall.Signal)); err != nil {
|
||||
+ logrus.Error(err)
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return 0, nil
|
||||
+ }
|
||||
+
|
||||
// Perform the initial tty resize. Always ignore errors resizing because
|
||||
// stdout might have disappeared (due to races with when SIGHUP is sent).
|
||||
_ = tty.resize()
|
||||
Index: git/src/import/utils_linux.go
|
||||
===================================================================
|
||||
--- git.orig/src/import/utils_linux.go
|
||||
+++ git/src/import/utils_linux.go
|
||||
@@ -345,7 +345,7 @@
|
||||
if err != nil {
|
||||
r.terminate(process)
|
||||
}
|
||||
- if detach {
|
||||
+ if (detach && os.Getenv("SIGUSR1_PARENT_PID") == "") {
|
||||
return 0, nil
|
||||
}
|
||||
if err == nil {
|
|
@ -1,14 +0,0 @@
|
|||
include runc.inc
|
||||
|
||||
# Note: this rev is before the required protocol field, update when all components
|
||||
# have been updated to match.
|
||||
SRCREV_runc-docker = "b7da16731c8b55e0e38070ac1d84a56b15f6db37"
|
||||
SRC_URI = "git://github.com/opencontainers/runc;branch=main;name=runc-docker;protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX} \
|
||||
file://0001-runc-Add-console-socket-dev-null.patch \
|
||||
file://0001-Makefile-respect-GOBUILDFLAGS-for-runc-and-remove-re.patch \
|
||||
file://0001-runc-docker-SIGUSR1-daemonize.patch \
|
||||
"
|
||||
|
||||
RUNC_VERSION = "1.2.0-rc.3"
|
||||
|
||||
CVE_PRODUCT = "runc"
|
|
@ -7,6 +7,10 @@ SRC_URI = " \
|
|||
"
|
||||
RUNC_VERSION = "1.2.0"
|
||||
|
||||
# for compatibility with existing RDEPENDS that have existed since
|
||||
# runc-docker and runc-opencontainers were separate
|
||||
RPROVIDES:${PN} += "runc-docker"
|
||||
|
||||
CVE_PRODUCT = "runc"
|
||||
|
||||
LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd', '', d)}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user