<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/kern/sys_process.c, branch releng/13.4</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>ptrace: Clear TDB_BORN during PT_DETACH.</title>
<updated>2023-09-06T21:56:09+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2023-06-07T19:26:57+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=21ccba43f511cc4089899619b5a85e6d83a200dc'/>
<id>21ccba43f511cc4089899619b5a85e6d83a200dc</id>
<content type='text'>
If a debugger detaches from a process that has a new thread that has
not yet executed, the new thread will raise a SIGTRAP signal to report
it's thread birth event even after the detach.  With the debugger
detached, this results in a SIGTRAP sent to the process and typically
a core dump.  Fix this by clearing TDB_BORN from any new threads
during detach.

Bump __FreeBSD_version for debuggers to notice when the fix is
present.

Reported by:	GDB's testsuite
Reviewed by:	kib, markj (previous version)
Differential Revision:	https://reviews.freebsd.org/D39856

(cherry picked from commit 653738e895ba022be1179a95a85089e7bc66dbbe)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If a debugger detaches from a process that has a new thread that has
not yet executed, the new thread will raise a SIGTRAP signal to report
it's thread birth event even after the detach.  With the debugger
detached, this results in a SIGTRAP sent to the process and typically
a core dump.  Fix this by clearing TDB_BORN from any new threads
during detach.

Bump __FreeBSD_version for debuggers to notice when the fix is
present.

Reported by:	GDB's testsuite
Reviewed by:	kib, markj (previous version)
Differential Revision:	https://reviews.freebsd.org/D39856

(cherry picked from commit 653738e895ba022be1179a95a85089e7bc66dbbe)
</pre>
</div>
</content>
</entry>
<entry>
<title>sys: Remove $FreeBSD$: one-line .c pattern</title>
<updated>2023-08-23T17:43:25+00:00</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-22T01:31:27+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=3bc80996974a61a4223eae4c1ccd47b6ee32a48a'/>
<id>3bc80996974a61a4223eae4c1ccd47b6ee32a48a</id>
<content type='text'>
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/

Similar commit in current:
(cherry picked from commit 685dc743dc3b)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/

Similar commit in current:
(cherry picked from commit 685dc743dc3b)
</pre>
</div>
</content>
</entry>
<entry>
<title>ptrace(2): add PT_SC_REMOTE remote syscall request</title>
<updated>2023-01-20T03:20:53+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2022-11-30T08:45:52+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=aaf570313289aad6f96eb49d3b19663d85512c82'/>
<id>aaf570313289aad6f96eb49d3b19663d85512c82</id>
<content type='text'>
Tested by:	pho

(cherry picked from commit 140ceb5d956bb8795a77c23d3fd5ef047b0f3c68)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Tested by:	pho

(cherry picked from commit 140ceb5d956bb8795a77c23d3fd5ef047b0f3c68)
</pre>
</div>
</content>
</entry>
<entry>
<title>sys: rename td_coredump to td_remotereq</title>
<updated>2023-01-20T03:20:35+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2022-11-30T08:48:24+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=55df3e814f61ed28d497af8f8b640bf18e1de94f'/>
<id>55df3e814f61ed28d497af8f8b640bf18e1de94f</id>
<content type='text'>
Tested by:	pho

(cherry picked from commit e6feeae2f915c76275b83b7365ae966a8f8dd016)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Tested by:	pho

(cherry picked from commit e6feeae2f915c76275b83b7365ae966a8f8dd016)
</pre>
</div>
</content>
</entry>
<entry>
<title>Trim duplicate code for copying in iovecs for PT_[GS]ETREGSET.</title>
<updated>2022-05-12T22:12:59+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2022-02-07T19:49:29+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=bbfd21cdab7ae7b6747c41d3745dfa72362468f6'/>
<id>bbfd21cdab7ae7b6747c41d3745dfa72362468f6</id>
<content type='text'>
Reviewed by:	andrew, emaste
Differential Revision:	https://reviews.freebsd.org/D34177

(cherry picked from commit 949e3959669f0ca6697ab0d5e8e0b8194de23f81)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reviewed by:	andrew, emaste
Differential Revision:	https://reviews.freebsd.org/D34177

(cherry picked from commit 949e3959669f0ca6697ab0d5e8e0b8194de23f81)
</pre>
</div>
</content>
</entry>
<entry>
<title>Add PT_GETREGSET</title>
<updated>2022-05-12T22:12:59+00:00</updated>
<author>
<name>Andrew Turner</name>
<email>andrew@FreeBSD.org</email>
</author>
<published>2022-01-24T11:24:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=658631a37d78c9ea5debe4642630c7154b86bcd6'/>
<id>658631a37d78c9ea5debe4642630c7154b86bcd6</id>
<content type='text'>
This adds the PT_GETREGSET and PT_SETREGSET ptrace types. These can be
used to access all the registers from a specified core dump note type.
The NT_PRSTATUS and NT_FPREGSET notes are initially supported. Other
machine-dependant types are expected to be added in the future.

The ptrace addr points to a struct iovec pointing at memory to hold the
registers along with its length. On success the length in the iovec is
updated to tell userspace the actual length the kernel wrote or, if the
base address is NULL, the length the kernel would have written.

Because the data field is an int the arguments are backwards when
compared to the Linux PTRACE_GETREGSET call.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19831

(cherry picked from commit 548a2ec49bd4ebf9ab00d362257c6bb4d2d7edbc)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This adds the PT_GETREGSET and PT_SETREGSET ptrace types. These can be
used to access all the registers from a specified core dump note type.
The NT_PRSTATUS and NT_FPREGSET notes are initially supported. Other
machine-dependant types are expected to be added in the future.

