| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An initial reading of the preamble of sys_procctl() gives the impression
that no test prevents a malicious user from passing a negative commands
index (in 'uap->com'), which is soon used as an index into the static
array procctl_cmds_info[].
However, a closer examination leads to the conclusion that the existing
code is technically correct. Indeed, the comparison of 'uap->com' to
the nitems() expression, which expands to a ratio of sizeof(), leads to
a conversion of 'uap->com' to an 'unsigned int' as per Usual Arithmetic
Conversions/Integer Promotions applied by '<=', because sizeof() returns
'size_t' values, and we define 'size_t' as an equivalent of 'unsigned
int' (which is not mandated by the standard, the latter allowing, e.g.,
integers of lower ranks).
With this conversion, negative values of 'uap->com' are automatically
ruled-out since they are converted to very big unsigned integers which
are caught by the test. An analysis of assembly code produced by LLVM
16 on amd64 and practical tests confirm that no exploitation is possible.
However, the guard code as written is misleading to readers and might
trip up static analysis tools. Make sure that negative values are
explicitly excluded so that it is immediately clear that EINVAL will be
returned in this case.
Build tested with clang 16 and GCC 12.
Approved by: markj (mentor)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
(cherry picked from commit afc10f8bba3dd293a66461aaca41237c986b6ca7)
Approved by: emaste (mentor)
|
|
|
|
|
|
|
| |
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
Similar commit in current:
(cherry picked from commit 685dc743dc3b)
|
|
|
|
| |
(cherry picked from commit 8164032a495b53b9176814f7b08e093961fabdca)
|
|
|
|
| |
(cherry picked from commit 77f0e198d9134b6ca2650d3a84d7db2d786ec0c0)
|
|
|
|
| |
(cherry picked from commit 5e5675cb4bfa80b6026b5c781d6fa2cc9254468f)
|
|
|
|
| |
(cherry picked from commit 2842ec6d99ce3590eabb34d23eff5b0fed24eb98)
|
|
|
|
| |
(cherry picked from commit 5c78797e42497270d8719590d11243a4473114c4)
|
|
|
|
|
|
| |
Tested by: pho (whole series MFC)
(cherry picked from commit 1575804961d2ba1768c9a6b28438d364421718f3)
|
|
|
|
|
|
| |
handle later
(cherry picked from commit e0343eacf36588bf503c7a59c0cc436294223839)
|
|
|
|
| |
(cherry picked from commit 1d4abf2cfa6e71f4e29ab1f1a6d366d11f3d6027)
|
|
|
|
| |
(cherry picked from commit addf103ce6b38583762bcb066f6ac3b160e826bb)
|
|
|
|
|
|
| |
suspension
(cherry picked from commit 008b2e65442a0d65bc5be9ca625616ddfa6f9ce2)
|
|
|
|
|
|
| |
process
(cherry picked from commit 4493a13e3bfbbdf8488993843281ec688057ee0f)
|
|
|
|
| |
(cherry picked from commit d3000939c7b94fc887f23dd8946861cf0fa1b73b)
|
|
|
|
| |
(cherry picked from commit 709783373e57069cc014019a14a806b580e1d62f)
|
|
|
|
| |
(cherry picked from commit 39794d80ad900915e5c4940e9917ba5cb59a8634)
|
|
|
|
| |
(cherry picked from commit d1df34736888f43e8fe1cdc460eac134d625c777)
|
|
|
|
| |
(cherry picked from commit 54a11adbd9c2b1fa9b42181ac883ed6ed2a6998c)
|
|
|
|
| |
(cherry picked from commit 134529b11b5343aed09e220b49147873d052e4bf)
|
|
|
|
| |
(cherry picked from commit e4ce431e2a0255751fee0ad14b08bd006759ce4f)
|
|
|
|
| |
(cherry picked from commit c7f38a2df1f0d15346f4405407d89365f6ae3fe1)
|
|
|
|
| |
(cherry picked from commit 49db81aa053beb131ba9dbf5519a5f0eacf28265)
|
|
|
|
| |
(cherry picked from commit 3692877a6cf8fc374349f3d9b2cbb190fec484a0)
|
|
|
|
| |
(cherry picked from commit f5bb6e5a6d488740e451ad4acd82a70b95e786cd)
|
|
|
|
|
|
| |
privilege over the target
(cherry picked from commit 1c4dbee5dd224c08241c0922ff577bb226171e81)
|
|
|
|
| |
(cherry picked from commit 32026f5983ed00e64829f8c20b09748077809729)
|
|
|
|
| |
(cherry picked from commit 56d5323b4d7d9ccbe1ca3e620400afd165519a12)
|
|
|
|
| |
(cherry picked from commit 68dc5b381a29aaa418064324519105a8c2a4a080)
|
|
|
|
| |
(cherry picked from commit 34f39a8c0e2a4100837eb406ae24a7d6a357d696)
|
|
|
|
| |
(cherry picked from commit f833ab9dd187328306fa1601330fbc8332392abe)
|
|
|
|
| |
(cherry picked from commit 7ae879b14a2086df521c59c4a379d3a072e08bc6)
|
|
|
|
| |
(cherry picked from commit 31faa565edea908a8caf71cc6783066c02fd6844)
|
|
|
|
| |
(cherry picked from commit 796a8e1ad1ae3f7b8e4c9f97bebbef5d7d5a2c16)
|
|
|
|
| |
(cherry picked from commit db8d680ebe9b12c7d9e0eb8bf9940fcef709f5ec)
|
|
|
|
| |
(cherry picked from commit 0bdb2cbf9d7c4366a0668b4563c8630538a50086)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously procctl(PROC_PROTMAX_STATUS, ... used the PROC_ASLR_NOFORCE
macro for the "system-wide configured policy" status, instead of
PROC_PROTMAX_NOFORCE.
They both have a value of 3, so no functional change.
Sponsored by: The FreeBSD Foundation
Notes:
svn path=/head/; revision=360535
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It allows a process to request that stack gap was not applied to its
stacks, retroactively. Also it is possible to control the gaps in the
process after exec.
PR: 239894
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D21352
Notes:
svn path=/head/; revision=351773
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
feature bit.
In particular, allocate the bit to opt-out the image from implicit
PROTMAX enablement. Provide procctl(2) verbs to set and query
implicit PROTMAX handling. The knobs mimic the same per-image flag
and per-process controls for ASLR.
Reviewed by: emaste, markj (previous version)
Discussed with: brooks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D20795
Notes:
svn path=/head/; revision=349609
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the infrastructure to allow MD procctl(2) commands, and use it to
introduce amd64 PTI control and reporting. PTI mode cannot be
modified for existing pmap, the knob controls PTI of the new vmspace
created on exec.
Requested by: jhb
Reviewed by: jhb, markj (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D19514
Notes:
svn path=/head/; revision=345228
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With this change, randomization can be enabled for all non-fixed
mappings. It means that the base address for the mapping is selected
with a guaranteed amount of entropy (bits). If the mapping was
requested to be superpage aligned, the randomization honours the
superpage attributes.
Although the value of ASLR is diminshing over time as exploit authors
work out simple ASLR bypass techniques, it elimintates the trivial
exploitation of certain vulnerabilities, at least in theory. This
implementation is relatively small and happens at the correct
architectural level. Also, it is not expected to introduce
regressions in existing cases when turned off (default for now), or
cause any significant maintaince burden.
The randomization is done on a best-effort basis - that is, the
allocator falls back to a first fit strategy if fragmentation prevents
entropy injection. It is trivial to implement a strong mode where
failure to guarantee the requested amount of entropy results in
mapping request failure, but I do not consider that to be usable.
I have not fine-tuned the amount of entropy injected right now. It is
only a quantitive change that will not change the implementation. The
current amount is controlled by aslr_pages_rnd.
To not spoil coalescing optimizations, to reduce the page table
fragmentation inherent to ASLR, and to keep the transient superpage
promotion for the malloced memory, locality clustering is implemented
for anonymous private mappings, which are automatically grouped until
fragmentation kicks in. The initial location for the anon group range
is, of course, randomized. This is controlled by vm.cluster_anon,
enabled by default.
The default mode keeps the sbrk area unpopulated by other mappings,
but this can be turned off, which gives much more breathing bits on
architectures with small address space, such as i386. This is tied
with the question of following an application's hint about the mmap(2)
base address. Testing shows that ignoring the hint does not affect the
function of common applications, but I would expect more demanding
code could break. By default sbrk is preserved and mmap hints are
satisfied, which can be changed by using the
kern.elf{32,64}.aslr.honor_sbrk sysctl.
ASLR is enabled on per-ABI basis, and currently it is only allowed on
FreeBSD native i386 and amd64 (including compat 32bit) ABIs. Support
for additional architectures will be added after further testing.
Both per-process and per-image controls are implemented:
- procctl(2) adds PROC_ASLR_CTL/PROC_ASLR_STATUS;
- NT_FREEBSD_FCTL_ASLR_DISABLE feature control note bit makes it possible
to force ASLR off for the given binary. (A tool to edit the feature
control note is in development.)
Global controls are:
- kern.elf{32,64}.aslr.enable - for non-fixed mappings done by mmap(2);
- kern.elf{32,64}.aslr.pie_enable - for PIE image activation mappings;
- kern.elf{32,64}.aslr.honor_sbrk - allow to use sbrk area for mmap(2);
- vm.cluster_anon - enables anon mapping clustering.
PR: 208580 (exp runs)
Exp-runs done by: antoine
Reviewed by: markj (previous version)
Discussed with: emaste
Tested by: pho
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D5603
Notes:
svn path=/head/; revision=343964
|
|
|
|
|
|
|
|
|
|
|
|
| |
-> PROC_PDEATHSIG_STATUS for consistency with other procctl(2)
operations names.
Requested by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 13 days
Notes:
svn path=/head/; revision=332825
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow processes to request the delivery of a signal upon death of
their parent process. Supposed consumer of the feature is PostgreSQL.
Submitted by: Thomas Munro
Reviewed by: jilles, mjg
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D15106
Notes:
svn path=/head/; revision=332740
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
subordinate reaper.
Also, mark reapers when listing pids.
Reported by: Michael Zuo <muh.muhten@gmail.com>
PR: 223745
Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D13183
Notes:
svn path=/head/; revision=326122
|
|
|
|
|
|
|
| |
MFC after: 2 weeks
Notes:
svn path=/head/; revision=310096
|
|
|
|
|
|
|
|
| |
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Notes:
svn path=/head/; revision=306260
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Both can be used to cause processes in capability mode to receive
SIGTRAP when ENOTCAPABLE or ECAPMODE errors are returned from
syscalls.
Idea by: emaste
Reviewed by: oshogbo (previous version), emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D7965
Notes:
svn path=/head/; revision=306081
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
having some children, the children' reaper is not reset to the parent.
This allows for the situation where reaper has children but not
descendands and the too strict asserts in the reap_status() fire.
Remove the wrong asserts, add some clarification for the situation to
the procctl(2) REAP_STATUS.
Reported and tested by: feld
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Notes:
svn path=/head/; revision=286975
|
|
|
|
|
|
|
|
|
|
|
|
| |
children. Handle the situation instead asserting that it is
impossible.
Reported and tested by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Notes:
svn path=/head/; revision=278795
|
|
|
|
|
|
|
|
|
|
|
| |
the call.
Reported and tested by: bapt
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Notes:
svn path=/head/; revision=278794
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
attachment to the process. Note that the command is not intended to
be a security measure, rather it is an obfuscation feature,
implemented for parity with other operating systems.
Discussed with: jilles, rwatson
Man page fixes by: rwatson
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Notes:
svn path=/head/; revision=277322
|