Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: handle space in path to C compiler [1.14 backport] #43859

Closed
gopherbot opened this issue Jan 22, 2021 · 3 comments
Closed

cmd/go: handle space in path to C compiler [1.14 backport] #43859

gopherbot opened this issue Jan 22, 2021 · 3 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@jayconrod requested issue #43808 to be considered for backport to the next 1.14 minor release.

@gopherbot Please backport to 1.14 and 1.15. This was a regression.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Jan 22, 2021
@gopherbot gopherbot added this to the Go1.14.15 milestone Jan 22, 2021
@gopherbot
Copy link
Author

Change https://golang.org/cl/285952 mentions this issue: [release-branch.go1.14] cmd/go: don't lookup the path for CC when invoking cgo

@dmitshur
Copy link
Contributor

Approving as a serious issue without a reasonable workaround. It should be safe to backport since it reverts a change that was newly applied in Go 1.14.14, and the security fix continues to function as described in #43808 (comment) (CC @rolandshoemaker).

This backport applies to both 1.15 (#43860) and 1.14 (this issue).

@dmitshur dmitshur added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels Jan 22, 2021
@gopherbot
Copy link
Author

Closed by merging e09d8d2 to release-branch.go1.14.

gopherbot pushed a commit that referenced this issue Feb 2, 2021
…oking cgo

Previously, if CC was a path without separators (like gcc or clang),
we'd look it up in PATH in cmd/go using internal/execabs.LookPath,
then pass the resolved path to cgo in CC.

This caused a regression: if the directory in PATH containing CC has a
space, cgo splits it and interprets it as multiple arguments.

With this change, cmd/go no longer resolves CC before invoking
cgo. cgo does the path lookup on each invocation. This reverts the
security fix CL 284780, but that was redundant with the addition of
internal/execabs (CL 955304), which still protects us.

NOTE: This CL includes a related test fix from CL 286292.

Fixes #43859

Change-Id: I65d91a1e303856df8653881eb6e2e75a3bf95c49
Reviewed-on: https://go-review.googlesource.com/c/go/+/285873
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
(cherry picked from commit a2cef9b)
Reviewed-on: https://go-review.googlesource.com/c/go/+/285952
@golang golang locked and limited conversation to collaborators Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

2 participants