!218 bugfix: fix build error for go test runtime

From: @hcnbxx 
Reviewed-by: @caihaomin 
Signed-off-by: @caihaomin
This commit is contained in:
openeuler-ci-bot 2023-07-07 08:45:17 +00:00 committed by Gitee
commit 63f5cda4f1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 20 additions and 12 deletions

View File

@ -1,4 +1,4 @@
From eb318de64a49fac50ff18e9f467198113ed7ef33 Mon Sep 17 00:00:00 2001 From 5da979b4033759d952d64bbc727d1fc45bb785f0 Mon Sep 17 00:00:00 2001
From: Michael Pratt <mpratt@google.com> From: Michael Pratt <mpratt@google.com>
Date: Tue, 8 Feb 2022 16:45:14 -0500 Date: Tue, 8 Feb 2022 16:45:14 -0500
Subject: [PATCH] runtime: implement SUID/SGID protections Subject: [PATCH] runtime: implement SUID/SGID protections
@ -66,7 +66,7 @@ Signed-off-by: Tang Xi tangxi6@huawei.com
src/runtime/export_darwin_test.go | 7 - src/runtime/export_darwin_test.go | 7 -
src/runtime/export_unix_test.go | 1 + src/runtime/export_unix_test.go | 1 +
src/runtime/extern.go | 19 +++ src/runtime/extern.go | 19 +++
src/runtime/internal/syscall/asm_linux_386.s | 34 +++++ src/runtime/internal/syscall/asm_linux_386.s | 34 ++++
.../internal/syscall/asm_linux_amd64.s | 33 ++++ .../internal/syscall/asm_linux_amd64.s | 33 ++++
src/runtime/internal/syscall/asm_linux_arm.s | 32 ++++ src/runtime/internal/syscall/asm_linux_arm.s | 32 ++++
.../internal/syscall/asm_linux_arm64.s | 29 ++++ .../internal/syscall/asm_linux_arm64.s | 29 ++++
@ -76,7 +76,7 @@ Signed-off-by: Tang Xi tangxi6@huawei.com
.../internal/syscall/defs_linux_arm64.go | 7 + .../internal/syscall/defs_linux_arm64.go | 7 +
src/runtime/internal/syscall/syscall_linux.go | 12 ++ src/runtime/internal/syscall/syscall_linux.go | 12 ++
src/runtime/nbpipe_fcntl_libc_test.go | 18 --- src/runtime/nbpipe_fcntl_libc_test.go | 18 ---
src/runtime/nbpipe_fcntl_unix_test.go | 17 --- src/runtime/nbpipe_fcntl_unix_test.go | 17 --
src/runtime/nbpipe_test.go | 26 ++-- src/runtime/nbpipe_test.go | 26 ++--
src/runtime/os2_aix.go | 12 ++ src/runtime/os2_aix.go | 12 ++
src/runtime/os_aix.go | 40 +++++ src/runtime/os_aix.go | 40 +++++
@ -87,11 +87,11 @@ Signed-off-by: Tang Xi tangxi6@huawei.com
src/runtime/os_solaris.go | 4 + src/runtime/os_solaris.go | 4 +
src/runtime/panic.go | 3 + src/runtime/panic.go | 3 +
src/runtime/proc.go | 1 + src/runtime/proc.go | 1 +
src/runtime/security_aix.go | 17 +++ src/runtime/security_aix.go | 17 ++
src/runtime/security_issetugid.go | 19 +++ src/runtime/security_issetugid.go | 19 +++
src/runtime/security_linux.go | 15 ++ src/runtime/security_linux.go | 15 ++
src/runtime/security_nonunix.go | 13 ++ src/runtime/security_nonunix.go | 13 ++
src/runtime/security_test.go | 143 ++++++++++++++++++ src/runtime/security_test.go | 145 ++++++++++++++++++
src/runtime/security_unix.go | 72 +++++++++ src/runtime/security_unix.go | 72 +++++++++
src/runtime/signal_unix.go | 4 + src/runtime/signal_unix.go | 4 +
src/runtime/sys_darwin.go | 27 +++- src/runtime/sys_darwin.go | 27 +++-
@ -113,7 +113,7 @@ Signed-off-by: Tang Xi tangxi6@huawei.com
src/runtime/syscall2_solaris.go | 2 + src/runtime/syscall2_solaris.go | 2 +
src/runtime/syscall_solaris.go | 1 + src/runtime/syscall_solaris.go | 1 +
src/runtime/testdata/testsuid/main.go | 25 +++ src/runtime/testdata/testsuid/main.go | 25 +++
52 files changed, 747 insertions(+), 59 deletions(-) 52 files changed, 749 insertions(+), 59 deletions(-)
create mode 100644 src/runtime/internal/syscall/asm_linux_386.s create mode 100644 src/runtime/internal/syscall/asm_linux_386.s
create mode 100644 src/runtime/internal/syscall/asm_linux_amd64.s create mode 100644 src/runtime/internal/syscall/asm_linux_amd64.s
create mode 100644 src/runtime/internal/syscall/asm_linux_arm.s create mode 100644 src/runtime/internal/syscall/asm_linux_arm.s
@ -930,14 +930,15 @@ index 0000000..19d16ea
+func secure() {} +func secure() {}
diff --git a/src/runtime/security_test.go b/src/runtime/security_test.go diff --git a/src/runtime/security_test.go b/src/runtime/security_test.go
new file mode 100644 new file mode 100644
index 0000000..d7d5d25 index 0000000..5653e4f
--- /dev/null --- /dev/null
+++ b/src/runtime/security_test.go +++ b/src/runtime/security_test.go
@@ -0,0 +1,143 @@ @@ -0,0 +1,145 @@
+// Copyright 2023 The Go Authors. All rights reserved. +// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style +// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file. +// license that can be found in the LICENSE file.
+ +
+//go:build aix || android || darwin || dragonfly || freebsd || hurd || illumos || ios || linux || netbsd || openbsd || solaris
+// +build aix android darwin dragonfly freebsd hurd illumos ios linux netbsd openbsd solaris +// +build aix android darwin dragonfly freebsd hurd illumos ios linux netbsd openbsd solaris
+ +
+package runtime_test +package runtime_test
@ -948,6 +949,7 @@ index 0000000..d7d5d25
+ "fmt" + "fmt"
+ "internal/testenv" + "internal/testenv"
+ "io" + "io"
+ "io/ioutil"
+ "os" + "os"
+ "os/exec" + "os/exec"
+ "path/filepath" + "path/filepath"
@ -1018,7 +1020,7 @@ index 0000000..d7d5d25
+ t.Fatal(err) + t.Fatal(err)
+ } + }
+ +
+ f, err := os.CreateTemp(t.TempDir(), "suid-output") + f, err := os.Create(filepath.Join(t.TempDir(), "suid-output"))
+ if err != nil { + if err != nil {
+ t.Fatal(err) + t.Fatal(err)
+ } + }
@ -1067,7 +1069,7 @@ index 0000000..d7d5d25
+ t.Errorf("unexpected output, got: %q, want %q", output, expected) + t.Errorf("unexpected output, got: %q, want %q", output, expected)
+ } + }
+ +
+ fc, err := os.ReadFile(tempfilePath) + fc, err := ioutil.ReadFile(tempfilePath)
+ if err != nil { + if err != nil {
+ t.Fatal(err) + t.Fatal(err)
+ } + }
@ -1578,5 +1580,5 @@ index 0000000..1949d2d
+ fmt.Fprintf(os.Stderr, "hello\n") + fmt.Fprintf(os.Stderr, "hello\n")
+} +}
-- --
2.30.2 2.33.0

View File

@ -58,7 +58,7 @@
Name: golang Name: golang
Version: 1.15.7 Version: 1.15.7
Release: 29 Release: 30
Summary: The Go Programming Language Summary: The Go Programming Language
License: BSD and Public Domain License: BSD and Public Domain
URL: https://golang.org/ URL: https://golang.org/
@ -483,6 +483,12 @@ fi
%files devel -f go-tests.list -f go-misc.list -f go-src.list %files devel -f go-tests.list -f go-misc.list -f go-src.list
%changelog %changelog
* Fri Jul 7 2023 hanchao <hanchao63@huawei.com> - 1.15.7-30
- Type:bugfix
- CVE:
- SUG:NA
- DESC: fix build error for go test runtime.
* Thu Jun 29 2023 hanchao <hanchao63@huawei.com> - 1.15.7-29 * Thu Jun 29 2023 hanchao <hanchao63@huawei.com> - 1.15.7-29
- Type:CVE - Type:CVE
- CVE:CVE-2023-29403 - CVE:CVE-2023-29403