containerd: 837e8c5e1cad013ed57f5c2090c8591c10cbbdae
runc: 02f8fa7863dd3f82909a73e2061897828460d52f
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
| ... | ... |
@@ -222,7 +222,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ |
| 222 | 222 |
hello-world:latest@sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7 |
| 223 | 223 |
# See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is) |
| 224 | 224 |
|
| 225 |
-# Install tomlv, runc, containerd.and grimes |
|
| 225 |
+# Install tomlv, runc, containerd and grimes |
|
| 226 | 226 |
# Please edit hack/dockerfile/install-binaries.sh to update them. |
| 227 | 227 |
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh |
| 228 | 228 |
RUN /tmp/install-binaries.sh tomlv runc containerd grimes |
| ... | ... |
@@ -165,7 +165,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ |
| 165 | 165 |
aarch64/hello-world:latest@sha256:65a4a158587b307bb02db4de41b836addb0c35175bdc801367b1ac1ddeb9afda |
| 166 | 166 |
# See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is) |
| 167 | 167 |
|
| 168 |
-# Install tomlv, runc, containerd.and grimes |
|
| 168 |
+# Install tomlv, runc, containerd and grimes |
|
| 169 | 169 |
# Please edit hack/dockerfile/install-binaries.sh to update them. |
| 170 | 170 |
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh |
| 171 | 171 |
RUN /tmp/install-binaries.sh tomlv runc containerd grimes |
| ... | ... |
@@ -164,7 +164,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ |
| 164 | 164 |
armhf/hello-world:latest@sha256:161dcecea0225975b2ad5f768058212c1e0d39e8211098666ffa1ac74cfb7791 |
| 165 | 165 |
# See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is) |
| 166 | 166 |
|
| 167 |
-# Install tomlv, runc, containerd.and grimes |
|
| 167 |
+# Install tomlv, runc, containerd and grimes |
|
| 168 | 168 |
# Please edit hack/dockerfile/install-binaries.sh to update them. |
| 169 | 169 |
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh |
| 170 | 170 |
RUN /tmp/install-binaries.sh tomlv runc containerd grimes |
| ... | ... |
@@ -183,7 +183,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ |
| 183 | 183 |
ppc64le/hello-world:latest@sha256:186a40a9a02ca26df0b6c8acdfb8ac2f3ae6678996a838f977e57fac9d963974 |
| 184 | 184 |
# See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is) |
| 185 | 185 |
|
| 186 |
-# Install tomlv, runc, containerd.and grimes |
|
| 186 |
+# Install tomlv, runc, containerd and grimes |
|
| 187 | 187 |
# Please edit hack/dockerfile/install-binaries.sh to update them. |
| 188 | 188 |
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh |
| 189 | 189 |
RUN /tmp/install-binaries.sh tomlv runc containerd grimes |
| ... | ... |
@@ -175,7 +175,7 @@ RUN ./contrib/download-frozen-image-v2.sh /docker-frozen-images \ |
| 175 | 175 |
s390x/hello-world:latest@sha256:780d80b3a7677c3788c0d5cd9168281320c8d4a6d9183892d8ee5cdd610f5699 |
| 176 | 176 |
# See also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is) |
| 177 | 177 |
|
| 178 |
-# Install tomlv, runc, containerd.and grimes |
|
| 178 |
+# Install tomlv, runc, containerd and grimes |
|
| 179 | 179 |
# Please edit hack/dockerfile/install-binaries.sh to update them. |
| 180 | 180 |
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh |
| 181 | 181 |
RUN /tmp/install-binaries.sh tomlv runc containerd grimes |
| ... | ... |
@@ -56,7 +56,7 @@ ENV PATH /go/bin:/usr/local/go/bin:$PATH |
| 56 | 56 |
ENV GOPATH /go:/go/src/github.com/docker/docker/vendor |
| 57 | 57 |
ENV CGO_LDFLAGS -L/lib |
| 58 | 58 |
|
| 59 |
-# Install runc, containerd.and grimes |
|
| 59 |
+# Install runc, containerd and grimes |
|
| 60 | 60 |
# Please edit hack/dockerfile/install-binaries.sh to update them. |
| 61 | 61 |
COPY hack/dockerfile/install-binaries.sh /tmp/install-binaries.sh |
| 62 | 62 |
RUN /tmp/install-binaries.sh runc containerd grimes |
| ... | ... |
@@ -3,8 +3,8 @@ set -e |
| 3 | 3 |
set -x |
| 4 | 4 |
|
| 5 | 5 |
TOMLV_COMMIT=9baf8a8a9f2ed20a8e54160840c492f937eeaf9a |
| 6 |
-RUNC_COMMIT=cc29e3dded8e27ba8f65738f40d251c885030a28 |
|
| 7 |
-CONTAINERD_COMMIT=2545227b0357eb55e369fa0072baef9ad91cdb69 |
|
| 6 |
+RUNC_COMMIT=02f8fa7863dd3f82909a73e2061897828460d52f |
|
| 7 |
+CONTAINERD_COMMIT=837e8c5e1cad013ed57f5c2090c8591c10cbbdae |
|
| 8 | 8 |
GRIMES_COMMIT=f207601a8d19a534cc90d9e26e037e9931ccb9db |
| 9 | 9 |
|
| 10 | 10 |
export GOPATH="$(mktemp -d)" |
| ... | ... |
@@ -106,7 +106,7 @@ clone git github.com/miekg/pkcs11 df8ae6ca730422dba20c768ff38ef7d79077a59f |
| 106 | 106 |
clone git github.com/docker/go v1.5.1-1-1-gbaf439e |
| 107 | 107 |
clone git github.com/agl/ed25519 d2b94fd789ea21d12fac1a4443dd3a3f79cda72c |
| 108 | 108 |
|
| 109 |
-clone git github.com/opencontainers/runc cc29e3dded8e27ba8f65738f40d251c885030a28 # libcontainer |
|
| 109 |
+clone git github.com/opencontainers/runc 02f8fa7863dd3f82909a73e2061897828460d52f # libcontainer |
|
| 110 | 110 |
clone git github.com/opencontainers/runtime-spec 1c7c27d043c2a5e513a44084d2b10d77d1402b8c # specs |
| 111 | 111 |
clone git github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0 |
| 112 | 112 |
# libcontainer deps (see src/github.com/opencontainers/runc/Godeps/Godeps.json) |
| ... | ... |
@@ -140,7 +140,7 @@ clone git google.golang.org/cloud dae7e3d993bc3812a2185af60552bb6b847e52a0 https |
| 140 | 140 |
clone git github.com/docker/docker-credential-helpers v0.3.0 |
| 141 | 141 |
|
| 142 | 142 |
# containerd |
| 143 |
-clone git github.com/docker/containerd 2545227b0357eb55e369fa0072baef9ad91cdb69 |
|
| 143 |
+clone git github.com/docker/containerd 837e8c5e1cad013ed57f5c2090c8591c10cbbdae |
|
| 144 | 144 |
|
| 145 | 145 |
# cluster |
| 146 | 146 |
clone git github.com/docker/swarmkit 7e63bdefb94e5bea2641e8bdebae2cfa61a0ed44 |
| ... | ... |
@@ -2778,7 +2778,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
|
| 2778 | 2778 |
c.Assert(err, checker.IsNil) |
| 2779 | 2779 |
|
| 2780 | 2780 |
containerName := "error-values" |
| 2781 |
- runError := "oci runtime error: exec: \"toto\": executable file not found in $PATH" |
|
| 2781 |
+ runError := `exec: \"toto\": executable file not found in $PATH` |
|
| 2782 | 2782 |
// Make a container with both a non 0 exit code and an error message |
| 2783 | 2783 |
out, err := s.d.Cmd("run", "--name", containerName, "busybox", "toto")
|
| 2784 | 2784 |
c.Assert(err, checker.NotNil) |
| ... | ... |
@@ -2793,7 +2793,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
|
| 2793 | 2793 |
out, err = s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName)
|
| 2794 | 2794 |
out = strings.TrimSpace(out) |
| 2795 | 2795 |
c.Assert(err, checker.IsNil) |
| 2796 |
- c.Assert(out, checker.Equals, runError) |
|
| 2796 |
+ c.Assert(out, checker.Contains, runError) |
|
| 2797 | 2797 |
|
| 2798 | 2798 |
// now restart daemon |
| 2799 | 2799 |
err = s.d.Restart() |
| ... | ... |
@@ -2808,7 +2808,7 @@ func (s *DockerDaemonSuite) TestDaemonRestartSaveContainerExitCode(c *check.C) {
|
| 2808 | 2808 |
out, err = s.d.Cmd("inspect", "-f", "{{.State.Error}}", containerName)
|
| 2809 | 2809 |
out = strings.TrimSpace(out) |
| 2810 | 2810 |
c.Assert(err, checker.IsNil) |
| 2811 |
- c.Assert(out, checker.Equals, runError) |
|
| 2811 |
+ c.Assert(out, checker.Contains, runError) |
|
| 2812 | 2812 |
} |
| 2813 | 2813 |
|
| 2814 | 2814 |
func (s *DockerDaemonSuite) TestDaemonBackcompatPre17Volumes(c *check.C) {
|
| ... | ... |
@@ -18,7 +18,7 @@ const ( |
| 18 | 18 |
) |
| 19 | 19 |
|
| 20 | 20 |
func findCgroupMountpoints() (map[string]string, error) {
|
| 21 |
- cgMounts, err := cgroups.GetCgroupMounts() |
|
| 21 |
+ cgMounts, err := cgroups.GetCgroupMounts(false) |
|
| 22 | 22 |
if err != nil {
|
| 23 | 23 |
return nil, fmt.Errorf("Failed to parse cgroup information: %v", err)
|
| 24 | 24 |
} |
| ... | ... |
@@ -16,7 +16,10 @@ import ( |
| 16 | 16 |
"github.com/docker/go-units" |
| 17 | 17 |
) |
| 18 | 18 |
|
| 19 |
-const cgroupNamePrefix = "name=" |
|
| 19 |
+const ( |
|
| 20 |
+ cgroupNamePrefix = "name=" |
|
| 21 |
+ CgroupProcesses = "cgroup.procs" |
|
| 22 |
+) |
|
| 20 | 23 |
|
| 21 | 24 |
// https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt |
| 22 | 25 |
func FindCgroupMountpoint(subsystem string) (string, error) {
|
| ... | ... |
@@ -136,7 +139,7 @@ func (m Mount) GetThisCgroupDir(cgroups map[string]string) (string, error) {
|
| 136 | 136 |
return getControllerPath(m.Subsystems[0], cgroups) |
| 137 | 137 |
} |
| 138 | 138 |
|
| 139 |
-func getCgroupMountsHelper(ss map[string]bool, mi io.Reader) ([]Mount, error) {
|
|
| 139 |
+func getCgroupMountsHelper(ss map[string]bool, mi io.Reader, all bool) ([]Mount, error) {
|
|
| 140 | 140 |
res := make([]Mount, 0, len(ss)) |
| 141 | 141 |
scanner := bufio.NewScanner(mi) |
| 142 | 142 |
numFound := 0 |
| ... | ... |
@@ -163,7 +166,9 @@ func getCgroupMountsHelper(ss map[string]bool, mi io.Reader) ([]Mount, error) {
|
| 163 | 163 |
} else {
|
| 164 | 164 |
m.Subsystems = append(m.Subsystems, opt) |
| 165 | 165 |
} |
| 166 |
- numFound++ |
|
| 166 |
+ if !all {
|
|
| 167 |
+ numFound++ |
|
| 168 |
+ } |
|
| 167 | 169 |
} |
| 168 | 170 |
res = append(res, m) |
| 169 | 171 |
} |
| ... | ... |
@@ -173,23 +178,25 @@ func getCgroupMountsHelper(ss map[string]bool, mi io.Reader) ([]Mount, error) {
|
| 173 | 173 |
return res, nil |
| 174 | 174 |
} |
| 175 | 175 |
|
| 176 |
-func GetCgroupMounts() ([]Mount, error) {
|
|
| 176 |
+// GetCgroupMounts returns the mounts for the cgroup subsystems. |
|
| 177 |
+// all indicates whether to return just the first instance or all the mounts. |
|
| 178 |
+func GetCgroupMounts(all bool) ([]Mount, error) {
|
|
| 177 | 179 |
f, err := os.Open("/proc/self/mountinfo")
|
| 178 | 180 |
if err != nil {
|
| 179 | 181 |
return nil, err |
| 180 | 182 |
} |
| 181 | 183 |
defer f.Close() |
| 182 | 184 |
|
| 183 |
- all, err := ParseCgroupFile("/proc/self/cgroup")
|
|
| 185 |
+ allSubsystems, err := ParseCgroupFile("/proc/self/cgroup")
|
|
| 184 | 186 |
if err != nil {
|
| 185 | 187 |
return nil, err |
| 186 | 188 |
} |
| 187 | 189 |
|
| 188 | 190 |
allMap := make(map[string]bool) |
| 189 |
- for s := range all {
|
|
| 191 |
+ for s := range allSubsystems {
|
|
| 190 | 192 |
allMap[s] = true |
| 191 | 193 |
} |
| 192 |
- return getCgroupMountsHelper(allMap, f) |
|
| 194 |
+ return getCgroupMountsHelper(allMap, f, all) |
|
| 193 | 195 |
} |
| 194 | 196 |
|
| 195 | 197 |
// GetAllSubsystems returns all the cgroup subsystems supported by the kernel |
| ... | ... |
@@ -239,7 +246,7 @@ func GetInitCgroupDir(subsystem string) (string, error) {
|
| 239 | 239 |
} |
| 240 | 240 |
|
| 241 | 241 |
func readProcsFile(dir string) ([]int, error) {
|
| 242 |
- f, err := os.Open(filepath.Join(dir, "cgroup.procs")) |
|
| 242 |
+ f, err := os.Open(filepath.Join(dir, CgroupProcesses)) |
|
| 243 | 243 |
if err != nil {
|
| 244 | 244 |
return nil, err |
| 245 | 245 |
} |
| ... | ... |
@@ -326,8 +333,7 @@ func PathExists(path string) bool {
|
| 326 | 326 |
func EnterPid(cgroupPaths map[string]string, pid int) error {
|
| 327 | 327 |
for _, path := range cgroupPaths {
|
| 328 | 328 |
if PathExists(path) {
|
| 329 |
- if err := ioutil.WriteFile(filepath.Join(path, "cgroup.procs"), |
|
| 330 |
- []byte(strconv.Itoa(pid)), 0700); err != nil {
|
|
| 329 |
+ if err := WriteCgroupProc(path, pid); err != nil {
|
|
| 331 | 330 |
return err |
| 332 | 331 |
} |
| 333 | 332 |
} |
| ... | ... |
@@ -396,7 +402,7 @@ func GetAllPids(path string) ([]int, error) {
|
| 396 | 396 |
// collect pids from all sub-cgroups |
| 397 | 397 |
err := filepath.Walk(path, func(p string, info os.FileInfo, iErr error) error {
|
| 398 | 398 |
dir, file := filepath.Split(p) |
| 399 |
- if file != "cgroup.procs" {
|
|
| 399 |
+ if file != CgroupProcesses {
|
|
| 400 | 400 |
return nil |
| 401 | 401 |
} |
| 402 | 402 |
if iErr != nil {
|
| ... | ... |
@@ -411,3 +417,20 @@ func GetAllPids(path string) ([]int, error) {
|
| 411 | 411 |
}) |
| 412 | 412 |
return pids, err |
| 413 | 413 |
} |
| 414 |
+ |
|
| 415 |
+// WriteCgroupProc writes the specified pid into the cgroup's cgroup.procs file |
|
| 416 |
+func WriteCgroupProc(dir string, pid int) error {
|
|
| 417 |
+ // Normally dir should not be empty, one case is that cgroup subsystem |
|
| 418 |
+ // is not mounted, we will get empty dir, and we want it fail here. |
|
| 419 |
+ if dir == "" {
|
|
| 420 |
+ return fmt.Errorf("no such directory for %s", CgroupProcesses)
|
|
| 421 |
+ } |
|
| 422 |
+ |
|
| 423 |
+ // Dont attach any pid to the cgroup if -1 is specified as a pid |
|
| 424 |
+ if pid != -1 {
|
|
| 425 |
+ if err := ioutil.WriteFile(filepath.Join(dir, CgroupProcesses), []byte(strconv.Itoa(pid)), 0700); err != nil {
|
|
| 426 |
+ return fmt.Errorf("failed to write %v to %v: %v", pid, CgroupProcesses, err)
|
|
| 427 |
+ } |
|
| 428 |
+ } |
|
| 429 |
+ return nil |
|
| 430 |
+} |
| ... | ... |
@@ -36,7 +36,7 @@ type Cgroup struct {
|
| 36 | 36 |
type Resources struct {
|
| 37 | 37 |
// If this is true allow access to any kind of device within the container. If false, allow access only to devices explicitly listed in the allowed_devices list. |
| 38 | 38 |
// Deprecated |
| 39 |
- AllowAllDevices bool `json:"allow_all_devices,omitempty"` |
|
| 39 |
+ AllowAllDevices *bool `json:"allow_all_devices,omitempty"` |
|
| 40 | 40 |
// Deprecated |
| 41 | 41 |
AllowedDevices []*Device `json:"allowed_devices,omitempty"` |
| 42 | 42 |
// Deprecated |
| ... | ... |
@@ -69,10 +69,10 @@ type Resources struct {
|
| 69 | 69 |
CpuPeriod int64 `json:"cpu_period"` |
| 70 | 70 |
|
| 71 | 71 |
// How many time CPU will use in realtime scheduling (in usecs). |
| 72 |
- CpuRtRuntime int64 `json:"cpu_quota"` |
|
| 72 |
+ CpuRtRuntime int64 `json:"cpu_rt_quota"` |
|
| 73 | 73 |
|
| 74 | 74 |
// CPU period to be used for realtime scheduling (in usecs). |
| 75 |
- CpuRtPeriod int64 `json:"cpu_period"` |
|
| 75 |
+ CpuRtPeriod int64 `json:"cpu_rt_period"` |
|
| 76 | 76 |
|
| 77 | 77 |
// CPU to use |
| 78 | 78 |
CpusetCpus string `json:"cpuset_cpus"` |
| ... | ... |
@@ -120,5 +120,5 @@ type Resources struct {
|
| 120 | 120 |
NetPrioIfpriomap []*IfPrioMap `json:"net_prio_ifpriomap"` |
| 121 | 121 |
|
| 122 | 122 |
// Set class identifier for container's network packets |
| 123 |
- NetClsClassid string `json:"net_cls_classid"` |
|
| 123 |
+ NetClsClassid uint32 `json:"net_cls_classid_u"` |
|
| 124 | 124 |
} |
| ... | ... |
@@ -148,10 +148,6 @@ type Config struct {
|
| 148 | 148 |
// More information about kernel oom score calculation here: https://lwn.net/Articles/317814/ |
| 149 | 149 |
OomScoreAdj int `json:"oom_score_adj"` |
| 150 | 150 |
|
| 151 |
- // AdditionalGroups specifies the gids that should be added to supplementary groups |
|
| 152 |
- // in addition to those that the user belongs to. |
|
| 153 |
- AdditionalGroups []string `json:"additional_groups"` |
|
| 154 |
- |
|
| 155 | 151 |
// UidMappings is an array of User ID mappings for User Namespaces |
| 156 | 152 |
UidMappings []IDMap `json:"uid_mappings"` |
| 157 | 153 |
|
| ... | ... |
@@ -304,29 +300,38 @@ func (c Command) Run(s HookState) error {
|
| 304 | 304 |
if err != nil {
|
| 305 | 305 |
return err |
| 306 | 306 |
} |
| 307 |
+ var stdout, stderr bytes.Buffer |
|
| 307 | 308 |
cmd := exec.Cmd{
|
| 308 |
- Path: c.Path, |
|
| 309 |
- Args: c.Args, |
|
| 310 |
- Env: c.Env, |
|
| 311 |
- Stdin: bytes.NewReader(b), |
|
| 309 |
+ Path: c.Path, |
|
| 310 |
+ Args: c.Args, |
|
| 311 |
+ Env: c.Env, |
|
| 312 |
+ Stdin: bytes.NewReader(b), |
|
| 313 |
+ Stdout: &stdout, |
|
| 314 |
+ Stderr: &stderr, |
|
| 315 |
+ } |
|
| 316 |
+ if err := cmd.Start(); err != nil {
|
|
| 317 |
+ return err |
|
| 312 | 318 |
} |
| 313 | 319 |
errC := make(chan error, 1) |
| 314 | 320 |
go func() {
|
| 315 |
- out, err := cmd.CombinedOutput() |
|
| 321 |
+ err := cmd.Wait() |
|
| 316 | 322 |
if err != nil {
|
| 317 |
- err = fmt.Errorf("%s: %s", err, out)
|
|
| 323 |
+ err = fmt.Errorf("error running hook: %v, stdout: %s, stderr: %s", err, stdout.String(), stderr.String())
|
|
| 318 | 324 |
} |
| 319 | 325 |
errC <- err |
| 320 | 326 |
}() |
| 327 |
+ var timerCh <-chan time.Time |
|
| 321 | 328 |
if c.Timeout != nil {
|
| 322 |
- select {
|
|
| 323 |
- case err := <-errC: |
|
| 324 |
- return err |
|
| 325 |
- case <-time.After(*c.Timeout): |
|
| 326 |
- cmd.Process.Kill() |
|
| 327 |
- cmd.Wait() |
|
| 328 |
- return fmt.Errorf("hook ran past specified timeout of %.1fs", c.Timeout.Seconds())
|
|
| 329 |
- } |
|
| 329 |
+ timer := time.NewTimer(*c.Timeout) |
|
| 330 |
+ defer timer.Stop() |
|
| 331 |
+ timerCh = timer.C |
|
| 332 |
+ } |
|
| 333 |
+ select {
|
|
| 334 |
+ case err := <-errC: |
|
| 335 |
+ return err |
|
| 336 |
+ case <-timerCh: |
|
| 337 |
+ cmd.Process.Kill() |
|
| 338 |
+ cmd.Wait() |
|
| 339 |
+ return fmt.Errorf("hook ran past specified timeout of %.1fs", c.Timeout.Seconds())
|
|
| 330 | 340 |
} |
| 331 |
- return <-errC |
|
| 332 | 341 |
} |
| ... | ... |
@@ -107,19 +107,5 @@ var ( |
| 107 | 107 |
Permissions: "rwm", |
| 108 | 108 |
}, |
| 109 | 109 |
}, DefaultSimpleDevices...) |
| 110 |
- DefaultAutoCreatedDevices = append([]*Device{
|
|
| 111 |
- {
|
|
| 112 |
- // /dev/fuse is created but not allowed. |
|
| 113 |
- // This is to allow java to work. Because java |
|
| 114 |
- // Insists on there being a /dev/fuse |
|
| 115 |
- // https://github.com/docker/docker/issues/514 |
|
| 116 |
- // https://github.com/docker/docker/issues/2393 |
|
| 117 |
- // |
|
| 118 |
- Path: "/dev/fuse", |
|
| 119 |
- Type: 'c', |
|
| 120 |
- Major: 10, |
|
| 121 |
- Minor: 229, |
|
| 122 |
- Permissions: "rwm", |
|
| 123 |
- }, |
|
| 124 |
- }, DefaultSimpleDevices...) |
|
| 110 |
+ DefaultAutoCreatedDevices = append([]*Device{}, DefaultSimpleDevices...)
|
|
| 125 | 111 |
) |
| ... | ... |
@@ -129,7 +129,7 @@ func Relabel(path string, fileLabel string, shared bool) error {
|
| 129 | 129 |
|
| 130 | 130 |
exclude_paths := map[string]bool{"/": true, "/usr": true, "/etc": true}
|
| 131 | 131 |
if exclude_paths[path] {
|
| 132 |
- return fmt.Errorf("Relabeling of %s is not allowed", path)
|
|
| 132 |
+ return fmt.Errorf("SELinux relabeling of %s is not allowed", path)
|
|
| 133 | 133 |
} |
| 134 | 134 |
|
| 135 | 135 |
if shared {
|
| ... | ... |
@@ -137,7 +137,10 @@ func Relabel(path string, fileLabel string, shared bool) error {
|
| 137 | 137 |
c["level"] = "s0" |
| 138 | 138 |
fileLabel = c.Get() |
| 139 | 139 |
} |
| 140 |
- return selinux.Chcon(path, fileLabel, true) |
|
| 140 |
+ if err := selinux.Chcon(path, fileLabel, true); err != nil {
|
|
| 141 |
+ return fmt.Errorf("SELinux relabeling of %s is not allowed: %q", path, err)
|
|
| 142 |
+ } |
|
| 143 |
+ return nil |
|
| 141 | 144 |
} |
| 142 | 145 |
|
| 143 | 146 |
// GetPidLabel will return the label of the process running with the specified pid |
| ... | ... |
@@ -8,7 +8,7 @@ import ( |
| 8 | 8 |
|
| 9 | 9 |
// Setuid sets the uid of the calling thread to the specified uid. |
| 10 | 10 |
func Setuid(uid int) (err error) {
|
| 11 |
- _, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID, uintptr(uid), 0, 0) |
|
| 11 |
+ _, _, e1 := syscall.RawSyscall(syscall.SYS_SETUID32, uintptr(uid), 0, 0) |
|
| 12 | 12 |
if e1 != 0 {
|
| 13 | 13 |
err = e1 |
| 14 | 14 |
} |
| ... | ... |
@@ -4,28 +4,9 @@ package system |
| 4 | 4 |
|
| 5 | 5 |
/* |
| 6 | 6 |
#include <unistd.h> |
| 7 |
-#include <limits.h> |
|
| 8 |
- |
|
| 9 |
-int GetLongBit() {
|
|
| 10 |
-#ifdef _SC_LONG_BIT |
|
| 11 |
- int longbits; |
|
| 12 |
- |
|
| 13 |
- longbits = sysconf(_SC_LONG_BIT); |
|
| 14 |
- if (longbits < 0) {
|
|
| 15 |
- longbits = (CHAR_BIT * sizeof(long)); |
|
| 16 |
- } |
|
| 17 |
- return longbits; |
|
| 18 |
-#else |
|
| 19 |
- return (CHAR_BIT * sizeof(long)); |
|
| 20 |
-#endif |
|
| 21 |
-} |
|
| 22 | 7 |
*/ |
| 23 | 8 |
import "C" |
| 24 | 9 |
|
| 25 | 10 |
func GetClockTicks() int {
|
| 26 | 11 |
return int(C.sysconf(C._SC_CLK_TCK)) |
| 27 | 12 |
} |
| 28 |
- |
|
| 29 |
-func GetLongBit() int {
|
|
| 30 |
- return int(C.GetLongBit()) |
|
| 31 |
-} |