docker: fix terminal abnormal after docker run

fix #I5OBZ9
fix #I5LDB4
fix #I5FTB4
This commit is contained in:
chenjiankun 2022-09-13 19:58:50 +08:00
parent 508317c338
commit 542207bf0a
5 changed files with 72 additions and 3 deletions

View File

@ -1 +1 @@
18.09.0.306
18.09.0.307

View File

@ -1,6 +1,6 @@
Name: docker-engine
Version: 18.09.0
Release: 306
Release: 307
Summary: The open-source application container engine
Group: Tools/Docker
@ -212,6 +212,12 @@ fi
%endif
%changelog
* Tue Sep 13 2022 chenjiankun<chenjiankun1@huawei.com> - 18.09.0-307
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:fix terminal abnormal after docker run
* Wed Jun 29 2022 zjw<zhongjiawei1@huawei.com> - 18.09.0-306
- Type:CVE
- CVE:CVE-2021-41092

View File

@ -1 +1 @@
1d79dce8b3c1b71f07ef5ad31adfe8026080311f
2cd0f3c6c09e973e3f65dc0051f4fdebe2349fb4

View File

@ -0,0 +1,62 @@
From 886c1473eddbb1a56f7bae116ad155ccb7c7cfb0 Mon Sep 17 00:00:00 2001
From: chenjiankun <chenjiankun1@huawei.com>
Date: Wed, 10 Aug 2022 16:05:06 +0800
Subject: [PATCH] docker: fix terminal abnormal after docker run
when docker run -it xxx bash and exit, the terminal will be abnormal
(no input, no output).
The reason is in golang 1.17, Package reflect's Value methods named
Pointer and UnsafeAddr return type uintptr instead of unsafe.
Pointer to keep callers from changing the result to an arbitrary type
without first importing "unsafe". However, this means that the result
is fragile and must be converted to Pointer immediately after making the call,
in the same expression:
p := (*int)(unsafe.Pointer(reflect.ValueOf(new(int)).Pointer()))
As in the cases above, it is invalid to store the result before the conversion:
// INVALID: uintptr cannot be stored in variable
// before conversion back to Pointer.
u := reflect.ValueOf(new(int)).Pointer()
p := (*int)(unsafe.Pointer(u))
---
.../vendor/golang.org/x/sys/unix/syscall_linux.go | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/components/cli/vendor/golang.org/x/sys/unix/syscall_linux.go b/components/cli/vendor/golang.org/x/sys/unix/syscall_linux.go
index 690c2c87f..ca415b73f 100644
--- a/components/cli/vendor/golang.org/x/sys/unix/syscall_linux.go
+++ b/components/cli/vendor/golang.org/x/sys/unix/syscall_linux.go
@@ -73,19 +73,28 @@ func IoctlSetTermios(fd int, req uint, value *Termios) error {
// from fd, using the specified request number.
func IoctlGetInt(fd int, req uint) (int, error) {
var value int
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
+ var err error
+ if _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(unsafe.Pointer(&value))); e1 != 0 {
+ err = errnoErr(e1)
+ }
return value, err
}
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
var value Winsize
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
+ var err error
+ if _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(unsafe.Pointer(&value))); e1 != 0 {
+ err = errnoErr(e1)
+ }
return &value, err
}
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
var value Termios
- err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
+ var err error
+ if _, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(unsafe.Pointer(&value))); e1 != 0 {
+ err = errnoErr(e1)
+ }
return &value, err
}
--
2.23.0

View File

@ -226,4 +226,5 @@ patch/0225-docker-close-channel-in-write-side-to-avoid-panic-in.patch
patch/0226-docker-chrootarchive-don-t-create-parent-dirs-outside-of-ch.patch
patch/0227-docker-Lock-down-docker-root-dir-perms.patch
patch/0228-docker-registry-ensure-default-auth-config-has-address.patch
patch/0229-docker-fix-terminal-abnormal-after-docker-run.patch
#end