diff --git a/bot/access.go b/bot/access.go index 14f2d5b..fe51702 100644 --- a/bot/access.go +++ b/bot/access.go @@ -189,6 +189,28 @@ func (b *Bot) BanAuth(ctx context.Context, addr net.Addr) { } } +// Ban an address listed in DNS Blacklists automatically +func (b *Bot) BanDNSBL(ctx context.Context, addr net.Addr) { + if !b.cfg.GetBot(ctx).BanlistEnabled() { + return + } + + if !b.cfg.GetBot(ctx).BanlistDNSBL() { + return + } + + if b.IsTrusted(addr) { + return + } + b.log.Debug().Str("addr", addr.String()).Msg("attempting to automatically ban") + banlist := b.cfg.GetBanlist(ctx) + banlist.Add(addr) + err := b.cfg.SetBanlist(ctx, banlist) + if err != nil { + b.log.Error().Err(err).Str("addr", addr.String()).Msg("cannot update banlist") + } +} + // Ban an address manually func (b *Bot) BanManually(ctx context.Context, addr net.Addr) { if !b.cfg.GetBot(ctx).BanlistEnabled() { diff --git a/bot/command.go b/bot/command.go index a37404b..be685a2 100644 --- a/bot/command.go +++ b/bot/command.go @@ -35,6 +35,7 @@ const ( commandBanlistTotals = "banlist:totals" commandBanlistAuto = "banlist:auto" commandBanlistAuth = "banlist:auth" + commandBanlistDNSBL = "banlist:dnsbl" commandBanlistAdd = "banlist:add" commandBanlistRemove = "banlist:remove" commandBanlistReset = "banlist:reset" @@ -336,6 +337,11 @@ func (b *Bot) initCommands() commandList { description: "Enable/disable automatic banning of IP addresses when they try to auth with invalid credentials", allowed: b.allowAdmin, }, + { + key: commandBanlistDNSBL, + description: "Enable/disable automatic banning of IP addresses when they are listed in DNS Blacklists", + allowed: b.allowAdmin, + }, { key: commandBanlistAuto, description: "Enable/disable automatic banning of IP addresses when they try to send invalid emails", @@ -433,6 +439,8 @@ func (b *Bot) handle(ctx context.Context) { b.runBanlist(ctx, commandSlice) case commandBanlistAuth: b.runBanlistAuth(ctx, commandSlice) + case commandBanlistDNSBL: + b.runBanlistDNSBL(ctx, commandSlice) case commandBanlistAuto: b.runBanlistAuto(ctx, commandSlice) case commandBanlistTotals: diff --git a/bot/command_admin.go b/bot/command_admin.go index 0c21585..e994244 100644 --- a/bot/command_admin.go +++ b/bot/command_admin.go @@ -380,6 +380,33 @@ func (b *Bot) runBanlistAuth(ctx context.Context, commandSlice []string) { //nol b.lp.SendNotice(ctx, evt.RoomID, "auth banning has been updated", linkpearl.RelatesTo(evt.ID)) } +func (b *Bot) runBanlistDNSBL(ctx context.Context, commandSlice []string) { //nolint:dupl // not in that case + evt := eventFromContext(ctx) + cfg := b.cfg.GetBot(ctx) + if len(commandSlice) < 2 { + var msg strings.Builder + msg.WriteString("Currently: `") + msg.WriteString(cfg.Get(config.BotBanlistDNSBL)) + msg.WriteString("`\n\n") + + if !cfg.BanlistDNSBL() { + msg.WriteString("To enable automatic banning by using DNS Blacklists, send `") + msg.WriteString(b.prefix) + msg.WriteString(" banlist:dnsbl true` (banlist itself must be enabled!)\n\n") + } + + b.lp.SendNotice(ctx, evt.RoomID, msg.String(), linkpearl.RelatesTo(evt.ID)) + return + } + value := utils.SanitizeBoolString(commandSlice[1]) + cfg.Set(config.BotBanlistDNSBL, value) + err := b.cfg.SetBot(ctx, cfg) + if err != nil { + b.Error(ctx, "cannot set bot config: %v", err) + } + b.lp.SendNotice(ctx, evt.RoomID, "dns blacklists banning has been updated", linkpearl.RelatesTo(evt.ID)) +} + func (b *Bot) runBanlistAuto(ctx context.Context, commandSlice []string) { //nolint:dupl // not in that case evt := eventFromContext(ctx) cfg := b.cfg.GetBot(ctx) diff --git a/bot/config/bot.go b/bot/config/bot.go index c0adca0..25a7344 100644 --- a/bot/config/bot.go +++ b/bot/config/bot.go @@ -23,6 +23,7 @@ const ( BotBanlistEnabled = "banlist:enabled" BotBanlistAuto = "banlist:auto" BotBanlistAuth = "banlist:auth" + BotBanlistDNSBL = "banlist:dnsbl" BotGreylist = "greylist" BotMautrix015Migration = "mautrix015migration" ) @@ -84,6 +85,11 @@ func (s Bot) BanlistAuth() bool { return utils.Bool(s.Get(BotBanlistAuth)) } +// BanlistDNSBL option +func (s Bot) BanlistDNSBL() bool { + return utils.Bool(s.Get(BotBanlistDNSBL)) +} + // Greylist option (duration in minutes) func (s Bot) Greylist() int { return utils.Int(s.Get(BotGreylist)) diff --git a/go.mod b/go.mod index aea85df..35db680 100644 --- a/go.mod +++ b/go.mod @@ -2,10 +2,6 @@ module gitlab.com/etke.cc/postmoogle go 1.21.0 -toolchain go1.22.0 - -// replace gitlab.com/etke.cc/linkpearl => ../linkpearl - require ( github.com/archdx/zerolog-sentry v1.8.4 github.com/emersion/go-msgauth v0.6.8 @@ -65,7 +61,7 @@ require ( golang.org/x/sys v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect modernc.org/gc/v3 v3.0.0-20240722195230-4a140ff9c08e // indirect - modernc.org/libc v1.55.3 // indirect + modernc.org/libc v1.55.4 // indirect modernc.org/mathutil v1.6.0 // indirect modernc.org/memory v1.8.0 // indirect modernc.org/strutil v1.2.0 // indirect diff --git a/go.sum b/go.sum index a7b6579..5d81aa9 100644 --- a/go.sum +++ b/go.sum @@ -151,16 +151,16 @@ maunium.net/go/mautrix v0.19.0 h1:67eSJWam93mw44Q0/1SiOG7zQzXMUknUv5UaWkrODDU= maunium.net/go/mautrix v0.19.0/go.mod h1:UE+mSQ4sDUuJMbjN0aB9EjQSGgXd48AzMvZ6+QJV1k8= modernc.org/cc/v4 v4.21.4 h1:3Be/Rdo1fpr8GrQ7IVw9OHtplU4gWbb+wNgeoBMmGLQ= modernc.org/cc/v4 v4.21.4/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ= -modernc.org/ccgo/v4 v4.19.2 h1:lwQZgvboKD0jBwdaeVCTouxhxAyN6iawF3STraAal8Y= -modernc.org/ccgo/v4 v4.19.2/go.mod h1:ysS3mxiMV38XGRTTcgo0DQTeTmAO4oCmJl1nX9VFI3s= +modernc.org/ccgo/v4 v4.20.4 h1:3pPOlMcblnu5CBU3w1BFtepwBnLezGjPYTH8xBeYZM8= +modernc.org/ccgo/v4 v4.20.4/go.mod h1:meYiLeaGpKQmHBw8roW4DXLkDvusG+MD7LJ/kYyAouU= modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE= modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ= -modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw= -modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU= +modernc.org/gc/v2 v2.4.3 h1:Ik4ZcMbC7aY4ZDPUhzXVXi7GMub9QcXLTfXn3mWpNw8= +modernc.org/gc/v2 v2.4.3/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU= modernc.org/gc/v3 v3.0.0-20240722195230-4a140ff9c08e h1:WPC4v0rNIFb2PY+nBBEEKyugPPRHPzUgyN3xZPpGK58= modernc.org/gc/v3 v3.0.0-20240722195230-4a140ff9c08e/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4= -modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U= -modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w= +modernc.org/libc v1.55.4 h1:iWzZ96v1Iut2Sm4lEp0yzFde20M9zpcI0wY3DFcb+8g= +modernc.org/libc v1.55.4/go.mod h1:GPuVtbWvXUo590z/xfVIQcOqnugb1WovSfMJWMe0ZfA= modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E= diff --git a/justfile b/justfile index 419c187..ab7719a 100644 --- a/justfile +++ b/justfile @@ -39,7 +39,7 @@ test packages="./...": # run app run: - @go run ./cmd + @CGO_ENABLED=0 go run -ldflags '-extldflags "-static"' -tags timetzdata,goolm ./cmd # build app build: diff --git a/smtp/authserver.go b/smtp/authserver.go index b6ac207..f52b3e8 100644 --- a/smtp/authserver.go +++ b/smtp/authserver.go @@ -40,12 +40,6 @@ func (a *PlainAuthServer) Next(response []byte) (challenge []byte, done bool, er err = sasl.ErrUnexpectedClientResponse return } - addr := a.conn.Conn().RemoteAddr() - if a.bot.IsBanned(a.ctx, addr) { - err = ErrBanned - return - } - // No initial response, send an empty challenge if response == nil { return []byte{}, false, nil @@ -55,7 +49,7 @@ func (a *PlainAuthServer) Next(response []byte) (challenge []byte, done bool, er parts := bytes.Split(response, []byte("\x00")) if len(parts) != 3 { - a.bot.BanAuth(a.ctx, addr) + a.bot.BanAuth(a.ctx, a.conn.Conn().RemoteAddr()) err = errors.New("sasl: invalid response. Don't bother me anymore, kupo") return } diff --git a/smtp/dnsbl.go b/smtp/dnsbl.go new file mode 100644 index 0000000..081192f --- /dev/null +++ b/smtp/dnsbl.go @@ -0,0 +1,202 @@ +package smtp + +import ( + "context" + "errors" + "net" + "slices" + "strconv" + "strings" + "sync" + "time" + + "github.com/rs/zerolog" + "gitlab.com/etke.cc/postmoogle/utils" +) + +const ( + // DNSBLTimeout is the timeout for DNSBL requests + DNSBLTimeout = 5 * time.Second + // DNSBLDefaultSignal is the default signal for DNSBLs + DNSBLDefaultSignal = "127.0.0.2" +) + +// DNSBLs is a list of Domain Name System Blacklists with list of signals they use +var DNSBLs = map[string][]string{ + "b.barracudacentral.org": {DNSBLDefaultSignal}, + "bl.spamcop.net": {DNSBLDefaultSignal, "127.0.0.3"}, + "ix.dnsbl.manitu.net": {DNSBLDefaultSignal}, + "psbl.surriel.com": {DNSBLDefaultSignal}, + "rbl.interserver.net": {DNSBLDefaultSignal}, + "spam.dnsbl.anonmails.de": {DNSBLDefaultSignal}, + "zen.spamhaus.org": {DNSBLDefaultSignal, "127.0.0.3", "127.0.0.4", "127.0.0.5", "127.0.0.6", "127.0.0.7", "127.0.0.9"}, + "rbl.your-server.de": {DNSBLDefaultSignal}, +} + +// DNSBLRequest is a request to check if an IP address is listed in any of the DNSBLs +type DNSBLRequest struct { + ctx context.Context //nolint:containedctx // this is a request struct + log *zerolog.Logger + addr net.Addr + ttl time.Duration + results []*DNSBLResult + wg *sync.WaitGroup +} + +type DNSBLResult struct { + RBL string + Reasons string + Listed bool + Error bool +} + +// CheckDNSBLs checks if the given IP address is listed in any of the DNSBLs, and returns a decision, based on the results +func CheckDNSBLs(ctx context.Context, log *zerolog.Logger, addr net.Addr, optionalTimeout ...time.Duration) bool { + ttl := DNSBLTimeout + if len(optionalTimeout) > 0 { + ttl = optionalTimeout[0] + } + logger := log.With().Str("addr", addr.String()).Logger() + + req := &DNSBLRequest{ + ctx: ctx, + log: &logger, + addr: addr, + ttl: ttl, + results: make([]*DNSBLResult, 0, len(DNSBLs)), + wg: &sync.WaitGroup{}, + } + req.check() + total := len(req.results) + var listed, unlisted int + var listedRBLs, unlistedRBLs, failedRBLs []string + for _, r := range req.results { + if r.Error { + failedRBLs = append(failedRBLs, r.RBL) + continue + } + if r.Listed { + listed++ + listedRBLs = append(listedRBLs, r.RBL) + } else { + unlisted++ + unlistedRBLs = append(unlistedRBLs, r.RBL) + } + } + + decision := req.decision(total, listed, unlisted) + logger.Info(). + Int("listed_in", listed). + Strs("listed_rbls", listedRBLs). + Int("unlisted_in", unlisted). + Strs("unlisted_rbls", unlistedRBLs). + Strs("failed_rbls", failedRBLs). + Int("total", total). + Bool("blocked", decision). + Msg("DNSBL results") + + return decision +} + +// check checks if the given IP address is listed in any of the DNSBLs +func (req *DNSBLRequest) check() { + req.wg.Add(len(DNSBLs)) + defer req.wg.Wait() + + for rbl, signals := range DNSBLs { + go req.checkRBL(rbl, signals) + } +} + +func (req *DNSBLRequest) checkRBL(rbl string, signals []string) { + defer req.wg.Done() + + ctx, cancel := context.WithTimeout(req.ctx, req.ttl) + defer cancel() + + host := req.getHost(rbl) + log := req.log.With().Str("rbl", rbl).Str("host", host).Logger() + log.Debug().Msg("checking") + + // first, check if the host is mentioned in the RBL ("listed" status can be set _only_ if the signal will match) + ips, err := net.DefaultResolver.LookupHost(ctx, host) + var dnsErr *net.DNSError + if err != nil { + // not found = not listed + if errors.As(err, &dnsErr) && dnsErr.IsNotFound { + req.results = append(req.results, &DNSBLResult{RBL: rbl, Listed: false}) + return + } + // other errors = unknown status + req.results = append(req.results, &DNSBLResult{RBL: rbl, Error: true}) + return + } + // if the host is resolved, check if there is any signal in the response + // if not = not listed + if len(ips) == 0 { + req.results = append(req.results, &DNSBLResult{RBL: rbl, Listed: false}) + return + } + + // if there is a DNS entry, check if it matches any of the signals + for _, ip := range ips { + // if the signal is found = listed + if slices.Contains(signals, ip) { + // get TXT records for the host, just additional information + txts, _ := net.DefaultResolver.LookupTXT(ctx, host) //nolint:errcheck // the host is listed for sure, just no information about it + req.results = append(req.results, &DNSBLResult{RBL: rbl, Listed: true, Reasons: strings.Join(txts, "; ")}) + log.Debug().Str("signal", ip).Msg("listed") + return + } + } + // if no signal is found = not listed, despite the host being resolved + req.results = append(req.results, &DNSBLResult{RBL: rbl, Listed: false}) +} + +// getHost returns the host name for the given DNSBL list +func (req *DNSBLRequest) getHost(list string) string { + ip := net.ParseIP(utils.AddrIP(req.addr)) + if ip == nil { + return "" + } + var b strings.Builder + v4 := ip.To4() + if v4 != nil { + s := len(v4) - 1 + for i := s; i >= 0; i-- { + if i < s { + b.WriteByte('.') + } + b.WriteString(strconv.Itoa(int(v4[i]))) + } + } else { + s := len(ip) - 1 + const chars = "0123456789abcdef" + for i := s; i >= 0; i-- { + if i < s { + b.WriteByte('.') + } + v := ip[i] + b.WriteByte(chars[v>>0&0xf]) + b.WriteByte('.') + b.WriteByte(chars[v>>4&0xf]) + } + } + b.WriteString(".") + b.WriteString(list) + b.WriteString(".") // trailing dot is required + + return b.String() +} + +// decision returns a decision based on the DNSBL results +func (req *DNSBLRequest) decision(total, listed, unlisted int) bool { + if total == 0 || listed == 0 { + return false + } + + if listed < unlisted { + return false + } + return true +} diff --git a/smtp/listener.go b/smtp/listener.go index e629202..61b58a4 100644 --- a/smtp/listener.go +++ b/smtp/listener.go @@ -17,9 +17,16 @@ type Listener struct { tlsMu sync.Mutex listener net.Listener isBanned func(context.Context, net.Addr) bool + banDNSBL func(context.Context, net.Addr) } -func NewListener(port string, tlsConfig *tls.Config, isBanned func(context.Context, net.Addr) bool, log *zerolog.Logger) (*Listener, error) { +func NewListener( + port string, + tlsConfig *tls.Config, + isBanned func(context.Context, net.Addr) bool, + banDNSBL func(context.Context, net.Addr), + log *zerolog.Logger, +) (*Listener, error) { actual, err := net.Listen("tcp", ":"+port) if err != nil { return nil, err @@ -31,6 +38,7 @@ func NewListener(port string, tlsConfig *tls.Config, isBanned func(context.Conte tls: tlsConfig, listener: actual, isBanned: isBanned, + banDNSBL: banDNSBL, }, nil } @@ -53,13 +61,24 @@ func (l *Listener) Accept() (net.Conn, error) { continue } } - if l.isBanned(context.Background(), conn.RemoteAddr()) { + ctx := context.Background() + log := l.log.With().Str("addr", conn.RemoteAddr().String()).Logger() + if l.isBanned(ctx, conn.RemoteAddr()) { conn.Close() - l.log.Info().Str("addr", conn.RemoteAddr().String()).Msg("rejected connection (already banned)") + log.Info().Msg("rejected connection (already banned)") continue } - l.log.Info().Str("addr", conn.RemoteAddr().String()).Msg("accepted connection") + log.Info().Msg("checking dns blacklists...") + if CheckDNSBLs(ctx, l.log, conn.RemoteAddr()) { + //nolint:gocritic // TODO + // conn.Close() + // l.banDNSBL(ctx, conn.RemoteAddr()) + log.Info().Msg("should rejected connection (DNS Blacklist); but won't do it for now (for testing purposes)") + continue + } + + log.Info().Msg("accepted connection") if l.tls != nil { return l.acceptTLS(conn) diff --git a/smtp/manager.go b/smtp/manager.go index 64f81e1..528bd1b 100644 --- a/smtp/manager.go +++ b/smtp/manager.go @@ -67,6 +67,7 @@ type matrixbot interface { IsTrusted(net.Addr) bool BanAuto(context.Context, net.Addr) BanAuth(context.Context, net.Addr) + BanDNSBL(context.Context, net.Addr) GetMapping(context.Context, string) (id.RoomID, bool) GetIFOptions(context.Context, id.RoomID) email.IncomingFilteringOptions IncomingEmail(context.Context, *email.Email) error @@ -173,7 +174,7 @@ func (m *Manager) Stop() { } func (m *Manager) listen(port string, tlsConfig *tls.Config) { - lwrapper, err := NewListener(port, tlsConfig, m.bot.IsBanned, m.log) + lwrapper, err := NewListener(port, tlsConfig, m.bot.IsBanned, m.bot.BanDNSBL, m.log) if err != nil { m.log.Error().Err(err).Str("port", port).Msg("cannot start listener") m.errs <- err diff --git a/smtp/session.go b/smtp/session.go index 2572070..d84b0a8 100644 --- a/smtp/session.go +++ b/smtp/session.go @@ -75,9 +75,6 @@ func (s *session) Auth(mech string) (sasl.Server, error) { func (s *session) authPlain(_, username, password string) error { addr := s.conn.Conn().RemoteAddr() - if s.bot.IsBanned(s.ctx, addr) { - return ErrBanned - } if !email.AddressValid(username) { s.log.Debug().Str("address", username).Msg("address is invalid") s.bot.BanAuth(s.ctx, addr) diff --git a/vendor/modernc.org/libc/builder.json b/vendor/modernc.org/libc/builder.json index 8245fb0..73a0955 100644 --- a/vendor/modernc.org/libc/builder.json +++ b/vendor/modernc.org/libc/builder.json @@ -1,7 +1,7 @@ { "autogen": "linux/(amd64|arm64|loong64)", - "autoupdate": "linux/amd64", "autotag": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|openbsd/(386|amd64|arm64)|windows/(amd64|arm64|386)", + "autoupdate": "linux/amd64", "download": [ {"re": "linux/(amd64|arm64|loong64)", "files": ["https://git.musl-libc.org/cgit/musl/snapshot/musl-7ada6dde6f9dc6a2836c3d92c2f762d35fd229e0.tar.gz"]} ], diff --git a/vendor/modernc.org/libc/builtin.go b/vendor/modernc.org/libc/builtin.go index 5582af6..dedd5b5 100644 --- a/vendor/modernc.org/libc/builtin.go +++ b/vendor/modernc.org/libc/builtin.go @@ -56,6 +56,10 @@ func X__builtin_ctz(t *TLS, n uint32) int32 { return int32(mbits.TrailingZeros32(n)) } +func X__builtin_ctzl(tls *TLS, x ulong) int32 { + return int32(mbits.TrailingZeros64(x)) +} + func X__builtin_clz(t *TLS, n uint32) int32 { return int32(mbits.LeadingZeros32(n)) } diff --git a/vendor/modernc.org/libc/ccgo_linux_amd64.go b/vendor/modernc.org/libc/ccgo_linux_amd64.go index 1626731..2b25bd7 100644 --- a/vendor/modernc.org/libc/ccgo_linux_amd64.go +++ b/vendor/modernc.org/libc/ccgo_linux_amd64.go @@ -13942,7 +13942,7 @@ func X__ctype_get_mb_cur_max(tls *TLS) (r Tsize_t) { } var v1 int32 _ = v1 - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v1 = int32(4) } else { v1 = int32(1) @@ -25022,7 +25022,7 @@ func X__reset_tls(tls *TLS) { var mem, p uintptr var self Tpthread_t _, _, _, _, _ = i, mem, n, p, self - self = ___get_tp(tls) + self = uintptr(___get_tp(tls)) n = *(*Tuintptr_t)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(self)).Fdtv)) if n != 0 { p = X__libc.Ftls_head @@ -25058,7 +25058,7 @@ func X__init_ssp(tls *TLS, entropy uintptr) { * still be detected. Endianness is taken care of * automatically. */ *(*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__stack_chk_guard)) + 1)) = 0 - (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fcanary = X__stack_chk_guard + (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fcanary = X__stack_chk_guard } func X__stack_chk_fail(tls *TLS) { @@ -25668,7 +25668,7 @@ func Xstrerror(tls *TLS, e int32) (r uintptr) { trc("tls=%v e=%v, (%v:)", tls, e, origin(2)) defer func() { trc("-> %v", r) }() } - return X__strerror_l(tls, e, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strerror_l(tls, e, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xstrerror_l(tls *TLS, e int32, loc Tlocale_t) (r uintptr) { @@ -31227,7 +31227,7 @@ func X__lctrans_cur(tls *TLS, msg uintptr) (r uintptr) { trc("tls=%v msg=%v, (%v:)", tls, msg, origin(2)) defer func() { trc("-> %v", r) }() } - return X__lctrans_impl(tls, msg, *(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale + 5*8))) + return X__lctrans_impl(tls, msg, *(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale + 5*8))) } func _swapc(tls *TLS, x Tuint32_t, c int32) (r Tuint32_t) { @@ -31807,7 +31807,7 @@ func Xdcngettext(tls *TLS, domainname uintptr, msgid1 uintptr, msgid2 uintptr, n var _ /* z at bp+8 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alt_modlen, catlen, catname, csp, dirlen, dirname, domlen, l, lm, loc, loclen, locname, locp, map1, modlen, modname, name, np, old_cats, old_errno, p1, plural, q, r, rem, rule, trans, v10, v11, v12, v14, v15, v17, v18, v21, v3, v5, v6, v8, v9 defer func() { Xrealloc(tls, name, 0) }() - loc = (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale + loc = (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale old_errno = *(*int32)(unsafe.Pointer(X__errno_location(tls))) /* match gnu gettext behaviour */ if !(msgid1 != 0) { @@ -98459,7 +98459,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tmbstate_t)(unsafe.Pointer(bp + 24)) = Tmbstate_t{} type1 = *(*uint8)(unsafe.Pointer(map1 + uintptr(-Int32FromInt32(1)))) totype = *(*uint8)(unsafe.Pointer(tomap + uintptr(-Int32FromInt32(1)))) - ploc = ___get_tp(tls) + 168 + ploc = uintptr(___get_tp(tls)) + 168 loc = *(*Tlocale_t)(unsafe.Pointer(ploc)) if !(in != 0) || !(*(*uintptr)(unsafe.Pointer(in)) != 0) || !(*(*Tsize_t)(unsafe.Pointer(inb)) != 0) { return uint64(0) @@ -99493,7 +99493,7 @@ func X__nl_langinfo(tls *TLS, item Tnl_item) (r uintptr) { trc("tls=%v item=%v, (%v:)", tls, item, origin(2)) defer func() { trc("-> %v", r) }() } - return X__nl_langinfo_l(tls, item, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__nl_langinfo_l(tls, item, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xnl_langinfo(tls *TLS, item Tnl_item) (r uintptr) { @@ -100211,7 +100211,7 @@ func Xstrcoll(tls *TLS, l uintptr, r uintptr) (r1 int32) { trc("tls=%v l=%v r=%v, (%v:)", tls, l, r, origin(2)) defer func() { trc("-> %v", r1) }() } - return X__strcoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strcoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xstrcoll_l(tls *TLS, l uintptr, r uintptr, loc Tlocale_t) (r1 int32) { @@ -100377,7 +100377,7 @@ func Xstrfmon(tls *TLS, s uintptr, n Tsize_t, fmt uintptr, va uintptr) (r Tssize var ret Tssize_t _, _ = ap, ret ap = va - ret = _vstrfmon_l(tls, s, n, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale, fmt, ap) + ret = _vstrfmon_l(tls, s, n, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale, fmt, ap) _ = ap return ret } @@ -100452,7 +100452,7 @@ func Xstrxfrm(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r Tsize_t) { trc("tls=%v dest=%v src=%v n=%v, (%v:)", tls, dest, src, n, origin(2)) defer func() { trc("-> %v", r) }() } - return X__strxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } // C documentation @@ -100541,7 +100541,7 @@ func X__uselocale(tls *TLS, new1 Tlocale_t) (r Tlocale_t) { var global, old, v1, v2 Tlocale_t var self Tpthread_t _, _, _, _, _ = global, old, self, v1, v2 - self = ___get_tp(tls) + self = uintptr(___get_tp(tls)) old = (*t__pthread)(unsafe.Pointer(self)).Flocale global = uintptr(unsafe.Pointer(&X__libc)) + 56 if new1 != 0 { @@ -100584,7 +100584,7 @@ func Xwcscoll(tls *TLS, l uintptr, r uintptr) (r1 int32) { trc("tls=%v l=%v r=%v, (%v:)", tls, l, r, origin(2)) defer func() { trc("-> %v", r1) }() } - return X__wcscoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__wcscoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } // C documentation @@ -100625,7 +100625,7 @@ func Xwcsxfrm(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r Tsize_t) { trc("tls=%v dest=%v src=%v n=%v, (%v:)", tls, dest, src, n, origin(2)) defer func() { trc("-> %v", r) }() } - return X__wcsxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__wcsxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } // C documentation @@ -102387,7 +102387,7 @@ func Xasinh(tls *TLS, x3 float64) (r float64) { if uint64(8) == uint64(8) { y1 = x3 + Float64FromFloat32(1.329227995784916e+36) } else { - y2 = x3 + Float64FromFloat32(1.329227995784916e+36) + y2 = float64(x3 + Float64FromFloat32(1.329227995784916e+36)) } } } @@ -103168,7 +103168,7 @@ func Xcbrt(tls *TLS, x float64) (r1 float64) { hx = hx/uint32(3) + _B1 } p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & (Uint64FromUint64(1) << Int32FromInt32(63)) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p1)) & (Uint64FromUint64(1) << Int32FromInt32(63))) *(*Tuint64_t)(unsafe.Pointer(bp)) |= uint64(hx) << int32(32) t = *(*float64)(unsafe.Pointer(bp)) /* @@ -103194,7 +103194,7 @@ func Xcbrt(tls *TLS, x float64) (r1 float64) { * before the final error is larger than 0.667 ulps. */ *(*float64)(unsafe.Pointer(bp)) = t - *(*Tuint64_t)(unsafe.Pointer(bp)) = (*(*Tuint64_t)(unsafe.Pointer(bp)) + Uint64FromUint32(0x80000000)) & uint64(0xffffffffc0000000) + *(*Tuint64_t)(unsafe.Pointer(bp)) = uint64(*(*Tuint64_t)(unsafe.Pointer(bp))+Uint64FromUint32(0x80000000)) & uint64(0xffffffffc0000000) t = *(*float64)(unsafe.Pointer(bp)) /* one step Newton iteration to 53 bits with error < 0.667 ulps */ s = t * t /* t*t is exact */ @@ -103446,9 +103446,9 @@ func Xcopysign(tls *TLS, x float64, y float64) (r float64) { }{} *(*float64)(unsafe.Pointer(bp + 8)) = y p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & (-Uint64FromUint64(1) / Uint64FromInt32(2)) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p1)) & (-Uint64FromUint64(1) / Uint64FromInt32(2))) p2 = bp - *(*Tuint64_t)(unsafe.Pointer(p2)) = *(*Tuint64_t)(unsafe.Pointer(p2)) | *(*Tuint64_t)(unsafe.Pointer(bp + 8))&(Uint64FromUint64(1)< 0, the exponent of scale might have overflowed by <= 460. */ - sbits = sbits - Uint64FromUint64(1009)< 0, the exponent of scale might have overflowed by 1. */ - sbits = sbits - Uint64FromUint64(1)<> Int32FromInt32(12)) - uxi = uxi | Uint64FromUint64(1)<> Int32FromInt32(12))) + uxi = Tuint64_t(uxi | Uint64FromUint64(1)<> Int32FromInt32(12)) + *(*Tuint64_t)(unsafe.Pointer(p6)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p6)) & (-Uint64FromUint64(1) >> Int32FromInt32(12))) p7 = bp + 16 - *(*Tuint64_t)(unsafe.Pointer(p7)) = *(*Tuint64_t)(unsafe.Pointer(p7)) | Uint64FromUint64(1)< 0 { - uxi = uxi - Uint64FromUint64(1)<>= uint64(-ex + int32(1)) @@ -106197,9 +106197,9 @@ func Xfrexp(tls *TLS, x float64, e uintptr) (r float64) { } *(*int32)(unsafe.Pointer(e)) = ee - int32(0x3fe) p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & Uint64FromUint64(0x800fffffffffffff) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p1)) & Uint64FromUint64(0x800fffffffffffff)) p2 = bp - *(*Tuint64_t)(unsafe.Pointer(p2)) = *(*Tuint64_t)(unsafe.Pointer(p2)) | Uint64FromUint64(0x3fe0000000000000) + *(*Tuint64_t)(unsafe.Pointer(p2)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p2)) | Uint64FromUint64(0x3fe0000000000000)) return *(*float64)(unsafe.Pointer(bp)) } @@ -106312,9 +106312,9 @@ func Xhypot(tls *TLS, x float64, y float64) (r float64) { *(*float64)(unsafe.Pointer(bp + 8)) = y /* arrange |x| >= |y| */ p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & (-Uint64FromUint64(1) >> Int32FromInt32(1)) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p1)) & (-Uint64FromUint64(1) >> Int32FromInt32(1))) p2 = bp + 8 - *(*Tuint64_t)(unsafe.Pointer(p2)) = *(*Tuint64_t)(unsafe.Pointer(p2)) & (-Uint64FromUint64(1) >> Int32FromInt32(1)) + *(*Tuint64_t)(unsafe.Pointer(p2)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p2)) & (-Uint64FromUint64(1) >> Int32FromInt32(1))) if *(*Tuint64_t)(unsafe.Pointer(bp)) < *(*Tuint64_t)(unsafe.Pointer(bp + 8)) { ut = *(*struct { Fi [0]Tuint64_t @@ -109189,7 +109189,7 @@ func Xlog(tls *TLS, x1 float64) (r1 float64) { /* x is subnormal, normalize it. */ v9 = x1 * float64(4.503599627370496e+15) ix = *(*Tuint64_t)(unsafe.Pointer(&v9)) - ix = ix - Uint64FromUint64(52)<> (Int32FromInt32(52) - Int32FromInt32(LOG_TABLE_BITS)) % uint64(Int32FromInt32(1)<> int32(52)) /* arithmetic shift */ - iz = ix - tmp&(Uint64FromUint64(0xfff)<> (Int32FromInt32(52) - Int32FromInt32(LOG2_TABLE_BITS)) % uint64(Int32FromInt32(1)<> int32(52)) /* arithmetic shift */ - iz = ix - tmp&(Uint64FromUint64(0xfff)<> Int32FromInt32(12) >> e + mask = uint64(-Uint64FromUint64(1) >> Int32FromInt32(12) >> e) if *(*Tuint64_t)(unsafe.Pointer(bp))&mask == uint64(0) { *(*float64)(unsafe.Pointer(iptr)) = x p3 = bp - *(*Tuint64_t)(unsafe.Pointer(p3)) = *(*Tuint64_t)(unsafe.Pointer(p3)) & (Uint64FromUint64(1) << Int32FromInt32(63)) + *(*Tuint64_t)(unsafe.Pointer(p3)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p3)) & (Uint64FromUint64(1) << Int32FromInt32(63))) return *(*float64)(unsafe.Pointer(bp)) } *(*Tuint64_t)(unsafe.Pointer(bp)) &= ^mask @@ -110329,13 +110329,13 @@ _2: if *(*Tuint64_t)(unsafe.Pointer(bp + 8)) == *(*Tuint64_t)(unsafe.Pointer(bp + 16)) { return y3 } - ax = *(*Tuint64_t)(unsafe.Pointer(bp + 8)) & (-Uint64FromUint64(1) / Uint64FromInt32(2)) - ay = *(*Tuint64_t)(unsafe.Pointer(bp + 16)) & (-Uint64FromUint64(1) / Uint64FromInt32(2)) + ax = uint64(*(*Tuint64_t)(unsafe.Pointer(bp + 8)) & (-Uint64FromUint64(1) / Uint64FromInt32(2))) + ay = uint64(*(*Tuint64_t)(unsafe.Pointer(bp + 16)) & (-Uint64FromUint64(1) / Uint64FromInt32(2))) if ax == uint64(0) { if ay == uint64(0) { return y3 } - *(*Tuint64_t)(unsafe.Pointer(bp + 8)) = *(*Tuint64_t)(unsafe.Pointer(bp + 16))&(Uint64FromUint64(1)< ay || (*(*Tuint64_t)(unsafe.Pointer(bp + 8))^*(*Tuint64_t)(unsafe.Pointer(bp + 16)))&(Uint64FromUint64(1)<> (Int32FromInt32(52) - Int32FromInt32(POW_LOG_TABLE_BITS)) % uint64(Int32FromInt32(1)<> int32(52)) /* arithmetic shift */ - iz = ix - tmp&(Uint64FromUint64(0xfff)< 0, the exponent of scale might have overflowed by <= 460. */ - sbits = sbits - Uint64FromUint64(1009)<> Int32FromInt32(12)) - uxi = uxi | Uint64FromUint64(1)<> Int32FromInt32(12))) + uxi = Tuint64_t(uxi | Uint64FromUint64(1)<> Int32FromInt32(12)) + *(*Tuint64_t)(unsafe.Pointer(p6)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p6)) & (-Uint64FromUint64(1) >> Int32FromInt32(12))) p7 = bp + 16 - *(*Tuint64_t)(unsafe.Pointer(p7)) = *(*Tuint64_t)(unsafe.Pointer(p7)) | Uint64FromUint64(1)< 0 { - uxi = uxi - Uint64FromUint64(1)<>= uint64(-ex + int32(1)) @@ -111785,7 +111785,7 @@ func Xround(tls *TLS, x3 float64) (r float64) { if uint64(8) == uint64(8) { y1 = x3 + _toint6 } else { - y2 = x3 + _toint6 + y2 = float64(x3 + _toint6) } } return Float64FromInt32(0) * *(*float64)(unsafe.Pointer(bp)) @@ -113542,7 +113542,7 @@ func Xtrunc(tls *TLS, x3 float64) (r float64) { if e < int32(12) { e = int32(1) } - m = -Uint64FromUint64(1) >> e + m = uint64(-Uint64FromUint64(1) >> e) if *(*Tuint64_t)(unsafe.Pointer(bp))&m == uint64(0) { return x3 } @@ -113552,7 +113552,7 @@ func Xtrunc(tls *TLS, x3 float64) (r float64) { if uint64(8) == uint64(8) { y1 = x3 + Float64FromFloat32(1.329227995784916e+36) } else { - y2 = x3 + Float64FromFloat32(1.329227995784916e+36) + y2 = float64(x3 + Float64FromFloat32(1.329227995784916e+36)) } } *(*Tuint64_t)(unsafe.Pointer(bp)) &= ^m @@ -116744,7 +116744,7 @@ func Xbtowc(tls *TLS, c int32) (r Twint_t) { if uint32(b) < uint32(128) { v1 = uint32(b) } else { - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v3 = int32(4) } else { v3 = int32(1) @@ -116945,7 +116945,7 @@ func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t, st uintptr) (r Tsize *(*Twchar_t)(unsafe.Pointer(wc)) = v1 return BoolUint64(!!(v1 != 0)) } - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v2 = int32(4) } else { v2 = int32(1) @@ -117116,7 +117116,7 @@ func Xmbsrtowcs(tls *TLS, ws uintptr, src uintptr, wn Tsize_t, st uintptr) (r Ts goto resume0 } } - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v3 = int32(4) } else { v3 = int32(1) @@ -117344,7 +117344,7 @@ func Xmbtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t) (r int32) { *(*Twchar_t)(unsafe.Pointer(wc)) = v1 return BoolInt32(!!(v1 != 0)) } - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v2 = int32(4) } else { v2 = int32(1) @@ -117414,7 +117414,7 @@ func Xwcrtomb(tls *TLS, s uintptr, wc Twchar_t, st uintptr) (r Tsize_t) { *(*int8)(unsafe.Pointer(s)) = int8(wc) return uint64(1) } else { - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v1 = int32(4) } else { v1 = int32(1) @@ -117621,7 +117621,7 @@ func Xwctob(tls *TLS, c Twint_t) (r int32) { if c < uint32(128) { return int32(c) } - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v1 = int32(4) } else { v1 = int32(1) @@ -121247,10 +121247,10 @@ func X__h_errno_location(tls *TLS) (r uintptr) { trc("tls=%v, (%v:)", tls, origin(2)) defer func() { trc("-> %v", r) }() } - if !((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fstack != 0) { + if !((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fstack != 0) { return uintptr(unsafe.Pointer(&Xh_errno)) } - return ___get_tp(tls) + 160 + return uintptr(___get_tp(tls)) + 160 } func Xherror(tls *TLS, msg uintptr) { @@ -128059,7 +128059,7 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, break } if v9 = uint32(*(*int8)(unsafe.Pointer(s + uintptr(-Int32FromInt32(1))))) < uint32(128); !v9 { - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v8 = int32(4) } else { v8 = int32(1) @@ -134509,7 +134509,7 @@ func Xraise(tls *TLS, sig int32) (r int32) { var _ /* set at bp+0 */ Tsigset_t _ = ret X__block_app_sigs(tls, bp) - ret = int32(X__syscall_ret(tls, uint64(X__syscall2(tls, int64(SYS_tkill), int64((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid), int64(sig))))) + ret = int32(X__syscall_ret(tls, uint64(X__syscall2(tls, int64(SYS_tkill), int64((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid), int64(sig))))) X__restore_sigs(tls, bp) return ret } @@ -135227,13 +135227,13 @@ func _fstatat_statx(tls *TLS, fd int32, path uintptr, st uintptr, flag int32) (r return ret } *(*Tstat)(unsafe.Pointer(st)) = Tstat{ - Fst_dev: uint64((*(*Tstatx1)(unsafe.Pointer(bp))).Fstx_dev_major)&Uint64FromUint64(0xfffff000)<= 0 { v1 = ___lockfile(tls, f) @@ -137907,7 +137907,7 @@ func X__do_orphaned_stdio_locks(tls *TLS) { } var f uintptr _ = f - f = (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fstdio_locks + f = (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fstdio_locks for { if !(f != 0) { break @@ -137935,7 +137935,7 @@ func X__unlist_locked_file(tls *TLS, f uintptr) { if (*TFILE)(unsafe.Pointer(f)).Fprev_locked != 0 { (*TFILE)(unsafe.Pointer((*TFILE)(unsafe.Pointer(f)).Fprev_locked)).Fnext_locked = (*TFILE)(unsafe.Pointer(f)).Fnext_locked } else { - (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fstdio_locks = (*TFILE)(unsafe.Pointer(f)).Fnext_locked + (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fstdio_locks = (*TFILE)(unsafe.Pointer(f)).Fnext_locked } } } @@ -137962,7 +137962,7 @@ func Xftrylockfile(tls *TLS, f uintptr) (r int32) { var self Tpthread_t var v5 bool _, _, _, _, _, _, _ = owner, self, tid, v1, v2, v3, v5 - self = ___get_tp(tls) + self = uintptr(___get_tp(tls)) tid = (*t__pthread)(unsafe.Pointer(self)).Ftid owner = AtomicLoadPInt32(f + 140) if owner & ^Int32FromInt32(MAYBE_WAITERS) == tid { @@ -138024,7 +138024,7 @@ func Xfwide(tls *TLS, f uintptr, mode int32) (r int32) { __need_unlock = v1 if mode != 0 { if !((*TFILE)(unsafe.Pointer(f)).Flocale != 0) { - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v3 = int32(4) } else { v3 = int32(1) @@ -138226,7 +138226,7 @@ func Xgetc(tls *TLS, f1 uintptr) (r int32) { _, _, _, _, _, _ = l, v1, v2, v4, v5, v6 v1 = f1 l = AtomicLoadPInt32(v1 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if (*TFILE)(unsafe.Pointer(v1)).Frpos != (*TFILE)(unsafe.Pointer(v1)).Frend { v6 = v1 + 8 v5 = *(*uintptr)(unsafe.Pointer(v6)) @@ -138346,7 +138346,7 @@ func Xgetchar(tls *TLS) (r int32) { _, _, _, _, _, _ = l, v1, v2, v4, v5, v6 v1 = uintptr(unsafe.Pointer(&X__stdin_FILE)) l = AtomicLoadPInt32(v1 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if (*TFILE)(unsafe.Pointer(v1)).Frpos != (*TFILE)(unsafe.Pointer(v1)).Frend { v6 = v1 + 8 v5 = *(*uintptr)(unsafe.Pointer(v6)) @@ -139058,7 +139058,7 @@ func Xputc(tls *TLS, c1 int32, f1 uintptr) (r int32) { v1 = c1 v2 = f1 l = AtomicLoadPInt32(v2 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if int32(uint8(v1)) != (*TFILE)(unsafe.Pointer(v2)).Flbf && (*TFILE)(unsafe.Pointer(v2)).Fwpos != (*TFILE)(unsafe.Pointer(v2)).Fwend { v6 = uint8(v1) v8 = v2 + 40 @@ -139188,7 +139188,7 @@ func Xputchar(tls *TLS, c1 int32) (r int32) { v1 = c1 v2 = uintptr(unsafe.Pointer(&X__stdout_FILE)) l = AtomicLoadPInt32(v2 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if int32(uint8(v1)) != (*TFILE)(unsafe.Pointer(v2)).Flbf && (*TFILE)(unsafe.Pointer(v2)).Fwpos != (*TFILE)(unsafe.Pointer(v2)).Fwend { v6 = uint8(v1) v8 = v2 + 40 @@ -139715,7 +139715,7 @@ func Xungetwc(tls *TLS, c Twint_t, f uintptr) (r Twint_t) { var v3 bool var _ /* mbc at bp+0 */ [4]uint8 _, _, _, _, _, _, _, _, _, _ = __need_unlock, l, loc, ploc, v1, v2, v3, v4, v5, p6 - ploc = ___get_tp(tls) + 168 + ploc = uintptr(___get_tp(tls)) + 168 loc = *(*Tlocale_t)(unsafe.Pointer(ploc)) if AtomicLoadPInt32(f+140) >= 0 { v1 = ___lockfile(tls, f) @@ -139967,7 +139967,7 @@ func _pop_arg(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_ULONG): (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) case int32(_ULLONG): - (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) + (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUint64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_SHORT): (*Targ)(unsafe.Pointer(arg)).Fi = uint64(int16(VaInt32(&*(*Tva_list)(unsafe.Pointer(ap))))) case int32(_USHORT): @@ -139989,7 +139989,7 @@ func _pop_arg(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_UIPTR): (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUintptr(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_DBL): - *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) + *(*float64)(unsafe.Pointer(arg)) = float64(VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_LDBL): *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) } @@ -142144,7 +142144,7 @@ func _pop_arg1(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_ULONG): (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) case int32(_ULLONG): - (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) + (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUint64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_SHORT): (*Targ)(unsafe.Pointer(arg)).Fi = uint64(int16(VaInt32(&*(*Tva_list)(unsafe.Pointer(ap))))) case int32(_USHORT): @@ -142166,7 +142166,7 @@ func _pop_arg1(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_UIPTR): (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUintptr(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_DBL): - *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) + *(*float64)(unsafe.Pointer(arg)) = float64(VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_LDBL): *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) } @@ -144328,7 +144328,7 @@ func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) (r uint64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return _strtox1(tls, s, p, base, Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)) + return _strtox1(tls, s, p, base, uint64(Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1))) } func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { @@ -144336,7 +144336,7 @@ func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return int64(_strtox1(tls, s, p, base, Uint64FromUint64(0)+uint64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1)))) + return int64(_strtox1(tls, s, p, base, uint64(Uint64FromUint64(0)+uint64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1))))) } func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) (r Tintmax_t) { @@ -144608,7 +144608,7 @@ func Xwcstoul(tls *TLS, s uintptr, p uintptr, base int32) (r uint64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return _wcstox1(tls, s, p, base, Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)) + return _wcstox1(tls, s, p, base, uint64(Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1))) } func Xwcstol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { @@ -144616,7 +144616,7 @@ func Xwcstol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return int64(_wcstox1(tls, s, p, base, Uint64FromUint64(0)+uint64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1)))) + return int64(_wcstox1(tls, s, p, base, uint64(Uint64FromUint64(0)+uint64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1))))) } func Xwcstoimax(tls *TLS, s uintptr, p uintptr, base int32) (r Tintmax_t) { @@ -149869,7 +149869,7 @@ func Xstrftime(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr) (r Tsize_t trc("tls=%v s=%v n=%v f=%v tm=%v, (%v:)", tls, s, n, f, tm, origin(2)) defer func() { trc("-> %v", r) }() } - return X__strftime_l(tls, s, n, f, tm, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strftime_l(tls, s, n, f, tm, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xstrftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tlocale_t) (r Tsize_t) { @@ -150613,7 +150613,7 @@ func Xwcsftime(tls *TLS, wcs uintptr, n Tsize_t, f uintptr, tm uintptr) (r Tsize trc("tls=%v wcs=%v n=%v f=%v tm=%v, (%v:)", tls, wcs, n, f, tm, origin(2)) defer func() { trc("-> %v", r) }() } - return X__wcsftime_l(tls, wcs, n, f, tm, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__wcsftime_l(tls, wcs, n, f, tm, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xwcsftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tlocale_t) (r Tsize_t) { diff --git a/vendor/modernc.org/libc/libc_windows.go b/vendor/modernc.org/libc/libc_windows.go index 45aaf38..2a93ced 100644 --- a/vendor/modernc.org/libc/libc_windows.go +++ b/vendor/modernc.org/libc/libc_windows.go @@ -224,18 +224,18 @@ var ( userenvapi = syscall.NewLazyDLL("userenv.dll") procGetProfilesDirectoryW = userenvapi.NewProc("GetProfilesDirectoryW") - modcrt = syscall.NewLazyDLL("msvcrt.dll") - procAccess = modcrt.NewProc("_access") - procChmod = modcrt.NewProc("_chmod") - procGmtime = modcrt.NewProc("gmtime") - procGmtime32 = modcrt.NewProc("_gmtime32") - procGmtime64 = modcrt.NewProc("_gmtime64") - procStat64i32 = modcrt.NewProc("_stat64i32") - procStati64 = modcrt.NewProc("_stati64") - procStrftime = modcrt.NewProc("strftime") - procStrtod = modcrt.NewProc("strtod") + modcrt = syscall.NewLazyDLL("msvcrt.dll") + procAccess = modcrt.NewProc("_access") + procChmod = modcrt.NewProc("_chmod") + procGmtime = modcrt.NewProc("gmtime") + procGmtime32 = modcrt.NewProc("_gmtime32") + procGmtime64 = modcrt.NewProc("_gmtime64") + procStat64i32 = modcrt.NewProc("_stat64i32") + procStati64 = modcrt.NewProc("_stati64") + procStrftime = modcrt.NewProc("strftime") + procStrtod = modcrt.NewProc("strtod") - moducrt = syscall.NewLazyDLL("ucrtbase.dll") + moducrt = syscall.NewLazyDLL("ucrtbase.dll") procFindfirst32 = moducrt.NewProc("_findfirst32") procFindnext32 = moducrt.NewProc("_findnext32") ) @@ -6787,7 +6787,6 @@ func X_stati64(t *TLS, path, buffer uintptr) int32 { return int32(r0) } - // int _fstati64(int fd, struct _stati64 *buffer); func X_fstati64(t *TLS, fd int32, buffer uintptr) int32 { return X_fstat64(t, fd, buffer) diff --git a/vendor/modules.txt b/vendor/modules.txt index 4e6585e..61d1780 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -265,7 +265,7 @@ maunium.net/go/mautrix/sqlstatestore # modernc.org/gc/v3 v3.0.0-20240722195230-4a140ff9c08e ## explicit; go 1.20 modernc.org/gc/v3 -# modernc.org/libc v1.55.3 +# modernc.org/libc v1.55.4 ## explicit; go 1.20 modernc.org/libc modernc.org/libc/errno