The ptrace addr points to a struct iovec pointing at memory to hold the
registers along with its length. On success the length in the iovec is
updated to tell userspace the actual length the kernel wrote or, if the
base address is NULL, the length the kernel would have written.

Because the data field is an int the arguments are backwards when
compared to the Linux PTRACE_GETREGSET call.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19831

(cherry picked from commit 548a2ec49bd4ebf9ab00d362257c6bb4d2d7edbc)
</pre>
</div>
</content>
</entry>
<entry>
<title>Create sys/reg.h for the common code previously in machine/reg.h</title>
<updated>2022-05-12T22:12:59+00:00</updated>
<author>
<name>Andrew Turner</name>
<email>andrew@FreeBSD.org</email>
</author>
<published>2021-08-27T09:38:40+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e5e2c7ffa0f7d9ba0874b95924f4d977b116f45b'/>
<id>e5e2c7ffa0f7d9ba0874b95924f4d977b116f45b</id>
<content type='text'>
Move the common kernel function signatures from machine/reg.h to a new
sys/reg.h. This is in preperation for adding PT_GETREGSET to ptrace(2).

Reviewed by:	imp, markj
Sponsored by:	DARPA, AFRL (original work)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19830

(cherry picked from commit b792434150d66b9b2356fb9a7548f4c7f0a0f16c)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move the common kernel function signatures from machine/reg.h to a new
sys/reg.h. This is in preperation for adding PT_GETREGSET to ptrace(2).

Reviewed by:	imp, markj
Sponsored by:	DARPA, AFRL (original work)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D19830

(cherry picked from commit b792434150d66b9b2356fb9a7548f4c7f0a0f16c)
</pre>
</div>
</content>
</entry>
<entry>
<title>proc: Remove assertion that P_WEXIT is not set in proc_rwmem()</title>
<updated>2022-03-15T15:40:22+00:00</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2022-03-01T20:08:25+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7c27fee0ea1690445b98e29c12c8939983257c84'/>
<id>7c27fee0ea1690445b98e29c12c8939983257c84</id>
<content type='text'>
exit1() sets P_WEXIT before waiting for holding threads to finish,
rather than after, so this assertion is racy.

Fixes:	12fb39ec3e6b ("proc: Relax proc_rwmem()'s assertion on the process hold count")
Reported by:	Jenkins

(cherry picked from commit 879b0604a8940f575f03bde5457bcf13e64c1ae8)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
exit1() sets P_WEXIT before waiting for holding threads to finish,
rather than after, so this assertion is racy.

Fixes:	12fb39ec3e6b ("proc: Relax proc_rwmem()'s assertion on the process hold count")
Reported by:	Jenkins

(cherry picked from commit 879b0604a8940f575f03bde5457bcf13e64c1ae8)
</pre>
</div>
</content>
</entry>
<entry>
<title>proc: Relax proc_rwmem()'s assertion on the process hold count</title>
<updated>2022-03-15T15:39:55+00:00</updated>
<author>
<name>Mark Johnston</name>
<email>markj@FreeBSD.org</email>
</author>
<published>2022-03-01T16:48:39+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=76dcbd770d7b1e37e3fe14472d9f339b9180ebd8'/>
<id>76dcbd770d7b1e37e3fe14472d9f339b9180ebd8</id>
<content type='text'>
This reference ensures that the process and its associated vmspace will
not be destroyed while proc_rwmem() is executing.  If, however, the
calling thread belongs to the target process, then it is unnecessary to
hold the process.  In particular, fasttrap - a module which enables
userspace dtrace - may frequently call proc_rwmem(), and we'd prefer to
avoid the overhead of locking and bumping the hold count when possible.

Thus, make the assertion conditional on "p != curproc".  Also assert
that the process is not already exiting.  No functional change intended.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 12fb39ec3e6bc529feff3ba2862c6a4a30bd54eb)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reference ensures that the process and its associated vmspace will
not be destroyed while proc_rwmem() is executing.  If, however, the
calling thread belongs to the target process, then it is unnecessary to
hold the process.  In particular, fasttrap - a module which enables
userspace dtrace - may frequently call proc_rwmem(), and we'd prefer to
avoid the overhead of locking and bumping the hold count when possible.

Thus, make the assertion conditional on "p != curproc".  Also assert
that the process is not already exiting.  No functional change intended.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 12fb39ec3e6bc529feff3ba2862c6a4a30bd54eb)
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove PT_GET_SC_ARGS_ALL</title>
<updated>2022-02-21T13:34:16+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2021-09-15T13:24:09+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=4cae9d803a9562a003d00bf8f7b90674e011bae7'/>
<id>4cae9d803a9562a003d00bf8f7b90674e011bae7</id>
<content type='text'>
Reimplement bdf0f24bb16d556a5b by checking for the caller' ABI in
the implementation of PT_GET_SC_ARGS, and copying out everything if
it is Linuxolator.

Also fix a minor information leak: if PT_GET_SC_ARGS_ALL is done on the
thread reused after other process, it allows to read some number of that
thread last syscall arguments. Clear td_sa.args in thread_alloc().

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D31968

(cherry picked from commit f575573ca57716395ad88b962388a55d755cf6a7)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reimplement bdf0f24bb16d556a5b by checking for the caller' ABI in
the implementation of PT_GET_SC_ARGS, and copying out everything if
it is Linuxolator.

Also fix a minor information leak: if PT_GET_SC_ARGS_ALL is done on the
thread reused after other process, it allows to read some number of that
thread last syscall arguments. Clear td_sa.args in thread_alloc().

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D31968

(cherry picked from commit f575573ca57716395ad88b962388a55d755cf6a7)
</pre>
</div>
</content>
</entry>
</feed>
