29 Commits
Author SHA1 Message Date
Andrei Vagin f010ae01ac Fix a few typos 2025-01-29 21:16:51 -08:00
Shambhavi SrivastavaandgVisor bot 8ff6816f07 Implementing CopyInN
PiperOrigin-RevId: 554542787
2023-08-07 11:42:20 -07:00
Adin ScannellandgVisor bot 1ceb814544 Add default_applicable_licenses rules to packages.
PiperOrigin-RevId: 513581243
2023-03-02 10:50:04 -08:00
Kevin KrakauerandgVisor bot d8aa09e04c convert uses of interface{} to any
Done via:
  find . -name "*.go" | xargs sed -i -E 's/interface\{\}/any/g'

PiperOrigin-RevId: 487033228
2022-11-08 13:14:06 -08:00
Ayush RanjanandgVisor bot f6ed4523dc Reformat codebase.
PiperOrigin-RevId: 449358041
2022-05-17 17:48:35 -07:00
Adin ScannellandgVisor bot 1e5014d657 Don't mark all Copy* functions as go:nosplit.
This relaxes the checkescape annotation in the test slightly, but allowing
stack splits should not cause issues.

Fixes #7309

PiperOrigin-RevId: 436645425
2022-03-22 21:33:14 -07:00
Ayush RanjanandgVisor bot 0fd9b69d5c Add Checked methods to go_marshal.
This is as per proposal in #6450. I have gated this behind a tag because this
is a very sparsely used feature and otherwise will leads to a lot of unused
generated code.

Secondly, we can not generate the CheckUnmarshal method for dynamic types. So
the dynamic tag would now require its users to additionally implement
CheckUnmarshal method which is more cumbersome.

Fixes #6450

PiperOrigin-RevId: 411197734
2021-11-19 20:16:54 -08:00
Ayush RanjanandgVisor bot ce4f4283ba Make {Un}Marshal{Bytes/Unsafe} return remaining buffer.
Change marshal.Marshallable method signatures to return the remaining buffer.
This makes it easier to implement these method manually. Without this, we would
have to manually do buffer shifting which is error prone.

tools/go_marshal/test:benchmark test does not show change in performance.
Additionally fixed some marshalling bugs in fsimpl/fuse.

Updated multiple callpoints to get rid of redundant slice indexing work and
simplified code using this new signature.

Updates #6450

PiperOrigin-RevId: 407857019
2021-11-05 10:43:49 -07:00
Zach KoopmansandgVisor bot e3fdd15932 [syserror] Update syserror to linuxerr for more errors.
Update the following from syserror to the linuxerr equivalent:
EEXIST
EFAULT
ENOTDIR
ENOTTY
EOPNOTSUPP
ERANGE
ESRCH

PiperOrigin-RevId: 384329869
2021-07-12 15:26:20 -07:00
Zach KoopmansandgVisor bot 8a2f7e716d [syserror] Split usermem package
Split usermem package to help remove syserror dependency in go_marshal.
New hostarch package contains code not dependent on syserror.

PiperOrigin-RevId: 365651233
2021-03-29 13:30:21 -07:00
Ayush RanjanandgVisor bot c0bd71c5a5 [lisa] Support dynamic types for all types.
We were only supporting dynamic struct types. With this change, users can make
any type dynamic. The tool (correctly) blindly just generates the remaining
methods needed to implement Marshallable using the 3 methods defined by the
user on the dynamic type.

This is helpful in situations like:
type StringArray []string

Added a test for such a use case.

PiperOrigin-RevId: 364463164
2021-03-22 19:17:49 -07:00
Ayush RanjanandgVisor bot cfa4633c3d [go-marshal] Add dynamic tag in go_marshal.
This makes it easier to implement dynamically sized types in go-marshal. You
really only need to implement MarshalBytes, UnmarshalBytes and SizeBytes to
implement the entire interface.

By using the `dynamic` tag, the autogenerator will generate the rest of the
methods for us.

This change also simplifies how KernelIPTGetEntries implements Marshallable
using the newly added utility.

PiperOrigin-RevId: 356397114
2021-02-08 18:08:29 -08:00
Ting-Yu WangandgVisor bot 1cfa8d58f6 Fix more nogo tests
PiperOrigin-RevId: 340536306
2020-11-03 15:23:32 -08:00
Rahat MahmoodandgVisor bot 44c7d55074 Support embedded fields in go-marshal.
PiperOrigin-RevId: 334437990
2020-09-29 12:34:30 -07:00
Rahat MahmoodandgVisor bot 9ef1c79922 Rename marshal.Task to marshal.CopyContext.
CopyContext is a better name for the interface because from
go-marshal's perspective, the interface has nothing to do with a
task. A kernel.Task happens to implement the interface, but so can
other things like MemoryManager and IO sequences.

PiperOrigin-RevId: 331959678
2020-09-16 02:10:12 -07:00
Rahat MahmoodandgVisor bot 3ca73841d7 Move the 'marshal' and 'primitive' packages to the 'pkg' directory.
PiperOrigin-RevId: 331256608
2020-09-11 17:42:49 -07:00
Adin ScannellandgVisor bot 101c97d6f8 Change nogo failures to test failures, instead of build failures.
PiperOrigin-RevId: 329408633
2020-08-31 17:09:20 -07:00
gVisor bot c81ac8ec3b Merge pull request #2672 from amscanne:shim-integrated
PiperOrigin-RevId: 321053634
2020-07-13 16:10:58 -07:00
Adin ScannellandgVisor bot c615aafa21 Add internal nogo analysis & checkescape tool.
See tools/nogo/README.md.

The checkescape tool is able to perform recursive escape analysis, using the
actual generated binary to confirm the results produced by the compiler itself.

As an initial use case, this replaces the manual escape analysis tests used for
go_marshal, and validates that the CopyIn and CopyOut paths will not require
any allocation or stack splits.

Updates #2243

PiperOrigin-RevId: 307532986
2020-04-20 20:58:20 -07:00
Rahat MahmoodandgVisor bot 1561ae3037 go-marshal: Allow array lens to be consts and simple expressions.
Previously, go-marshal only allowed literals for array
lengths. However, it's very common for ABI structs to have a fix-sized
array whose length is defined by a constant; for example PATH_MAX.
Having to convert all such arrays to have literal lengths is too
awkward.

PiperOrigin-RevId: 304289345
2020-04-01 16:51:28 -07:00
Rahat MahmoodandgVisor bot 840980aeba Implement automated marshalling for slices of Marshallable types.
PiperOrigin-RevId: 304119255
2020-03-31 22:56:09 -07:00
Rahat MahmoodandgVisor bot aa9f8abaef Implement automated marshalling for newtypes on arrays.
PiperOrigin-RevId: 297693838
2020-02-27 14:52:26 -08:00
gVisor botandCopybara-Service f1b72752e5 Implement automated marshalling for newtypes on primitives.
PiperOrigin-RevId: 296322954
2020-02-20 16:23:56 -08:00
gVisor bot 48d9aa7ab3 Add a minimal binary target for escape analysis on go-marshal.
Note that this is not an automated test.

PiperOrigin-RevId: 295238672
2020-02-14 15:21:03 -08:00
Adin ScannellandgVisor bot 0e2f1b7abd Update package locations.
Because the abi will depend on the core types for marshalling (usermem,
context, safemem, safecopy), these need to be flattened from the sentry
directory. These packages contain no sentry-specific details.

PiperOrigin-RevId: 291811289
2020-01-27 15:31:32 -08:00