]> 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)
committerAndrew Gerrand <adg@golang.org>
Fri, 8 Apr 2016 05:21:10 +0000 (05:21 +0000)
commitb8af3fd1bd6338f315d92592c28ff26753f2f118
treedce2be6ffe86694acd1a73ac4e3f7254a8f53a38
parent4afe4c803ec378d7a0d7fbc38d961df541d72134
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>
Reviewed-on: https://go-review.googlesource.com/21696
Reviewed-by: Brad Fitzpatrick <bradfitz@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