]> Cypherpunks repositories - gostls13.git/commit
runtime, syscall: only search for Windows DLLs in the System32 directory
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 25 Mar 2016 06:40:58 +0000 (06:40 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 1 Apr 2016 22:55:36 +0000 (22:55 +0000)
commit683448a304a3871039ab44fc01e839f05ac36f05
tree7e97c203c9b5cbbbbe9da7b0ff730590488fa1ac
parent59fc42b230671d083feb68925d9cadc1da1d2616
runtime, syscall: only search for Windows DLLs in the System32 directory

Make sure that for any DLL that Go uses itself, we only look for the
DLL in the Windows System32 directory, guarding against DLL preloading
attacks.

(Unless the Windows version is ancient and LoadLibraryEx is
unavailable, in which case the user probably has bigger security
problems anyway.)

This does not change the behavior of syscall.LoadLibrary or NewLazyDLL
if the DLL name is something unused by Go itself.

This change also intentionally does not add any new API surface. Instead,
x/sys is updated with a LoadLibraryEx function and LazyDLL.Flags in:
    https://golang.org/cl/21388

Updates #14959

Change-Id: I8d29200559cc19edf8dcf41dbdd39a389cd6aeb9
Reviewed-on: https://go-review.googlesource.com/21140
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
15 files changed:
src/cmd/dist/deps.go
src/go/build/deps_test.go
src/internal/syscall/windows/registry/syscall.go
src/internal/syscall/windows/registry/zsyscall_windows.go
src/internal/syscall/windows/syscall_windows.go
src/internal/syscall/windows/sysdll/sysdll.go [new file with mode: 0644]
src/internal/syscall/windows/zsyscall_windows.go
src/runtime/export_windows_test.go
src/runtime/os1_windows.go
src/runtime/syscall_windows.go
src/runtime/syscall_windows_test.go
src/syscall/dll_windows.go
src/syscall/mksyscall_windows.go
src/syscall/syscall_windows.go
src/syscall/zsyscall_windows.go