@ttsc/linux-arm 0.7.2 → 0.8.0-dev.20260505
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/go/VERSION +2 -2
- package/bin/go/bin/go +0 -0
- package/bin/go/bin/gofmt +0 -0
- package/bin/go/pkg/tool/linux_arm/asm +0 -0
- package/bin/go/pkg/tool/linux_arm/cgo +0 -0
- package/bin/go/pkg/tool/linux_arm/compile +0 -0
- package/bin/go/pkg/tool/linux_arm/cover +0 -0
- package/bin/go/pkg/tool/linux_arm/fix +0 -0
- package/bin/go/pkg/tool/linux_arm/link +0 -0
- package/bin/go/pkg/tool/linux_arm/preprofile +0 -0
- package/bin/go/pkg/tool/linux_arm/vet +0 -0
- package/bin/go/src/archive/tar/format.go +6 -0
- package/bin/go/src/archive/tar/reader.go +24 -4
- package/bin/go/src/builtin/builtin.go +13 -4
- package/bin/go/src/crypto/tls/conn.go +7 -3
- package/bin/go/src/crypto/tls/handshake_client_tls13.go +2 -2
- package/bin/go/src/crypto/tls/handshake_server_tls13.go +2 -2
- package/bin/go/src/crypto/x509/constraints.go +33 -33
- package/bin/go/src/crypto/x509/verify.go +28 -13
- package/bin/go/src/html/template/attr_string.go +3 -2
- package/bin/go/src/html/template/context.go +21 -1
- package/bin/go/src/html/template/element_string.go +3 -2
- package/bin/go/src/html/template/escape.go +16 -2
- package/bin/go/src/html/template/state_string.go +5 -3
- package/bin/go/src/html/template/transition.go +41 -6
- package/bin/go/src/internal/buildcfg/zbootstrap.go +1 -1
- package/bin/go/src/internal/godebugs/table.go +1 -0
- package/bin/go/src/internal/poll/fd_windows.go +64 -38
- package/bin/go/src/internal/poll/fstatat_unix.go +22 -0
- package/bin/go/src/internal/poll/sendfile_windows.go +3 -1
- package/bin/go/src/internal/syscall/unix/at.go +0 -17
- package/bin/go/src/internal/syscall/unix/at_sysnum_linux.go +2 -1
- package/bin/go/src/internal/syscall/unix/fchmodat_linux.go +51 -0
- package/bin/go/src/internal/syscall/unix/fchmodat_other.go +29 -0
- package/bin/go/src/internal/syscall/windows/at_windows.go +20 -3
- package/bin/go/src/internal/syscall/windows/syscall_windows.go +4 -0
- package/bin/go/src/internal/syscall/windows/types_windows.go +82 -0
- package/bin/go/src/internal/syscall/windows/zsyscall_windows.go +27 -0
- package/bin/go/src/net/http/doc.go +0 -1
- package/bin/go/src/net/sendfile.go +2 -0
- package/bin/go/src/net/sendfile_stub.go +2 -0
- package/bin/go/src/net/sendfile_windows.go +3 -0
- package/bin/go/src/net/url/url.go +21 -16
- package/bin/go/src/os/dir_darwin.go +2 -2
- package/bin/go/src/os/dir_unix.go +2 -2
- package/bin/go/src/os/file.go +0 -3
- package/bin/go/src/os/file_unix.go +9 -5
- package/bin/go/src/os/root_unix.go +1 -0
- package/bin/go/src/os/stat.go +3 -0
- package/bin/go/src/os/statat.go +24 -0
- package/bin/go/src/os/statat_other.go +12 -0
- package/bin/go/src/os/statat_unix.go +20 -0
- package/bin/go/src/reflect/value.go +3 -2
- package/bin/go/src/runtime/defs_linux_mips64x.go +1 -1
- package/bin/go/src/runtime/defs_linux_mipsx.go +1 -1
- package/bin/go/src/runtime/metrics/doc.go +5 -0
- package/bin/go/src/runtime/print.go +16 -4
- package/bin/go/src/runtime/race/README +9 -9
- package/bin/go/src/runtime/race/internal/amd64v1/race_darwin.patch +63 -0
- package/bin/go/src/runtime/race/internal/amd64v1/race_darwin.syso +0 -0
- package/bin/go/src/runtime/race/internal/amd64v1/race_freebsd.patch +63 -0
- package/bin/go/src/runtime/race/internal/amd64v1/race_freebsd.syso +0 -0
- package/bin/go/src/runtime/race/internal/amd64v1/race_linux.patch +63 -0
- package/bin/go/src/runtime/race/internal/amd64v1/race_linux.syso +0 -0
- package/bin/go/src/runtime/race/internal/amd64v1/race_windows.patch +63 -0
- package/bin/go/src/runtime/race/internal/amd64v1/race_windows.syso +0 -0
- package/bin/go/src/runtime/race/internal/amd64v3/race_linux.patch +63 -0
- package/bin/go/src/runtime/race/internal/amd64v3/race_linux.syso +0 -0
- package/bin/go/src/runtime/race/race_darwin_arm64.patch +63 -0
- package/bin/go/src/runtime/race/race_darwin_arm64.syso +0 -0
- package/bin/go/src/runtime/race/race_linux_arm64.patch +63 -0
- package/bin/go/src/runtime/race/race_linux_arm64.syso +0 -0
- package/bin/go/src/runtime/race/race_linux_loong64.patch +63 -0
- package/bin/go/src/runtime/race/race_linux_loong64.syso +0 -0
- package/bin/go/src/runtime/race/race_linux_s390x.patch +63 -0
- package/bin/go/src/runtime/race/race_linux_s390x.syso +0 -0
- package/bin/ttsc +0 -0
- package/package.json +1 -1
|
@@ -23,6 +23,8 @@ var transitionFunc = [...]func(context, []byte) (context, int){
|
|
|
23
23
|
stateRCDATA: tSpecialTagEnd,
|
|
24
24
|
stateAttr: tAttr,
|
|
25
25
|
stateURL: tURL,
|
|
26
|
+
stateMetaContent: tMetaContent,
|
|
27
|
+
stateMetaContentURL: tMetaContentURL,
|
|
26
28
|
stateSrcset: tURL,
|
|
27
29
|
stateJS: tJS,
|
|
28
30
|
stateJSDqStr: tJSDelimited,
|
|
@@ -83,6 +85,7 @@ var elementContentType = [...]state{
|
|
|
83
85
|
elementStyle: stateCSS,
|
|
84
86
|
elementTextarea: stateRCDATA,
|
|
85
87
|
elementTitle: stateRCDATA,
|
|
88
|
+
elementMeta: stateText,
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
// tTag is the context transition function for the tag state.
|
|
@@ -93,6 +96,11 @@ func tTag(c context, s []byte) (context, int) {
|
|
|
93
96
|
return c, len(s)
|
|
94
97
|
}
|
|
95
98
|
if s[i] == '>' {
|
|
99
|
+
// Treat <meta> specially, because it doesn't have an end tag, and we
|
|
100
|
+
// want to transition into the correct state/element for it.
|
|
101
|
+
if c.element == elementMeta {
|
|
102
|
+
return context{state: stateText, element: elementNone}, i + 1
|
|
103
|
+
}
|
|
96
104
|
return context{
|
|
97
105
|
state: elementContentType[c.element],
|
|
98
106
|
element: c.element,
|
|
@@ -113,6 +121,8 @@ func tTag(c context, s []byte) (context, int) {
|
|
|
113
121
|
attrName := strings.ToLower(string(s[i:j]))
|
|
114
122
|
if c.element == elementScript && attrName == "type" {
|
|
115
123
|
attr = attrScriptType
|
|
124
|
+
} else if c.element == elementMeta && attrName == "content" {
|
|
125
|
+
attr = attrMetaContent
|
|
116
126
|
} else {
|
|
117
127
|
switch attrType(attrName) {
|
|
118
128
|
case contentTypeURL:
|
|
@@ -162,12 +172,13 @@ func tAfterName(c context, s []byte) (context, int) {
|
|
|
162
172
|
}
|
|
163
173
|
|
|
164
174
|
var attrStartStates = [...]state{
|
|
165
|
-
attrNone:
|
|
166
|
-
attrScript:
|
|
167
|
-
attrScriptType:
|
|
168
|
-
attrStyle:
|
|
169
|
-
attrURL:
|
|
170
|
-
attrSrcset:
|
|
175
|
+
attrNone: stateAttr,
|
|
176
|
+
attrScript: stateJS,
|
|
177
|
+
attrScriptType: stateAttr,
|
|
178
|
+
attrStyle: stateCSS,
|
|
179
|
+
attrURL: stateURL,
|
|
180
|
+
attrSrcset: stateSrcset,
|
|
181
|
+
attrMetaContent: stateMetaContent,
|
|
171
182
|
}
|
|
172
183
|
|
|
173
184
|
// tBeforeValue is the context transition function for stateBeforeValue.
|
|
@@ -203,6 +214,7 @@ var specialTagEndMarkers = [...][]byte{
|
|
|
203
214
|
elementStyle: []byte("style"),
|
|
204
215
|
elementTextarea: []byte("textarea"),
|
|
205
216
|
elementTitle: []byte("title"),
|
|
217
|
+
elementMeta: []byte(""),
|
|
206
218
|
}
|
|
207
219
|
|
|
208
220
|
var (
|
|
@@ -612,6 +624,28 @@ func tError(c context, s []byte) (context, int) {
|
|
|
612
624
|
return c, len(s)
|
|
613
625
|
}
|
|
614
626
|
|
|
627
|
+
// tMetaContent is the context transition function for the meta content attribute state.
|
|
628
|
+
func tMetaContent(c context, s []byte) (context, int) {
|
|
629
|
+
for i := 0; i < len(s); i++ {
|
|
630
|
+
if i+3 <= len(s)-1 && bytes.Equal(bytes.ToLower(s[i:i+4]), []byte("url=")) {
|
|
631
|
+
c.state = stateMetaContentURL
|
|
632
|
+
return c, i + 4
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
return c, len(s)
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// tMetaContentURL is the context transition function for the "url=" part of a meta content attribute state.
|
|
639
|
+
func tMetaContentURL(c context, s []byte) (context, int) {
|
|
640
|
+
for i := 0; i < len(s); i++ {
|
|
641
|
+
if s[i] == ';' {
|
|
642
|
+
c.state = stateMetaContent
|
|
643
|
+
return c, i + 1
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
return c, len(s)
|
|
647
|
+
}
|
|
648
|
+
|
|
615
649
|
// eatAttrName returns the largest j such that s[i:j] is an attribute name.
|
|
616
650
|
// It returns an error if s[i:] does not look like it begins with an
|
|
617
651
|
// attribute name, such as encountering a quote mark without a preceding
|
|
@@ -638,6 +672,7 @@ var elementNameMap = map[string]element{
|
|
|
638
672
|
"style": elementStyle,
|
|
639
673
|
"textarea": elementTextarea,
|
|
640
674
|
"title": elementTitle,
|
|
675
|
+
"meta": elementMeta,
|
|
641
676
|
}
|
|
642
677
|
|
|
643
678
|
// asciiAlpha reports whether c is an ASCII letter.
|
|
@@ -15,7 +15,7 @@ const DefaultGORISCV64 = `rva20u64`
|
|
|
15
15
|
const defaultGOEXPERIMENT = ``
|
|
16
16
|
const defaultGO_EXTLINK_ENABLED = ``
|
|
17
17
|
const defaultGO_LDSO = ``
|
|
18
|
-
const version = `go1.26.
|
|
18
|
+
const version = `go1.26.2`
|
|
19
19
|
const defaultGOOS = runtime.GOOS
|
|
20
20
|
const defaultGOARCH = runtime.GOARCH
|
|
21
21
|
const DefaultGOFIPS140 = `off`
|
|
@@ -40,6 +40,7 @@ var All = []Info{
|
|
|
40
40
|
{Name: "gocacheverify", Package: "cmd/go"},
|
|
41
41
|
{Name: "gotestjsonbuildtext", Package: "cmd/go", Changed: 24, Old: "1"},
|
|
42
42
|
{Name: "gotypesalias", Package: "go/types", Changed: 23, Old: "0"},
|
|
43
|
+
{Name: "htmlmetacontenturlescape", Package: "html/template"},
|
|
43
44
|
{Name: "http2client", Package: "net/http"},
|
|
44
45
|
{Name: "http2debug", Package: "net/http", Opaque: true},
|
|
45
46
|
{Name: "http2server", Package: "net/http"},
|
|
@@ -149,7 +149,7 @@ var wsaMsgPool = sync.Pool{
|
|
|
149
149
|
|
|
150
150
|
// newWSAMsg creates a new WSAMsg with the provided parameters.
|
|
151
151
|
// Use [freeWSAMsg] to free it.
|
|
152
|
-
func newWSAMsg(p []byte, oob []byte, flags int,
|
|
152
|
+
func newWSAMsg(p []byte, oob []byte, flags int, rsa *wsaRsa) *windows.WSAMsg {
|
|
153
153
|
// The returned object can't be allocated in the stack because it is accessed asynchronously
|
|
154
154
|
// by Windows in between several system calls. If the stack frame is moved while that happens,
|
|
155
155
|
// then Windows may access invalid memory.
|
|
@@ -159,39 +159,53 @@ func newWSAMsg(p []byte, oob []byte, flags int, unconnected bool) *windows.WSAMs
|
|
|
159
159
|
msg := wsaMsgPool.Get().(*windows.WSAMsg)
|
|
160
160
|
msg.Buffers.Len = uint32(len(p))
|
|
161
161
|
msg.Buffers.Buf = unsafe.SliceData(p)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
if len(oob) > 0 {
|
|
163
|
+
msg.Control = syscall.WSABuf{
|
|
164
|
+
Len: uint32(len(oob)),
|
|
165
|
+
Buf: unsafe.SliceData(oob),
|
|
166
|
+
}
|
|
165
167
|
}
|
|
166
168
|
msg.Flags = uint32(flags)
|
|
167
|
-
if
|
|
168
|
-
msg.Name =
|
|
169
|
-
msg.Namelen =
|
|
169
|
+
if rsa != nil {
|
|
170
|
+
msg.Name = &rsa.name
|
|
171
|
+
msg.Namelen = rsa.namelen
|
|
170
172
|
}
|
|
171
173
|
return msg
|
|
172
174
|
}
|
|
173
175
|
|
|
174
176
|
func freeWSAMsg(msg *windows.WSAMsg) {
|
|
175
177
|
// Clear pointers to buffers so they can be released by garbage collector.
|
|
178
|
+
msg.Name = nil
|
|
179
|
+
msg.Namelen = 0
|
|
176
180
|
msg.Buffers.Len = 0
|
|
177
181
|
msg.Buffers.Buf = nil
|
|
178
182
|
msg.Control.Len = 0
|
|
179
183
|
msg.Control.Buf = nil
|
|
180
|
-
if msg.Name != nil {
|
|
181
|
-
*msg.Name = syscall.RawSockaddrAny{}
|
|
182
|
-
wsaRsaPool.Put(msg.Name)
|
|
183
|
-
msg.Name = nil
|
|
184
|
-
msg.Namelen = 0
|
|
185
|
-
}
|
|
186
184
|
wsaMsgPool.Put(msg)
|
|
187
185
|
}
|
|
188
186
|
|
|
187
|
+
// wsaRsa bundles a [syscall.RawSockaddrAny] with its length for efficient caching.
|
|
188
|
+
//
|
|
189
|
+
// When used by WSARecvFrom, wsaRsa must be on the heap. See
|
|
190
|
+
// https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsarecvfrom.
|
|
191
|
+
type wsaRsa struct {
|
|
192
|
+
name syscall.RawSockaddrAny
|
|
193
|
+
namelen int32
|
|
194
|
+
}
|
|
195
|
+
|
|
189
196
|
var wsaRsaPool = sync.Pool{
|
|
190
197
|
New: func() any {
|
|
191
|
-
return new(
|
|
198
|
+
return new(wsaRsa)
|
|
192
199
|
},
|
|
193
200
|
}
|
|
194
201
|
|
|
202
|
+
func newWSARsa() *wsaRsa {
|
|
203
|
+
rsa := wsaRsaPool.Get().(*wsaRsa)
|
|
204
|
+
rsa.name = syscall.RawSockaddrAny{}
|
|
205
|
+
rsa.namelen = int32(unsafe.Sizeof(syscall.RawSockaddrAny{}))
|
|
206
|
+
return rsa
|
|
207
|
+
}
|
|
208
|
+
|
|
195
209
|
var operationPool = sync.Pool{
|
|
196
210
|
New: func() any {
|
|
197
211
|
return new(operation)
|
|
@@ -737,19 +751,18 @@ func (fd *FD) ReadFrom(buf []byte) (int, syscall.Sockaddr, error) {
|
|
|
737
751
|
|
|
738
752
|
fd.pin('r', &buf[0])
|
|
739
753
|
|
|
740
|
-
rsa :=
|
|
754
|
+
rsa := newWSARsa()
|
|
741
755
|
defer wsaRsaPool.Put(rsa)
|
|
742
756
|
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
|
743
|
-
rsan := int32(unsafe.Sizeof(*rsa))
|
|
744
757
|
var flags uint32
|
|
745
|
-
err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &
|
|
758
|
+
err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, &rsa.name, &rsa.namelen, &o.o, nil)
|
|
746
759
|
return qty, err
|
|
747
760
|
})
|
|
748
761
|
err = fd.eofError(n, err)
|
|
749
762
|
if err != nil {
|
|
750
763
|
return n, nil, err
|
|
751
764
|
}
|
|
752
|
-
sa, _ := rsa.Sockaddr()
|
|
765
|
+
sa, _ := rsa.name.Sockaddr()
|
|
753
766
|
return n, sa, nil
|
|
754
767
|
}
|
|
755
768
|
|
|
@@ -768,19 +781,18 @@ func (fd *FD) ReadFromInet4(buf []byte, sa4 *syscall.SockaddrInet4) (int, error)
|
|
|
768
781
|
|
|
769
782
|
fd.pin('r', &buf[0])
|
|
770
783
|
|
|
771
|
-
rsa :=
|
|
784
|
+
rsa := newWSARsa()
|
|
772
785
|
defer wsaRsaPool.Put(rsa)
|
|
773
786
|
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
|
774
|
-
rsan := int32(unsafe.Sizeof(*rsa))
|
|
775
787
|
var flags uint32
|
|
776
|
-
err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &
|
|
788
|
+
err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, &rsa.name, &rsa.namelen, &o.o, nil)
|
|
777
789
|
return qty, err
|
|
778
790
|
})
|
|
779
791
|
err = fd.eofError(n, err)
|
|
780
792
|
if err != nil {
|
|
781
793
|
return n, err
|
|
782
794
|
}
|
|
783
|
-
rawToSockaddrInet4(rsa, sa4)
|
|
795
|
+
rawToSockaddrInet4(&rsa.name, sa4)
|
|
784
796
|
return n, err
|
|
785
797
|
}
|
|
786
798
|
|
|
@@ -799,19 +811,18 @@ func (fd *FD) ReadFromInet6(buf []byte, sa6 *syscall.SockaddrInet6) (int, error)
|
|
|
799
811
|
|
|
800
812
|
fd.pin('r', &buf[0])
|
|
801
813
|
|
|
802
|
-
rsa :=
|
|
814
|
+
rsa := newWSARsa()
|
|
803
815
|
defer wsaRsaPool.Put(rsa)
|
|
804
816
|
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
|
805
|
-
rsan := int32(unsafe.Sizeof(*rsa))
|
|
806
817
|
var flags uint32
|
|
807
|
-
err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, rsa, &
|
|
818
|
+
err = syscall.WSARecvFrom(fd.Sysfd, newWsaBuf(buf), 1, &qty, &flags, &rsa.name, &rsa.namelen, &o.o, nil)
|
|
808
819
|
return qty, err
|
|
809
820
|
})
|
|
810
821
|
err = fd.eofError(n, err)
|
|
811
822
|
if err != nil {
|
|
812
823
|
return n, err
|
|
813
824
|
}
|
|
814
|
-
rawToSockaddrInet6(rsa, sa6)
|
|
825
|
+
rawToSockaddrInet6(&rsa.name, sa6)
|
|
815
826
|
return n, err
|
|
816
827
|
}
|
|
817
828
|
|
|
@@ -1371,7 +1382,9 @@ func (fd *FD) ReadMsg(p []byte, oob []byte, flags int) (int, int, int, syscall.S
|
|
|
1371
1382
|
p = p[:maxRW]
|
|
1372
1383
|
}
|
|
1373
1384
|
|
|
1374
|
-
|
|
1385
|
+
rsa := newWSARsa()
|
|
1386
|
+
defer wsaRsaPool.Put(rsa)
|
|
1387
|
+
msg := newWSAMsg(p, oob, flags, rsa)
|
|
1375
1388
|
defer freeWSAMsg(msg)
|
|
1376
1389
|
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
|
1377
1390
|
err = windows.WSARecvMsg(fd.Sysfd, msg, &qty, &o.o, nil)
|
|
@@ -1396,7 +1409,9 @@ func (fd *FD) ReadMsgInet4(p []byte, oob []byte, flags int, sa4 *syscall.Sockadd
|
|
|
1396
1409
|
p = p[:maxRW]
|
|
1397
1410
|
}
|
|
1398
1411
|
|
|
1399
|
-
|
|
1412
|
+
rsa := newWSARsa()
|
|
1413
|
+
defer wsaRsaPool.Put(rsa)
|
|
1414
|
+
msg := newWSAMsg(p, oob, flags, rsa)
|
|
1400
1415
|
defer freeWSAMsg(msg)
|
|
1401
1416
|
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
|
1402
1417
|
err = windows.WSARecvMsg(fd.Sysfd, msg, &qty, &o.o, nil)
|
|
@@ -1420,7 +1435,9 @@ func (fd *FD) ReadMsgInet6(p []byte, oob []byte, flags int, sa6 *syscall.Sockadd
|
|
|
1420
1435
|
p = p[:maxRW]
|
|
1421
1436
|
}
|
|
1422
1437
|
|
|
1423
|
-
|
|
1438
|
+
rsa := newWSARsa()
|
|
1439
|
+
defer wsaRsaPool.Put(rsa)
|
|
1440
|
+
msg := newWSAMsg(p, oob, flags, rsa)
|
|
1424
1441
|
defer freeWSAMsg(msg)
|
|
1425
1442
|
n, err := fd.execIO('r', func(o *operation) (qty uint32, err error) {
|
|
1426
1443
|
err = windows.WSARecvMsg(fd.Sysfd, msg, &qty, &o.o, nil)
|
|
@@ -1444,15 +1461,18 @@ func (fd *FD) WriteMsg(p []byte, oob []byte, sa syscall.Sockaddr) (int, int, err
|
|
|
1444
1461
|
}
|
|
1445
1462
|
defer fd.writeUnlock()
|
|
1446
1463
|
|
|
1447
|
-
|
|
1448
|
-
defer freeWSAMsg(msg)
|
|
1464
|
+
var rsa *wsaRsa
|
|
1449
1465
|
if sa != nil {
|
|
1466
|
+
rsa = newWSARsa()
|
|
1467
|
+
defer wsaRsaPool.Put(rsa)
|
|
1450
1468
|
var err error
|
|
1451
|
-
|
|
1469
|
+
rsa.namelen, err = sockaddrToRaw(&rsa.name, sa)
|
|
1452
1470
|
if err != nil {
|
|
1453
1471
|
return 0, 0, err
|
|
1454
1472
|
}
|
|
1455
1473
|
}
|
|
1474
|
+
msg := newWSAMsg(p, oob, 0, rsa)
|
|
1475
|
+
defer freeWSAMsg(msg)
|
|
1456
1476
|
n, err := fd.execIO('w', func(o *operation) (qty uint32, err error) {
|
|
1457
1477
|
err = windows.WSASendMsg(fd.Sysfd, msg, 0, nil, &o.o, nil)
|
|
1458
1478
|
return qty, err
|
|
@@ -1471,11 +1491,14 @@ func (fd *FD) WriteMsgInet4(p []byte, oob []byte, sa *syscall.SockaddrInet4) (in
|
|
|
1471
1491
|
}
|
|
1472
1492
|
defer fd.writeUnlock()
|
|
1473
1493
|
|
|
1474
|
-
|
|
1475
|
-
defer freeWSAMsg(msg)
|
|
1494
|
+
var rsa *wsaRsa
|
|
1476
1495
|
if sa != nil {
|
|
1477
|
-
|
|
1496
|
+
rsa = newWSARsa()
|
|
1497
|
+
defer wsaRsaPool.Put(rsa)
|
|
1498
|
+
rsa.namelen = sockaddrInet4ToRaw(&rsa.name, sa)
|
|
1478
1499
|
}
|
|
1500
|
+
msg := newWSAMsg(p, oob, 0, rsa)
|
|
1501
|
+
defer freeWSAMsg(msg)
|
|
1479
1502
|
n, err := fd.execIO('w', func(o *operation) (qty uint32, err error) {
|
|
1480
1503
|
err = windows.WSASendMsg(fd.Sysfd, msg, 0, nil, &o.o, nil)
|
|
1481
1504
|
return qty, err
|
|
@@ -1494,11 +1517,14 @@ func (fd *FD) WriteMsgInet6(p []byte, oob []byte, sa *syscall.SockaddrInet6) (in
|
|
|
1494
1517
|
}
|
|
1495
1518
|
defer fd.writeUnlock()
|
|
1496
1519
|
|
|
1497
|
-
|
|
1498
|
-
defer freeWSAMsg(msg)
|
|
1520
|
+
var rsa *wsaRsa
|
|
1499
1521
|
if sa != nil {
|
|
1500
|
-
|
|
1522
|
+
rsa = newWSARsa()
|
|
1523
|
+
defer wsaRsaPool.Put(rsa)
|
|
1524
|
+
rsa.namelen = sockaddrInet6ToRaw(&rsa.name, sa)
|
|
1501
1525
|
}
|
|
1526
|
+
msg := newWSAMsg(p, oob, 0, rsa)
|
|
1527
|
+
defer freeWSAMsg(msg)
|
|
1502
1528
|
n, err := fd.execIO('w', func(o *operation) (qty uint32, err error) {
|
|
1503
1529
|
err = windows.WSASendMsg(fd.Sysfd, msg, 0, nil, &o.o, nil)
|
|
1504
1530
|
return qty, err
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright 2026 The Go Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
//go:build unix || wasip1
|
|
6
|
+
|
|
7
|
+
package poll
|
|
8
|
+
|
|
9
|
+
import (
|
|
10
|
+
"internal/syscall/unix"
|
|
11
|
+
"syscall"
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
func (fd *FD) Fstatat(name string, s *syscall.Stat_t, flags int) error {
|
|
15
|
+
if err := fd.incref(); err != nil {
|
|
16
|
+
return err
|
|
17
|
+
}
|
|
18
|
+
defer fd.decref()
|
|
19
|
+
return ignoringEINTR(func() error {
|
|
20
|
+
return unix.Fstatat(fd.Sysfd, name, s, flags)
|
|
21
|
+
})
|
|
22
|
+
}
|
|
@@ -68,8 +68,10 @@ func SendFile(fd *FD, src uintptr, size int64) (written int64, err error, handle
|
|
|
68
68
|
chunkSize = size
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
fd.setOffset(startpos + written)
|
|
72
71
|
n, err := fd.execIO('w', func(o *operation) (uint32, error) {
|
|
72
|
+
off := startpos + written
|
|
73
|
+
o.o.OffsetHigh = uint32(off >> 32)
|
|
74
|
+
o.o.Offset = uint32(off)
|
|
73
75
|
err := syscall.TransmitFile(fd.Sysfd, hsrc, uint32(chunkSize), 0, &o.o, nil, syscall.TF_WRITE_BEHIND)
|
|
74
76
|
if err != nil {
|
|
75
77
|
return 0, err
|
|
@@ -80,23 +80,6 @@ func Mkdirat(dirfd int, path string, mode uint32) error {
|
|
|
80
80
|
return nil
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
func Fchmodat(dirfd int, path string, mode uint32, flags int) error {
|
|
84
|
-
p, err := syscall.BytePtrFromString(path)
|
|
85
|
-
if err != nil {
|
|
86
|
-
return err
|
|
87
|
-
}
|
|
88
|
-
_, _, errno := syscall.Syscall6(fchmodatTrap,
|
|
89
|
-
uintptr(dirfd),
|
|
90
|
-
uintptr(unsafe.Pointer(p)),
|
|
91
|
-
uintptr(mode),
|
|
92
|
-
uintptr(flags),
|
|
93
|
-
0, 0)
|
|
94
|
-
if errno != 0 {
|
|
95
|
-
return errno
|
|
96
|
-
}
|
|
97
|
-
return nil
|
|
98
|
-
}
|
|
99
|
-
|
|
100
83
|
func Fchownat(dirfd int, path string, uid, gid int, flags int) error {
|
|
101
84
|
p, err := syscall.BytePtrFromString(path)
|
|
102
85
|
if err != nil {
|
|
@@ -11,7 +11,6 @@ const (
|
|
|
11
11
|
openatTrap uintptr = syscall.SYS_OPENAT
|
|
12
12
|
readlinkatTrap uintptr = syscall.SYS_READLINKAT
|
|
13
13
|
mkdiratTrap uintptr = syscall.SYS_MKDIRAT
|
|
14
|
-
fchmodatTrap uintptr = syscall.SYS_FCHMODAT
|
|
15
14
|
fchownatTrap uintptr = syscall.SYS_FCHOWNAT
|
|
16
15
|
linkatTrap uintptr = syscall.SYS_LINKAT
|
|
17
16
|
symlinkatTrap uintptr = syscall.SYS_SYMLINKAT
|
|
@@ -24,4 +23,6 @@ const (
|
|
|
24
23
|
AT_SYMLINK_NOFOLLOW = 0x100
|
|
25
24
|
|
|
26
25
|
UTIME_OMIT = 0x3ffffffe
|
|
26
|
+
|
|
27
|
+
O_PATH = 0x200000
|
|
27
28
|
)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Copyright 2026 The Go Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
//go:build linux
|
|
6
|
+
|
|
7
|
+
package unix
|
|
8
|
+
|
|
9
|
+
import (
|
|
10
|
+
"internal/strconv"
|
|
11
|
+
"syscall"
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
func Fchmodat(dirfd int, path string, mode uint32, flags int) error {
|
|
15
|
+
// On Linux, the fchmodat syscall silently ignores the AT_SYMLINK_NOFOLLOW flag.
|
|
16
|
+
// We need to use fchmodat2 instead.
|
|
17
|
+
// syscall.Fchmodat handles this.
|
|
18
|
+
if err := syscall.Fchmodat(dirfd, path, mode, flags); err != syscall.EOPNOTSUPP {
|
|
19
|
+
return err
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// This kernel doesn't appear to support fchmodat2 (added in Linux 6.6).
|
|
23
|
+
// We can't fall back to Fchmod, because it requires write permissions on the file.
|
|
24
|
+
// Instead, use the same workaround as GNU libc and musl, which is to open the file
|
|
25
|
+
// and then fchmodat the FD in /proc/self/fd.
|
|
26
|
+
// See: https://lwn.net/Articles/939217/
|
|
27
|
+
fd, err := Openat(dirfd, path, O_PATH|syscall.O_NOFOLLOW|syscall.O_CLOEXEC, 0)
|
|
28
|
+
if err != nil {
|
|
29
|
+
return err
|
|
30
|
+
}
|
|
31
|
+
defer syscall.Close(fd)
|
|
32
|
+
procPath := "/proc/self/fd/" + strconv.Itoa(fd)
|
|
33
|
+
|
|
34
|
+
// Check to see if this file is a symlink.
|
|
35
|
+
// (We passed O_NOFOLLOW above, but O_PATH|O_NOFOLLOW will open a symlink.)
|
|
36
|
+
var st syscall.Stat_t
|
|
37
|
+
if err := syscall.Stat(procPath, &st); err != nil {
|
|
38
|
+
if err == syscall.ENOENT {
|
|
39
|
+
// /proc has probably not been mounted. Give up.
|
|
40
|
+
return syscall.EOPNOTSUPP
|
|
41
|
+
}
|
|
42
|
+
return err
|
|
43
|
+
}
|
|
44
|
+
if st.Mode&syscall.S_IFMT == syscall.S_IFLNK {
|
|
45
|
+
// fchmodat on the proc FD for a symlink apparently gives inconsistent
|
|
46
|
+
// results, so just refuse to try.
|
|
47
|
+
return syscall.EOPNOTSUPP
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return syscall.Fchmodat(AT_FDCWD, procPath, mode, flags&^AT_SYMLINK_NOFOLLOW)
|
|
51
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2026 The Go Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style
|
|
3
|
+
// license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
//go:build dragonfly || freebsd || netbsd || (openbsd && mips64)
|
|
6
|
+
|
|
7
|
+
package unix
|
|
8
|
+
|
|
9
|
+
import (
|
|
10
|
+
"syscall"
|
|
11
|
+
"unsafe"
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
func Fchmodat(dirfd int, path string, mode uint32, flags int) error {
|
|
15
|
+
p, err := syscall.BytePtrFromString(path)
|
|
16
|
+
if err != nil {
|
|
17
|
+
return err
|
|
18
|
+
}
|
|
19
|
+
_, _, errno := syscall.Syscall6(fchmodatTrap,
|
|
20
|
+
uintptr(dirfd),
|
|
21
|
+
uintptr(unsafe.Pointer(p)),
|
|
22
|
+
uintptr(mode),
|
|
23
|
+
uintptr(flags),
|
|
24
|
+
0, 0)
|
|
25
|
+
if errno != 0 {
|
|
26
|
+
return errno
|
|
27
|
+
}
|
|
28
|
+
return nil
|
|
29
|
+
}
|
|
@@ -246,14 +246,31 @@ func Deleteat(dirfd syscall.Handle, name string, options uint32) error {
|
|
|
246
246
|
var h syscall.Handle
|
|
247
247
|
err := NtOpenFile(
|
|
248
248
|
&h,
|
|
249
|
-
|
|
249
|
+
FILE_READ_ATTRIBUTES|DELETE,
|
|
250
250
|
objAttrs,
|
|
251
251
|
&IO_STATUS_BLOCK{},
|
|
252
252
|
FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE,
|
|
253
|
-
FILE_OPEN_REPARSE_POINT|FILE_OPEN_FOR_BACKUP_INTENT|
|
|
253
|
+
FILE_OPEN_REPARSE_POINT|FILE_OPEN_FOR_BACKUP_INTENT|options,
|
|
254
254
|
)
|
|
255
255
|
if err != nil {
|
|
256
|
-
|
|
256
|
+
if ntStatus, ok := err.(NTStatus); !ok || ntStatus != STATUS_ACCESS_DENIED {
|
|
257
|
+
return ntCreateFileError(err, 0)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Access denied, try opening with DELETE only.
|
|
261
|
+
// This may succeed if the file has restrictive permissions
|
|
262
|
+
// but the caller has delete child permission on the parent directory.
|
|
263
|
+
err = NtOpenFile(
|
|
264
|
+
&h,
|
|
265
|
+
DELETE,
|
|
266
|
+
objAttrs,
|
|
267
|
+
&IO_STATUS_BLOCK{},
|
|
268
|
+
FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE,
|
|
269
|
+
FILE_OPEN_REPARSE_POINT|FILE_OPEN_FOR_BACKUP_INTENT|options,
|
|
270
|
+
)
|
|
271
|
+
if err != nil {
|
|
272
|
+
return ntCreateFileError(err, 0)
|
|
273
|
+
}
|
|
257
274
|
}
|
|
258
275
|
defer syscall.CloseHandle(h)
|
|
259
276
|
|
|
@@ -561,6 +561,7 @@ const (
|
|
|
561
561
|
STATUS_NOT_SUPPORTED NTStatus = 0xC00000BB
|
|
562
562
|
STATUS_INVALID_PARAMETER NTStatus = 0xC000000D
|
|
563
563
|
STATUS_INVALID_INFO_CLASS NTStatus = 0xC0000003
|
|
564
|
+
STATUS_ACCESS_DENIED NTStatus = 0xC0000022
|
|
564
565
|
)
|
|
565
566
|
|
|
566
567
|
const (
|
|
@@ -579,3 +580,6 @@ type FILE_MODE_INFORMATION struct {
|
|
|
579
580
|
//sys NtSetInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuffer unsafe.Pointer, inBufferLen uint32, class uint32) (ntstatus error) = ntdll.NtSetInformationFile
|
|
580
581
|
//sys RtlIsDosDeviceName_U(name *uint16) (ret uint32) = ntdll.RtlIsDosDeviceName_U
|
|
581
582
|
//sys NtQueryInformationFile(handle syscall.Handle, iosb *IO_STATUS_BLOCK, inBuffer unsafe.Pointer, inBufferLen uint32, class uint32) (ntstatus error) = ntdll.NtQueryInformationFile
|
|
583
|
+
|
|
584
|
+
//sys SetEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) = advapi32.SetEntriesInAclW
|
|
585
|
+
//sys SetNamedSecurityInfo(objectName string, objectType uint32, securityInformation uint32, owner *syscall.SID, group *syscall.SID, dacl *ACL, sacl *ACL) (ret error) = advapi32.SetNamedSecurityInfoW
|
|
@@ -301,3 +301,85 @@ const ValidFileFlagsMask = O_FILE_FLAG_OPEN_REPARSE_POINT |
|
|
|
301
301
|
O_FILE_FLAG_NO_BUFFERING |
|
|
302
302
|
O_FILE_FLAG_RANDOM_ACCESS |
|
|
303
303
|
O_FILE_FLAG_WRITE_THROUGH
|
|
304
|
+
|
|
305
|
+
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa379636.aspx
|
|
306
|
+
type TRUSTEE struct {
|
|
307
|
+
MultipleTrustee *TRUSTEE
|
|
308
|
+
MultipleTrusteeOperation uint32
|
|
309
|
+
TrusteeForm uint32
|
|
310
|
+
TrusteeType uint32
|
|
311
|
+
Name uintptr
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa379638.aspx
|
|
315
|
+
const (
|
|
316
|
+
TRUSTEE_IS_SID = 0x0
|
|
317
|
+
TRUSTEE_IS_NAME = 0x1
|
|
318
|
+
TRUSTEE_BAD_FORM = 0x2
|
|
319
|
+
TRUSTEE_IS_OBJECTS_AND_SID = 0x3
|
|
320
|
+
TRUSTEE_IS_OBJECTS_AND_NAME = 0x4
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa446627.aspx
|
|
324
|
+
type EXPLICIT_ACCESS struct {
|
|
325
|
+
AccessPermissions uint32
|
|
326
|
+
AccessMode uint32
|
|
327
|
+
Inheritance uint32
|
|
328
|
+
Trustee TRUSTEE
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa374899.aspx
|
|
332
|
+
const (
|
|
333
|
+
NOT_USED_ACCESS = 0x0
|
|
334
|
+
GRANT_ACCESS = 0x1
|
|
335
|
+
SET_ACCESS = 0x2
|
|
336
|
+
DENY_ACCESS = 0x3
|
|
337
|
+
REVOKE_ACCESS = 0x4
|
|
338
|
+
SET_AUDIT_SUCCESS = 0x5
|
|
339
|
+
SET_AUDIT_FAILURE = 0x6
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa446627.aspx
|
|
343
|
+
const (
|
|
344
|
+
NO_INHERITANCE = 0x0
|
|
345
|
+
SUB_OBJECTS_ONLY_INHERIT = 0x1
|
|
346
|
+
SUB_CONTAINERS_ONLY_INHERIT = 0x2
|
|
347
|
+
SUB_CONTAINERS_AND_OBJECTS_INHERIT = 0x3
|
|
348
|
+
INHERIT_NO_PROPAGATE = 0x4
|
|
349
|
+
INHERIT_ONLY = 0x8
|
|
350
|
+
)
|
|
351
|
+
|
|
352
|
+
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa379593.aspx
|
|
353
|
+
const (
|
|
354
|
+
SE_UNKNOWN_OBJECT_TYPE = 0x0
|
|
355
|
+
SE_FILE_OBJECT = 0x1
|
|
356
|
+
SE_SERVICE = 0x2
|
|
357
|
+
SE_PRINTER = 0x3
|
|
358
|
+
SE_REGISTRY_KEY = 0x4
|
|
359
|
+
SE_LMSHARE = 0x5
|
|
360
|
+
SE_KERNEL_OBJECT = 0x6
|
|
361
|
+
SE_WINDOW_OBJECT = 0x7
|
|
362
|
+
SE_DS_OBJECT = 0x8
|
|
363
|
+
SE_DS_OBJECT_ALL = 0x9
|
|
364
|
+
SE_PROVIDER_DEFINED_OBJECT = 0xa
|
|
365
|
+
SE_WMIGUID_OBJECT = 0xb
|
|
366
|
+
SE_REGISTRY_WOW64_32KEY = 0xc
|
|
367
|
+
SE_REGISTRY_WOW64_64KEY = 0xd
|
|
368
|
+
)
|
|
369
|
+
|
|
370
|
+
// https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/23e75ca3-98fd-4396-84e5-86cd9d40d343
|
|
371
|
+
const (
|
|
372
|
+
OWNER_SECURITY_INFORMATION = 0x00000001
|
|
373
|
+
GROUP_SECURITY_INFORMATION = 0x00000002
|
|
374
|
+
DACL_SECURITY_INFORMATION = 0x00000004
|
|
375
|
+
SACL_SECURITY_INFORMATION = 0x00000008
|
|
376
|
+
LABEL_SECURITY_INFORMATION = 0x00000010
|
|
377
|
+
UNPROTECTED_SACL_SECURITY_INFORMATION = 0x10000000
|
|
378
|
+
UNPROTECTED_DACL_SECURITY_INFORMATION = 0x20000000
|
|
379
|
+
PROTECTED_SACL_SECURITY_INFORMATION = 0x40000000
|
|
380
|
+
PROTECTED_DACL_SECURITY_INFORMATION = 0x80000000
|
|
381
|
+
ATTRIBUTE_SECURITY_INFORMATION = 0x00000020
|
|
382
|
+
SCOPE_SECURITY_INFORMATION = 0x00000040
|
|
383
|
+
PROCESS_TRUST_LABEL_SECURITY_INFORMATION = 0x00000080
|
|
384
|
+
BACKUP_SECURITY_INFORMATION = 0x00010000
|
|
385
|
+
)
|