[go][fdio] Always add GET_ATTRIBUTES in PosixFlagsToFuchsiaIo

POSIX requires that `fstat` succeeds on a valid file descriptor, so we
must always open with `fileIo.FlagsPermGetAttributes`. This is required
as new VFS changes will enforce GET_ATTRIBUTES permissions.

Also, evaluate the O_RDONLY and O_WRONLY and O_RDWR only if O_PATH is
not specified. If we don't do this calling `open(..., O_PATH)` will
evaluate to opening as O_RDONLY (because O_RDONLY == 0) which would lead
to ACCESS_DENIED errors when executing `O_PATH` on a write-only or
restricted file.

Bug: 517452382

TAG: agy
CONV: 17bf7e1b-bf30-4c05-bf61-a5856495709c
Change-Id: Ib6b1669feb3ad27ad22021207db62aeb31dec8ed
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/go/+/1726229
Reviewed-by: Bruno Dal Bo <brunodalbo@google.com>
Commit-Queue: Rui Qi Sim <rqsim@google.com>
1 file changed
tree: c55177f8c84ef9753823969588d9c09fb8d7f252
  1. .github/
  2. api/
  3. doc/
  4. lib/
  5. makefuchsia/
  6. makeroot/
  7. meta/
  8. misc/
  9. src/
  10. test/
  11. .gitattributes
  12. .gitignore
  13. BUILD.gn
  14. codereview.cfg
  15. CONTRIBUTING.md
  16. go.env
  17. LICENSE
  18. METADATA.textproto
  19. OWNERS
  20. PATENTS
  21. README.md
  22. regen-api
  23. regen-api.py
  24. regen-fidl
  25. regen-syscalls
  26. SECURITY.md
  27. UPGRADE.md
  28. VERSION
README.md

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 4.0 Attributions license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://go.dev/dl/.

After downloading a binary release, visit https://go.dev/doc/install for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.

Contributing

Go is the work of thousands of contributors. We appreciate your help!

To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.

Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.