]> 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:11:45 +0000 (05:11 +0000)
commita241a38d20d96f65116aeabd7b9a28138a0b6860
treeb6e37305c452a5afb4fb2275bf4ce2813229dc87
parent5b874ee8b72a0c76c990041d2ed8b53a38e2dfde
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/21639
Run-TryBot: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
15 files changed:
src/cmd/dist/build.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