diff --git a/.codespellignore b/.codespellignore new file mode 100644 index 00000000..363ef0cc --- /dev/null +++ b/.codespellignore @@ -0,0 +1,4 @@ +ba +fo +opne +optimyze diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..f7b2940d --- /dev/null +++ b/.codespellrc @@ -0,0 +1,10 @@ +# https://github.com/codespell-project/codespell +[codespell] +builtin = clear,rare,informal +check-filenames = +check-hidden = +ignore-words = .codespellignore +interactive = 1 +skip = .git,AUTHORS.md,go.mod,go.sum,LICENSES,zydis +uri-ignore-words-list = * +write = diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..61f1eeda --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,16 @@ +name: codespell +on: + push: + branches: + - main + pull_request: +jobs: + codespell: + runs-on: ubuntu-latest + steps: + - name: Install codespell + run: sudo apt-get install codespell + - name: Checkout Repo + uses: actions/checkout@v4 + - name: Codespell + run: make codespell diff --git a/.gitignore b/.gitignore index f1bff2d6..4509bad0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,3 @@ /go opentelemetry-ebpf-profiler ci-kernels - diff --git a/Makefile b/Makefile index 3833a369..0074aea0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .PHONY: all all-common binary clean ebpf generate test test-deps protobuf docker-image agent legal \ - integration-test-binaries lint linter-version + integration-test-binaries codespell lint linter-version SHELL := /usr/bin/env bash @@ -114,3 +114,7 @@ legal: @echo "Dependencies license summary (from deps.profiling-agent.csv):" @echo " Count License" @tail -n '+2' deps.profiling-agent.csv | cut -d',' -f5 | sort | uniq -c | sort -k1rn + + +codespell: + @codespell diff --git a/doc/gopclntab.md b/doc/gopclntab.md index f16958b2..834db4a1 100644 --- a/doc/gopclntab.md +++ b/doc/gopclntab.md @@ -398,7 +398,7 @@ struct runtime_inlinedCall { This section provides some examples on what structures need to be traversed to locate various function information. This omits details like relative offsets -that depend on data from the header or moduledata to keep complexity managable. +that depend on data from the header or moduledata to keep complexity manageable. ### Locating `runtime._func` for a PC diff --git a/doc/symb-proto/README.md b/doc/symb-proto/README.md index edd6a9d5..cbc1ec09 100644 --- a/doc/symb-proto/README.md +++ b/doc/symb-proto/README.md @@ -49,7 +49,7 @@ frame symbol information are uploaded via `/api/symbols-ranges`. The "return pads" files that contain leaf frame symbol information are uploaded via `/api/symbols-returnpads`. Symbfiles may be split and uploaded in multiple chunks (in separate HTTP requests) for improved load balancing in the presence -of muliple symbolizer services. +of multiple symbolizer services. ### File metadata (request) diff --git a/interpreter/dotnet/dotnet.go b/interpreter/dotnet/dotnet.go index 335c1129..6b7e24d4 100644 --- a/interpreter/dotnet/dotnet.go +++ b/interpreter/dotnet/dotnet.go @@ -50,7 +50,7 @@ package dotnet // with its metadata maps. insert this into ebpf pid_page mappings. // 2. just use standard frame pointer unwinding in ebpf, and also locate the JIT function // code header to get access to debug data and method descriptors -// 3. in the host agent, the debug data and method descriptors are resolved and mappped to +// 3. in the host agent, the debug data and method descriptors are resolved and mapped to // PE (.dll) FileID, Method index, and the IL code offset (JIT code), or the PE FileID // and Relative Virtual Address (RVA) (Ready to Run code) // 4. symbolizer can then map the above data to source code file and line @@ -128,7 +128,7 @@ var ( // regex for the core language runtime dotnetRegex = regexp.MustCompile(`/(\d+)\.(\d+).(\d+)/libcoreclr.so$`) - // The FileID used for Dotnet stub frames. Same FileID as in other interpeters. + // The FileID used for Dotnet stub frames. Same FileID as in other interpreters. stubsFileID = libpf.NewFileID(0x578b, 0x1d) // compiler check to make sure the needed interfaces are satisfied diff --git a/interpreter/dotnet/method.go b/interpreter/dotnet/method.go index 8961359c..19dd0f2e 100644 --- a/interpreter/dotnet/method.go +++ b/interpreter/dotnet/method.go @@ -95,7 +95,7 @@ func (m *dotnetMethod) mapPCOffsetToILOffset(pcOffset uint32, findCall bool) uin lastCallILOffset = ilOffset } - // NOTE: _DEBUG builds could have a 0xA nibble to indentify row change. + // NOTE: _DEBUG builds could have a 0xA nibble to identify row change. log.Debugf(" %3d, native %3d -> IL %#03x, sourceFlags %#x", i, nativeOffset, ilOffset, sourceFlags) } @@ -116,7 +116,7 @@ func (m *dotnetMethod) dumpBounds() { nativeOffset += nr.Uint32() ilOffset := uint32(int32(nr.Uint32()) + mappingTypeMaxValue) sourceFlags := nr.Uint32() - // NOTE: _DEBUG builds could have a 0xA nibble to indentify row change. + // NOTE: _DEBUG builds could have a 0xA nibble to identify row change. log.Debugf(" %3d, native %3d -> IL %#03x, sourceFlags %#x", i, nativeOffset, ilOffset, sourceFlags) diff --git a/interpreter/dotnet/pe.go b/interpreter/dotnet/pe.go index 47cc593d..e52b91dd 100644 --- a/interpreter/dotnet/pe.go +++ b/interpreter/dotnet/pe.go @@ -165,7 +165,7 @@ type StreamHeader struct { Size uint32 } -// table* variables are ECMA-335 II.22 defined Metdata table numbers +// table* variables are ECMA-335 II.22 defined Metadata table numbers const ( tableModule = 0x00 tableTypeRef = 0x01 diff --git a/interpreter/hotspot/stubs.go b/interpreter/hotspot/stubs.go index 451a99ec..183454b6 100644 --- a/interpreter/hotspot/stubs.go +++ b/interpreter/hotspot/stubs.go @@ -87,7 +87,7 @@ func findStubBounds(vmd *hotspotVMData, bias libpf.Address, for i := 0; i < len(stubs); i++ { cur := &stubs[i] - // Some stubs re-use the code from another stub. Skip elements until + // Some stubs reuse the code from another stub. Skip elements until // we detected the next stub that doesn't occupy the same address. for i < len(stubs) { if i != len(stubs)-1 { diff --git a/interpreter/php/decode_amd64.c b/interpreter/php/decode_amd64.c index 242131e3..0ff3dd98 100644 --- a/interpreter/php/decode_amd64.c +++ b/interpreter/php/decode_amd64.c @@ -69,7 +69,7 @@ int retrieveJITBufferPtr(const uint8_t * const code, const size_t codesize, // which allows us to recover accurate PC data for JIT code int retrieveExecuteExJumpLabelAddress(const uint8_t * const code, const size_t codesize, const uint64_t rip_base, uint64_t * const out) { - // The raison d'etre for this function is described in the php8 unwinding doc, + // The purpose of this function is described in the php8 unwinding doc, // in particular in the "disassembling execute_ex" section. ZydisDecoder decoder; ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_STACK_WIDTH_64); diff --git a/libpf/basehash/hash128_test.go b/libpf/basehash/hash128_test.go index 6fa5f633..6ad934d1 100644 --- a/libpf/basehash/hash128_test.go +++ b/libpf/basehash/hash128_test.go @@ -136,23 +136,23 @@ func TestHash128Format(t *testing.T) { 0xCC, 0xDD, 0xEE, 0xFF}) tests := map[string]struct { - formater string - expected string + formatter string + expected string }{ - "v": {formater: "%v", expected: "{4822678189205111 9843086184167632639}"}, - "d": {formater: "%d", expected: "{4822678189205111 9843086184167632639}"}, - "x": {formater: "%x", expected: "112233445566778899aabbccddeeff"}, - "X": {formater: "%X", expected: "112233445566778899AABBCCDDEEFF"}, - "#v": {formater: "%#v", expected: "0x112233445566778899aabbccddeeff"}, - "#x": {formater: "%#x", expected: "0x112233445566778899aabbccddeeff"}, - "#X": {formater: "%#X", expected: "0x112233445566778899AABBCCDDEEFF"}, + "v": {formatter: "%v", expected: "{4822678189205111 9843086184167632639}"}, + "d": {formatter: "%d", expected: "{4822678189205111 9843086184167632639}"}, + "x": {formatter: "%x", expected: "112233445566778899aabbccddeeff"}, + "X": {formatter: "%X", expected: "112233445566778899AABBCCDDEEFF"}, + "#v": {formatter: "%#v", expected: "0x112233445566778899aabbccddeeff"}, + "#x": {formatter: "%#x", expected: "0x112233445566778899aabbccddeeff"}, + "#X": {formatter: "%#X", expected: "0x112233445566778899AABBCCDDEEFF"}, } for name, test := range tests { name := name test := test t.Run(name, func(t *testing.T) { - output := fmt.Sprintf(test.formater, h) + output := fmt.Sprintf(test.formatter, h) assert.Equal(t, test.expected, output) }) } diff --git a/libpf/pfelf/pfelf.go b/libpf/pfelf/pfelf.go index b3c4bb16..56999b92 100644 --- a/libpf/pfelf/pfelf.go +++ b/libpf/pfelf/pfelf.go @@ -25,7 +25,7 @@ import ( // SafeOpenELF opens the given ELF file in a safely way in that // it recovers from panics inside elf.Open(). -// Under cirumstances we see fatal errors from inside the runtime, which +// Under circumstances we see fatal errors from inside the runtime, which // are not recoverable, e.g. "fatal error: runtime: out of memory". func SafeOpenELF(name string) (elfFile *elf.File, err error) { defer func() { diff --git a/maccess/maccess_arm64.go b/maccess/maccess_arm64.go index 903a2519..32e3066a 100644 --- a/maccess/maccess_arm64.go +++ b/maccess/maccess_arm64.go @@ -114,7 +114,7 @@ func CopyFromUserNoFaultIsPatched(codeblob []byte, _, _ uint64) (bool, error) { // 0 otherwise // - C // 1 if CMP results in carry condition, like unsigned overflow - // 0 otherweise + // 0 otherwise expectedInstructionTracker ^= stepB continue } diff --git a/periodiccaller/periodiccaller_test.go b/periodiccaller/periodiccaller_test.go index 1fa7e8d1..7cc1b377 100644 --- a/periodiccaller/periodiccaller_test.go +++ b/periodiccaller/periodiccaller_test.go @@ -55,7 +55,7 @@ func isSelfOrRuntime(t *testing.T, stack *[32]uintptr, self string) bool { if funcName == self { return true } - // Go runtime specifc filters + // Go runtime specific filters if !strings.HasPrefix(funcName, "runtime.") && !strings.HasPrefix(funcName, "runtime/") && !strings.HasPrefix(funcName, "testing.") && diff --git a/reporter/config.go b/reporter/config.go index 8bb08c33..550fb722 100644 --- a/reporter/config.go +++ b/reporter/config.go @@ -16,7 +16,7 @@ type Config struct { // Name defines the name of the agent. Name string - // Version defines the vesion of the agent. + // Version defines the version of the agent. Version string // CollAgentAddr defines the destination of the backend connection. diff --git a/support/ebpf/native_stack_trace.ebpf.c b/support/ebpf/native_stack_trace.ebpf.c index ac5f8add..8981f770 100644 --- a/support/ebpf/native_stack_trace.ebpf.c +++ b/support/ebpf/native_stack_trace.ebpf.c @@ -630,7 +630,7 @@ static inline ErrorCode copy_state_regs(UnwindState *state, // https://github.com/torvalds/linux/blob/2ef5971ff3/arch/x86/entry/entry_64.S#L847 state->return_address = interrupted_kernelmode && regs->orig_ax != -1; #elif defined(__aarch64__) - // For backwards compatability aarch64 can run 32-bit code. + // For backwards compatibility aarch64 can run 32-bit code. // Check if the process is running in this 32-bit compat mod. if (regs->pstate & PSR_MODE32_BIT) { return ERR_NATIVE_AARCH64_32BIT_COMPAT_MODE; diff --git a/support/ebpf/php_tracer.ebpf.c b/support/ebpf/php_tracer.ebpf.c index 3d5d5287..677cd185 100644 --- a/support/ebpf/php_tracer.ebpf.c +++ b/support/ebpf/php_tracer.ebpf.c @@ -87,7 +87,7 @@ int process_php_frame(PerCPURecord *record, PHPProcInfo *phpinfo, bool is_jitted } // Get execute_data->This.type_info. This reads into the `type_info` argument - // so we can re-use it in walk_php_stack + // so we can reuse it in walk_php_stack if (bpf_probe_read_user(type_info, sizeof(u32), execute_data + phpinfo->zend_execute_data_this_type_info)) { DEBUG_PRINT("Failed to read execute_data->This.type_info (0x%lx)", diff --git a/support/ebpf/tracemgmt.h b/support/ebpf/tracemgmt.h index 1eb945e8..d2c58d53 100644 --- a/support/ebpf/tracemgmt.h +++ b/support/ebpf/tracemgmt.h @@ -127,7 +127,7 @@ bool pid_event_ratelimit(u32 pid, int ratelimit_action) { // Update the map entry. Technically this is not SMP safe, but doing // an atomic update would require EBPF atomics. At worst we send an - // extra sync event and the likelyhood for this race is very low, so + // extra sync event and the likelihood for this race is very low, so // we can live with this. int err = bpf_map_update_elem(&reported_pids, &pid, &token, BPF_ANY); if (err != 0) { @@ -314,7 +314,7 @@ static bool is_kernel_address(u64 addr) { // resolve_unwind_mapping decodes the current PC's mapping and prepares unwinding information. // The state text_section_id and text_section_offset are updated accordingly. The unwinding program -// index that should be used is writen to the given `unwinder` pointer. +// index that should be used is written to the given `unwinder` pointer. static ErrorCode resolve_unwind_mapping(PerCPURecord *record, int* unwinder) { UnwindState *state = &record->state; pid_t pid = record->trace.pid; diff --git a/support/ebpf/types.h b/support/ebpf/types.h index 1022df1b..3e2b0bc7 100644 --- a/support/ebpf/types.h +++ b/support/ebpf/types.h @@ -614,7 +614,7 @@ typedef struct RubyUnwindState { typedef struct DotnetUnwindScratchSpace { // Buffer to read nibble map to locate code start. One map entry allows seeking backwards // 32*8 = 256 bytes of code. This defines the maximum size for a JITted function we - // can reconize: 256 bytes/element * 128 elements = 32kB function size. + // can recognize: 256 bytes/element * 128 elements = 32kB function size. u32 map[128]; // Extra space to read to map fixed amount of bytes, but to dynamic offset. u32 extra[128]; diff --git a/tools/coredump/testsources/node/async.js b/tools/coredump/testsources/node/async.js index 18a70295..b59e70cb 100644 --- a/tools/coredump/testsources/node/async.js +++ b/tools/coredump/testsources/node/async.js @@ -19,7 +19,7 @@ const notifyWaiter = (id) => {     setTimeout(() => {       console.log(`Order for customer at table #${id} processed....`);       resolve({ customerId: id, customerOrder: "Pizza" }); -      // reject(new Error("Error occured with waiter")); +      // reject(new Error("Error occurred with waiter"));     }, 1);   }); }