Commit Graph

10 Commits

Author SHA1 Message Date
joerichey@google.com
8c0a5eacba unix: add support for Linux filesystem encryption
This CL adds in the necessary types and constants to support Linux
filesystem encryption. This includes the structs for the keys and
polices as well as the constants for key size and encryption algorithms.

This code also reduces the scope of some of the regexes in mkerrors.sh.
This is to reduce the number of unrelated constants added in with this
change.

Note that due to a bug in the Linux uapi headers, not all of the
necessary constants and structures are declared in linux/fs.h despite
being part of the kernel ABI. This means that some constants and types
had to be manually added in.

The bug has been patched (https://patchwork.kernel.org/patch/9662723),
and the manual additions can be removed when the patch is merged into
the mainline kernel.

Change-Id: Ib508ad99bdf4c0068933ffcf351c52bb359cfcf4
Reviewed-on: https://go-review.googlesource.com/41417
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-24 22:03:05 +00:00
Joe Richey
ea9bcade75 unix: generate all Linux go files from source
Right now the process for adding in new constants, errors, or syscalls
for Linux is a pain and unreliable. The scripts are designed to be run
on the target architecture and use the header files installed on the
user's system. This makes it hard to generate files for all the
architectures or to have consistency between users. See golang/go#15282.

This CL fixes this issue by making all of the files for the 11 supported
architectures directly from source checkouts of Linux, glibc, and bluez.
This is done using Docker, the gcc cross-compilers, and qemu emulation.
Previously discussed here:
    https://go-review.googlesource.com/c/37589/

A README.md file is also added to explain how all the parts of the build
system work.

In order to get the build working for all the architectures, I made
some changes to the other scripts called from mkall_linux.go:
  - Files only used for generating linux code, moved to linux/
  - linux/mksysnum.pl supports a specified CC compiler.
  - The generated C code in mkerrors.sh changed to avoid a warning
  - mkerrors.sh headers changed to fix powerpc64 bug in sys/ioctl.h
  - linux/types.go no longer needs to export Ptrace structs in lowercase

Build instructions:
  - Host system needs to be x86-64 Linux
  - Install Docker (https://docs.docker.com/engine/installation/)
  - ./mkall.sh (That's it!!!)

Change-Id: I87067c14442ba12f8d51991349a43a9d73f38ae0
Reviewed-on: https://go-review.googlesource.com/37943
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-04-21 00:52:44 +00:00
Matt Layher
d67a3279ae unix: implement Linux AF_VSOCK sockets
Adds the required constants and new SockaddrVM type for working
with Linux VM sockets.  For more information, see:
https://vmsplice.net/~stefan/stefanha-kvm-forum-2015.pdf.

Fixes golang/go#19434

Change-Id: I9aefb35441b2c7dc412bdfb806ebe08d5c20f6b1
Reviewed-on: https://go-review.googlesource.com/37937
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-03-08 01:50:38 +00:00
Michael Stapelberg
e48874b424 unix: add BLK* Linux ioctls
These are useful for re-reading partition tables and getting device
sizes.

Fixes golang/go#19370

Change-Id: Ia8dbe3416a48dbdbceafa0fff0131d71057d97ca
Reviewed-on: https://go-review.googlesource.com/37640
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-03-03 13:59:30 +00:00
Joe Richey
76cc09b634 unix: add Getrandom syscall bindings and flags
This CL introduces the Getrandom syscall. Allowing users of
sufficiently new kernels (3.17) to detect when the operating system
lacks enough entropy to generate cryptographic random data. See:
http://man7.org/linux/man-pages/man2/getrandom.2.html

As we have updated the syscall numbers, the Getrandom function can
just be generated normally. The only other change is to mkerrors.sh
to include the GRND_* flags for getrandom from <linux/random.h>.

It is important to note that currently the mkerrors.sh script cannot
actually be run as it has fallen behind the 4.10 kernel. The GRND_*
flags were added manually.

This was originally part of a larger commit that was split up.
See CL: https://go-review.googlesource.com/37570

Change-Id: I464088a9c9f7224abdcdae476b30a4f2f412d9f5
Reviewed-on: https://go-review.googlesource.com/37589
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-01 01:59:58 +00:00
Matt Layher
e4594059fe unix: add missing netlink constants on Linux
Fixes golang/go#19262

Change-Id: I67ceb187cd68e90a9387a706a89aafded0befe53
Reviewed-on: https://go-review.googlesource.com/37344
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-23 22:51:00 +00:00
Matt Layher
075e574b89 unix: implement Vmsplice, add SPLICE_F_* constants
Fixes golang/go#19125

Change-Id: I822b6f260f980178da29a552c6170cb261c8e254
Reviewed-on: https://go-review.googlesource.com/37152
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-17 00:34:42 +00:00
Matt Layher
e24f485414 unix: add support for AF_ALG sockets on Linux
Fixes golang/go#19033.

Change-Id: Icbd249f63cd4a9035a1decaa8bf4c521303b4494
Reviewed-on: https://go-review.googlesource.com/36805
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-13 22:57:39 +00:00
Maxime de Roucy
ce7380f5b0 x/sys/unix: add fallocate constants
Add FALLOC_* constants from /usr/include/linux/falloc.h to use with
Fallocate (golang.org/x/sys/unix package).

Fix golang/go#10599

Change-Id: Ie001e554250bb12472c612adcb4b79c6f72cac34
Reviewed-on: https://go-review.googlesource.com/36336
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-13 20:02:47 +00:00
Vladimir Stefanovic
478fcf5431 x/sys/unix: added linux/mips{,le} support
Change-Id: Ibf7a9e16ba0e1dde922748a34d61e197a985ed40
Reviewed-on: https://go-review.googlesource.com/33952
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-05 17:08:28 +00:00