summaryrefslogtreecommitdiffhomepage
path: root/pkg/abi/linux/xattr.go
diff options
context:
space:
mode:
authorDean Deng <deandeng@google.com>2019-12-16 13:18:36 -0800
committergVisor bot <gvisor-bot@google.com>2019-12-16 13:20:07 -0800
commite6f4124afd951c3b089f9c75c499c14f4d90a590 (patch)
tree6d6d91b04330bc4f2539b5b018da795db20b4aea /pkg/abi/linux/xattr.go
parent6b424530397e5100b08628efe8f6c62178daa70b (diff)
Implement checks for get/setxattr at the syscall layer.
Add checks for input arguments, file type, permissions, etc. that match the Linux implementation. A call to get/setxattr that passes all the checks will still currently return EOPNOTSUPP. Actual support will be added in following commits. Only allow user.* extended attributes for the time being. PiperOrigin-RevId: 285835159
Diffstat (limited to 'pkg/abi/linux/xattr.go')
-rw-r--r--pkg/abi/linux/xattr.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/pkg/abi/linux/xattr.go b/pkg/abi/linux/xattr.go
new file mode 100644
index 000000000..a3b6406fa
--- /dev/null
+++ b/pkg/abi/linux/xattr.go
@@ -0,0 +1,27 @@
+// Copyright 2019 The gVisor Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package linux
+
+// Constants for extended attributes.
+const (
+ XATTR_NAME_MAX = 255
+ XATTR_SIZE_MAX = 65536
+
+ XATTR_CREATE = 1
+ XATTR_REPLACE = 2
+
+ XATTR_USER_PREFIX = "user."
+ XATTR_USER_PREFIX_LEN = len(XATTR_USER_PREFIX)
+)