Repository navigation
build(deps): bump github.com/prometheus/procfs from 0.21.1 to 0.23.0 - #2143
dependabot[bot] wants to merge 1 commit into
Conversation
Bumps [github.com/prometheus/procfs](https://github.com/prometheus/procfs) from 0.21.1 to 0.23.0. - [Release notes](https://github.com/prometheus/procfs/releases) - [Commits](prometheus/procfs@v0.21.1...v0.23.0) --- updated-dependencies: - dependency-name: github.com/prometheus/procfs dependency-version: 0.23.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
| // 8. Remove temporary breakpoints | ||
| if err := state.removeTempBreakpoints(pid); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| // 9. Back up PSW by 2 bytes (to point at original instruction, not SVC 144) | ||
| // Use direct PSW write like ztrace does, not full register set | ||
| hitAddr := regs.Psw.Addr | ||
| if state.isTempBreakpoint(hitAddr - 2) { |
There was a problem hiding this comment.
🔴 Single-step skips the next instruction
After a breakpoint stops the tracee, PtraceSingleStep restores it before checking isTempBreakpoint. That check always fails, leaving the program counter past the restored instruction. Continuing the tracee skips that instruction.
Learn more
A temporary breakpoint replaces the first two bytes of an instruction with SVC 144. When the traced process stops on that breakpoint, its program counter points two bytes past it. removeTempBreakpoints clears each breakpoint's active flag before the later isTempBreakpoint call. The check therefore cannot match the hit address, and the code never restores the program counter. The next continue skips the original instruction.
Example: A tracee stops at a breakpoint installed at address 0x3000, leaving its counter at 0x3002. The breakpoint is restored, then the check fails; continuing starts at 0x3002 rather than executing the instruction at 0x3000.
Recommended fix: Capture whether hitAddr-2 matches an active temporary breakpoint before calling removeTempBreakpoints, then use that saved result to restore the PSW. Also handle unexpected stops explicitly rather than silently treating them as successful steps.
Was this helpful? React with 👍 or 👎 to provide feedback.
| // Pack PSW for 31-bit targets (current z/OS) | ||
| // Upper 32 bits = mask, lower 32 bits = address | ||
| gprBlock.Wpsw = 1 // Mark PSW as modified | ||
| // Write PSW in old format (8 bytes at offset 144) | ||
| // Word 1 (mask) at bytes 0-3, Word 2 (addr) at bytes 4-7 | ||
| pswMask := uint32(regs.Psw.Mask) | ||
| pswAddr := uint32(regs.Psw.Addr) | ||
| gprBlock.Psw[0] = byte(pswMask >> 24) | ||
| gprBlock.Psw[1] = byte(pswMask >> 16) | ||
| gprBlock.Psw[2] = byte(pswMask >> 8) | ||
| gprBlock.Psw[3] = byte(pswMask) | ||
| gprBlock.Psw[4] = byte(pswAddr >> 24) | ||
| gprBlock.Psw[5] = byte(pswAddr >> 16) | ||
| gprBlock.Psw[6] = byte(pswAddr >> 8) | ||
| gprBlock.Psw[7] = byte(pswAddr) |
There was a problem hiding this comment.
🔴 Register round-trip corrupts execution state
After PtraceGetRegs, PtraceSetRegs takes the low 32 bits of regs.Psw.Mask, discarding its status bits. PtraceGetRegs placed those bits in the upper 32 bits. A register round-trip writes a different PSW to the tracee.
Learn more
The PSW contains execution flags and the instruction address. PtraceGetRegs constructs regs.Psw.Mask by shifting the ESA/390 status word left by 32 bits and placing the addressing-mode flag in the low word. Here, converting the mask directly to uint32 keeps only the addressing-mode flag and loses the status word. The address word also needs the addressing-mode bit restored when converting the normalized 64-bit address back to ESA/390 format. Writing these bytes back changes execution state even if the caller never edited the registers.
Example: Reading a PSW with a nonzero status word and then calling PtraceSetRegs on the unmodified result stores a status word of zero instead of the original value.
Recommended fix: Convert regs.Psw.Mask and regs.Psw.Addr back to the ESA/390 PSW representation as the inverse of PtraceGetRegs, retaining the status and addressing-mode bits. Add a read/write round-trip test for a nonzero mask and 31-bit addressing mode.
Was this helpful? React with 👍 or 👎 to provide feedback.
| if off := int(-uintptr(unsafe.Pointer(&buf[0])) & 7); off > 0 && off < len(buf) { | ||
| n, err = getdents(fd, buf[off:]) | ||
| if n > 0 { | ||
| copy(buf, buf[off:off+n]) | ||
| } | ||
| return n, err | ||
| } | ||
| } | ||
| return getdents(fd, buf) |
There was a problem hiding this comment.
🟡 Small directory reads fail on misaligned buffers
With a misaligned 24-byte buffer, Getdents passes fewer than 24 bytes to the kernel. A Linux directory entry needs at least 24 bytes, so this formerly valid read returns EINVAL.
Learn more
Linux getdents64 needs enough space for at least one linux_dirent64 record; even . or .. takes 24 bytes. The new alignment handling advances into the caller's buffer and passes only the remaining bytes to getdents. For a 24-byte buffer whose first byte is not eight-byte aligned, the syscall sees at most 23 bytes and returns EINVAL. The previous wrapper passed all 24 bytes. The same issue affects other small buffers whenever the alignment offset leaves less than one entry.
Example: A caller allocates make([]byte, 25) and passes buf[1:25] when that slice begins one byte after an eight-byte boundary. The wrapper sends buf[7:] to the kernel with only 17 bytes; the 24-byte . entry cannot fit.
Recommended fix: For an unaligned buffer too short after alignment, use a temporary aligned buffer of the caller's original length and copy the result back. Preserve the caller's buffer-length contract for all other unaligned buffers as well.
Was this helpful? React with 👍 or 👎 to provide feedback.
Bumps github.com/prometheus/procfs from 0.21.1 to 0.23.0.
Release notes
Sourced from github.com/prometheus/procfs's releases.
... (truncated)
Commits
98e16a1netstat: check the scanner result and error (#868)5704a06sysfs: read NVMe namespace nuse on demand (#889)b9a3099test: split proc stat limit coverage by architecture (#833)1b0d8afReturn errors instead of panicking on short lines in meminfo, ipvs and cpufre...8eaeae9sysfs: parse NVMe diag counters (controller, namespace, multipath head) (#887)9a862aecpuinfo: parse arm64 CPU implementer, variant, and part (#882)eecec32Fix WSL2 mountinfo parsing (#874)43ec1eesysfs: don't hang on cpufreq files that return EAGAIN (#879)ef2dd1dsysfs: handle cpufreq files with <unknown> values (#866)22a23e9sysfs: fix NVMe namespace size and parse multipath path namespaces (#885)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebasewill rebase this PR@dependabot recreatewill recreate this PR, overwriting any edits that have been made to it@dependabot show <dependency name> ignore conditionswill show all of the ignore conditions of the specified dependency@dependabot ignore this major versionwill close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor versionwill close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependencywill close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)