Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
github.com/linxGnu/go-adder
Thread-safe, high performance, contention-aware LongAdder
and DoubleAdder
for Go, inspired by OpenJDK9.
Beside JDK-based LongAdder
and DoubleAdder
, library includes other adders for various use.
package main
import (
"fmt"
"time"
ga "github.com/linxGnu/go-adder"
)
func main() {
adder := ga.NewLongAdder(ga.JDKAdderType)
for i := 0; i < 100; i++ {
go func() {
adder.Add(123)
}()
}
time.Sleep(3 * time.Second)
// get total added value
fmt.Println(adder.Sum())
}
LongAdder
with simple strategy of preallocating atomic cell and select random cell for update.adder := ga.NewLongAdder(ga.RandomCellAdderType)
LongAdder
based on atomic variable. All routines share this variable.adder := ga.NewLongAdder(ga.AtomicAdderType)
LongAdder
based on mutex. All routines share same value and mutex.adder := ga.NewLongAdder(ga.MutexAdderType)
goos: linux
goarch: amd64
BenchmarkAtomicF64AdderSingleRoutine-8 100 11558784 ns/op 0 B/op 0 allocs/op
BenchmarkJDKF64AdderSingleRoutine-8 100 12663869 ns/op 0 B/op 0 allocs/op
BenchmarkAtomicF64AdderMultiRoutine-8 3 414693263 ns/op 6672 B/op 18 allocs/op
BenchmarkJDKF64AdderMultiRoutine-8 30 39951114 ns/op 1178 B/op 4 allocs/op
BenchmarkAtomicF64AdderMultiRoutineMix-8 3 410603215 ns/op 16 B/op 1 allocs/op
BenchmarkJDKF64AdderMultiRoutineMix-8 30 49619434 ns/op 56 B/op 1 allocs/op
BenchmarkMutexAdderSingleRoutine-40 30 42931025 ns/op 0 B/op 0 allocs/op
BenchmarkAtomicAdderSingleRoutine-40 100 10022343 ns/op 0 B/op 0 allocs/op
BenchmarkRandomCellAdderSingleRoutine-40 50 38920149 ns/op 108 B/op 0 allocs/op
BenchmarkJDKAdderSingleRoutine-40 100 14030302 ns/op 0 B/op 0 allocs/op
BenchmarkMutexAdderMultiRoutine-40 2 576540605 ns/op 1456 B/op 16 allocs/op
BenchmarkAtomicAdderMultiRoutine-40 20 88861041 ns/op 419 B/op 2 allocs/op
BenchmarkRandomCellAdderMultiRoutine-40 30 45493866 ns/op 239 B/op 3 allocs/op
BenchmarkJDKAdderMultiRoutine-40 50 25724032 ns/op 140 B/op 2 allocs/op
BenchmarkMutexAdderMultiRoutineMix-40 2 581924480 ns/op 1120 B/op 12 allocs/op
BenchmarkAtomicAdderMultiRoutineMix-40 20 93733789 ns/op 16 B/op 1 allocs/op
BenchmarkRandomCellAdderMultiRoutineMix-40 20 62700287 ns/op 331 B/op 4 allocs/op
BenchmarkJDKAdderMultiRoutineMix-40 30 45089173 ns/op 230 B/op 3 allocs/op
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.