The NetBSD Project

CVS log for src/sys/kern/sys_process_lwpstatus.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / kern

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.4.10.2: download - view: text, markup, annotated - select for diffs
Wed Nov 4 23:27:50 2026 UTC (11 days, 14 hours ago) by perseant
Branches: perseant-exfatfs
Diff to: previous 1.4.10.1: preferred, colored; branchpoint 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4.10.1: +206 -46 lines
Sync with HEAD

Revision 1.4.4.2: download - view: text, markup, annotated - select for diffs
Sat Oct 24 10:18:40 2026 UTC (3 weeks, 2 days ago) by martin
Branches: netbsd-10
Diff to: previous 1.4.4.1: preferred, colored; branchpoint 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4.4.1: +206 -46 lines
Pull up following revision(s) (requested by riastradh in ticket #1385):

	sys/kern/sys_process_lwpstatus.c: revision 1.6
	sys/kern/sys_process_lwpstatus.c: revision 1.7
	sys/kern/sys_process_lwpstatus.c: revision 1.8
	sys/arch/x86/include/dbregs.h: revision 1.9
	sys/kern/sys_process_lwpstatus.c: revision 1.9
	sys/sys/ptrace.h: revision 1.78
	sys/arch/x86/x86/dbregs.c: revision 1.16
	sys/kern/sys_process_lwpstatus.c: revision 1.10
	sys/arch/i386/i386/process_machdep.c: revision 1.98
	sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.10
	sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.11
	sys/arch/amd64/amd64/process_machdep.c: revision 1.51

ptrace/procfs: Take lwp lock around process_read/write_(fp)regs(32).

And verify that the lwp is in LSSTOP state before trying to read.

Otherwise, we might catch an lwp while it's still running on the CPU,
with all FPU state active, making the result unstable and tripping
assertions on some architectures.

PR port-amd64/60556: panic in process_read_fpregs_xmm


proc_regio: Clarify control flow and sprinkle comments.

Use `if (error) goto out' instead of `if (error == 0) error = ...' to
make the error case non-linear and indented, and the success case a
straight line of logic.

No functional change intended.

PR port-amd64/60556: panic in process_read_fpregs_xmm


x86: Pull dbregs buffer allocation out from under lwp_lock.

Sprinkle assertions and notes about locking rules while here.

PR kern/60595: System lockup using gdb(1) on kernel with DEBUG+LOCKDEBUG

This fixes a bug that was revealed by lifting up rock while fixing:
PR kern/60556: panic in process_read_fpregs_xmm


netbsd32_ptrace: Fix locking around ptrace register access.
PR kern/60658: netbsd32_process_read_dbregs() needs the same fix as
native amd64 process_read_dbregs()


ptrace(2): Tidy register access: no sketchy function pointer casts.

Followups for:
PR port-amd64/60556: panic in process_read_fpregs_xmm
PR kern/60595: System lockup using gdb(1) on kernel with
DEBUG+LOCKDEBUG
PR kern/60658: netbsd32_process_read_dbregs() needs the same fix as
native amd64 process_read_dbregs()


ptrace(2): Fix compat32 register set types in previous.

Not always `struct reg32' or `struct fpreg32', notably on arm32 --
make sure to say `process_reg32'/`process_fpreg32'/`process_dbreg32'.
(Here `compat32' means oabi?)

Followups for:
PR port-amd64/60556: panic in process_read_fpregs_xmm
PR kern/60595: System lockup using gdb(1) on kernel with
DEBUG+LOCKDEBUG
PR kern/60658: netbsd32_process_read_dbregs() needs the same fix as
native amd64 process_read_dbregs()


netbsd32_ptrace: Need to pre-allocate dbregs before read/write.

Followup for:
PR kern/60658: netbsd32_process_read_dbregs() needs the same fix as
native amd64 process_read_dbregs()

Revision 1.5.2.1: download - view: text, markup, annotated - select for diffs
Sat Oct 24 10:14:07 2026 UTC (3 weeks, 2 days ago) by martin
Branches: netbsd-11
CVS tags: netbsd-11-1-RELEASE
Diff to: previous 1.5: preferred, colored; next MAIN 1.6: preferred, colored
Changes since revision 1.5: +206 -46 lines
Pull up following revision(s) (requested by riastradh in ticket #540):

	sys/kern/sys_process_lwpstatus.c: revision 1.6
	sys/kern/sys_process_lwpstatus.c: revision 1.7
	sys/kern/sys_process_lwpstatus.c: revision 1.8
	sys/arch/x86/include/dbregs.h: revision 1.9
	sys/kern/sys_process_lwpstatus.c: revision 1.9
	sys/sys/ptrace.h: revision 1.78
	sys/arch/x86/x86/dbregs.c: revision 1.16
	sys/kern/sys_process_lwpstatus.c: revision 1.10
	sys/arch/i386/i386/process_machdep.c: revision 1.98
	sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.10
	sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.11
	sys/arch/amd64/amd64/process_machdep.c: revision 1.51

ptrace/procfs: Take lwp lock around process_read/write_(fp)regs(32).

And verify that the lwp is in LSSTOP state before trying to read.

Otherwise, we might catch an lwp while it's still running on the CPU,
with all FPU state active, making the result unstable and tripping
assertions on some architectures.

PR port-amd64/60556: panic in process_read_fpregs_xmm


proc_regio: Clarify control flow and sprinkle comments.

Use `if (error) goto out' instead of `if (error == 0) error = ...' to
make the error case non-linear and indented, and the success case a
straight line of logic.

No functional change intended.

PR port-amd64/60556: panic in process_read_fpregs_xmm


x86: Pull dbregs buffer allocation out from under lwp_lock.

Sprinkle assertions and notes about locking rules while here.

PR kern/60595: System lockup using gdb(1) on kernel with DEBUG+LOCKDEBUG

This fixes a bug that was revealed by lifting up rock while fixing:
PR kern/60556: panic in process_read_fpregs_xmm


netbsd32_ptrace: Fix locking around ptrace register access.
PR kern/60658: netbsd32_process_read_dbregs() needs the same fix as
native amd64 process_read_dbregs()


ptrace(2): Tidy register access: no sketchy function pointer casts.

Followups for:
PR port-amd64/60556: panic in process_read_fpregs_xmm
PR kern/60595: System lockup using gdb(1) on kernel with
DEBUG+LOCKDEBUG
PR kern/60658: netbsd32_process_read_dbregs() needs the same fix as
native amd64 process_read_dbregs()


ptrace(2): Fix compat32 register set types in previous.

Not always `struct reg32' or `struct fpreg32', notably on arm32 --
make sure to say `process_reg32'/`process_fpreg32'/`process_dbreg32'.
(Here `compat32' means oabi?)

Followups for:
PR port-amd64/60556: panic in process_read_fpregs_xmm
PR kern/60595: System lockup using gdb(1) on kernel with
DEBUG+LOCKDEBUG
PR kern/60658: netbsd32_process_read_dbregs() needs the same fix as
native amd64 process_read_dbregs()


netbsd32_ptrace: Need to pre-allocate dbregs before read/write.

Followup for:
PR kern/60658: netbsd32_process_read_dbregs() needs the same fix as
native amd64 process_read_dbregs()

Revision 1.10: download - view: text, markup, annotated - select for diffs
Sat Aug 29 12:46:56 2026 UTC (2 months, 2 weeks ago) by riastradh
Branches: MAIN
CVS tags: perseant-exfatfs-base-20261102, HEAD
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +5 -5 lines
ptrace(2): Fix compat32 register set types in previous.

Not always `struct reg32' or `struct fpreg32', notably on arm32 --
make sure to say `process_reg32'/`process_fpreg32'/`process_dbreg32'.
(Here `compat32' means oabi?)

Followups for:

PR port-amd64/60556: panic in process_read_fpregs_xmm

PR kern/60595: System lockup using gdb(1) on kernel with
DEBUG+LOCKDEBUG

PR kern/60658: netbsd32_process_read_dbregs() needs the same fix as
native amd64 process_read_dbregs()

Revision 1.9: download - view: text, markup, annotated - select for diffs
Fri Aug 28 16:15:15 2026 UTC (2 months, 2 weeks ago) by riastradh
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +158 -46 lines
ptrace(2): Tidy register access: no sketchy function pointer casts.

Followups for:

PR port-amd64/60556: panic in process_read_fpregs_xmm

PR kern/60595: System lockup using gdb(1) on kernel with
DEBUG+LOCKDEBUG

PR kern/60658: netbsd32_process_read_dbregs() needs the same fix as
native amd64 process_read_dbregs()

Revision 1.8: download - view: text, markup, annotated - select for diffs
Thu Aug 20 16:20:54 2026 UTC (2 months, 3 weeks ago) by riastradh
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +5 -2 lines
x86: Pull dbregs buffer allocation out from under lwp_lock.

Sprinkle assertions and notes about locking rules while here.

PR kern/60595: System lockup using gdb(1) on kernel with DEBUG+LOCKDEBUG

This fixes a bug that was revealed by lifting up rock while fixing:

PR kern/60556: panic in process_read_fpregs_xmm

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sat Aug 8 12:38:32 2026 UTC (3 months, 1 week ago) by riastradh
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +44 -6 lines
proc_regio: Clarify control flow and sprinkle comments.

Use `if (error) goto out' instead of `if (error == 0) error = ...' to
make the error case non-linear and indented, and the success case a
straight line of logic.

No functional change intended.

PR port-amd64/60556: panic in process_read_fpregs_xmm

Revision 1.6: download - view: text, markup, annotated - select for diffs
Sat Aug 8 00:45:52 2026 UTC (3 months, 1 week ago) by riastradh
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +10 -3 lines
ptrace/procfs: Take lwp lock around process_read/write_(fp)regs(32).

And verify that the lwp is in LSSTOP state before trying to read.
Otherwise, we might catch an lwp while it's still running on the CPU,
with all FPU state active, making the result unstable and tripping
assertions on some architectures.

PR port-amd64/60556: panic in process_read_fpregs_xmm

Revision 1.4.10.1: download - view: text, markup, annotated - select for diffs
Sat Aug 2 05:57:42 2025 UTC (15 months, 2 weeks ago) by perseant
Branches: perseant-exfatfs
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +8 -8 lines
Sync with HEAD

Revision 1.4.4.1: download - view: text, markup, annotated - select for diffs
Sun Jan 12 12:02:46 2025 UTC (22 months ago) by martin
Branches: netbsd-10
CVS tags: netbsd-10-2-RELEASE
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +8 -8 lines
Pull up following revision(s) (requested by hgutch in ticket #1039):

	sys/kern/sys_process_lwpstatus.c: revision 1.5
	sys/sys/ptrace.h: revision 1.77
	sys/kern/sys_ptrace_common.c: revision 1.96

PR/58983: Harold Gutch: Fix INSTALL_FLOPPY on i386. Make the register handling
code conditional on if PTRACE is enabled in the kernel.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sat Jan 11 19:42:04 2025 UTC (22 months ago) by christos
Branches: MAIN
CVS tags: perseant-exfatfs-base-20250801, netbsd-11-base, netbsd-11-0-RELEASE, netbsd-11-0-RC7, netbsd-11-0-RC6, netbsd-11-0-RC5, netbsd-11-0-RC4, netbsd-11-0-RC3, netbsd-11-0-RC2, netbsd-11-0-RC1
Branch point for: netbsd-11
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +8 -8 lines
PR/58983: Harold Gutch: Fix INSTALL_FLOPPY on i386. Make the register handling
code conditional on if PTRACE is enabled in the kernel.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Sun Jul 10 17:47:58 2022 UTC (4 years, 4 months ago) by riastradh
Branches: MAIN
CVS tags: thorpej-ifq-base, thorpej-ifq, thorpej-altq-separation-base, thorpej-altq-separation, perseant-exfatfs-base-20240630, perseant-exfatfs-base, netbsd-10-base, netbsd-10-1-RELEASE, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, bouyer-sunxi-drm-base, bouyer-sunxi-drm
Branch point for: perseant-exfatfs, netbsd-10
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +3 -6 lines
ptrace(PT_LWPSTATUS): Fix lid=0 case.

Make ptrace_read_lwpstatus always overwrite the whole struct
ptrace_lwpstatus so the caller doesn't have to make sure pl_lwpid is
initialized correctly -- ptrace_lwpstatus was missing that
reinitialization after ptrace_update_lwp, but it's less work for all
the callers if we just make the assertion an assignment instead.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Tue Oct 20 22:31:20 2020 UTC (6 years ago) by rin
Branches: MAIN
CVS tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-futex, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +3 -2 lines
Include missing <sys/proc.h>. Hopefully fix build for everyone except vax,
for which process_machep.c is missing.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Tue Oct 20 20:28:55 2020 UTC (6 years ago) by christos
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +217 -2 lines
Basic register read/write functionality and lwp setting are always provided
by the kernel because they are needed by multiple things
(ptrace/procfs/coredump), so move them to sys_process_lwpstatus (this file
should be renamed to sys_process_common.c?)

Revision 1.1.6.2: download - view: text, markup, annotated - select for diffs
Wed Apr 8 14:08:52 2020 UTC (6 years, 7 months ago) by martin
Branches: phil-wifi
Diff to: previous 1.1.6.1: preferred, colored; branchpoint 1.1: preferred, colored; next MAIN 1.2: preferred, colored
Changes since revision 1.1.6.1: +69 -0 lines
Merge changes from current as of 20200406

Revision 1.1.6.1
Sat Jan 4 03:46:19 2020 UTC (6 years, 10 months ago) by martin
Branches: phil-wifi
FILE REMOVED
Changes since revision 1.1: +0 -69 lines
file sys_process_lwpstatus.c was added on branch phil-wifi on 2020-04-08 14:08:52 +0000

Revision 1.1: download - view: text, markup, annotated - select for diffs
Sat Jan 4 03:46:19 2020 UTC (6 years, 10 months ago) by kamil
Branches: MAIN
CVS tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, is-mlppp-base, is-mlppp, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh, ad-namecache-base3, ad-namecache-base2, ad-namecache-base1, ad-namecache-base, ad-namecache
Branch point for: phil-wifi
Rename sys_ptrace_lwpstatus.c to sys_process_lwpstatus.c

Keep the names of functions internally as ptrace intact as this code
is shared with core_elf32.c that already reaches ptrace(2) specifc symbols.

No functional change intended.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>