Commit graph

37 commits

Author SHA1 Message Date
Brooks Davis eb5fd01b53 soxstack: slience 32-bit gcc warning
Modern GCC complains when casting pointers to integers of a different
size (even a larger one).  Switch from uint64_t to uintptr_t which will
always be the right size for a stack address instead of maybe being too
big.

Reviewed by:	dchagin, emaste
Differential Revision:	https://reviews.freebsd.org/D45087
2024-05-08 15:51:17 +01:00
Mark Johnston 8f26ed01bd mlock tests: Add a regression test
The test tries to trigger creation of a superpage mapping in an
mlock()ed region.

MFC after:	2 weeks
2023-09-17 06:27:31 -04:00
Dmitry Chagin f8bc606aad tests: Handle SIGSEGV in the vm stack mprotect exec test
To exit gracefully handle SIGSEGV and mark the test as failed.

MFC after:		3 days
2023-08-24 21:02:52 +03:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Warner Losh b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Dmitry Chagin f3e11927dc vm: Allow MAP_32BIT for all architectures
Reviewed by:		alc, kib, markj
Differential revision:	https://reviews.freebsd.org/D41435
2023-08-14 20:20:20 +03:00
Li-Wen Hsu b231322dbe
tests: Also exclude powerpc/powerpcspe from mmap_map_32bit_test
Sponsored by:	The FreeBSD Foundation
2023-08-12 09:24:15 +08:00
Ed Maste 07d3738b82 soxstack: silence GCC warning
Add parens around _STACK_FLAG_GROWS expression to fix GCC warning about
arithmetic in operand of '|'.

Sponsored by:	The FreeBSD Foundation
2023-08-08 21:15:19 -04:00
Dmitry Chagin 76f28f656e tests: Fix build after 8920c5f2
MFC after:		2 weeks
2023-08-09 00:39:35 +03:00
Dmitry Chagin 8920c5f2a1 tests: Add stack grows tests
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D41320
MFC after:		2 weeks
2023-08-08 18:12:09 +03:00
Dmitry Chagin 5a7e48dddf tests: Add MAP_32BIT flag test
Reviewed by:		kib, markj
Differential Revision:	https://reviews.freebsd.org/D41236
MFC after:		1 month
2023-08-01 23:23:15 +03:00
Warner Losh 4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Eric van Gyzen 3b0f105ce3 shared_shadow_inval_test: fix copy-pasto in error message
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2022-08-24 13:03:11 -05:00
Mark Johnston 4b8feb5d61 tests: Handle platforms with MAXPAGESIZES < 2
Reported by:	Jenkins
Fixes:		1dfa8b73f6 ("tests: Add more shared shadow regression tests")
2022-08-23 19:48:06 -04:00
Eric van Gyzen 3d268c19ef Fix shared_shadow_inval_test when superpages are disabled
In that case, there is only one page size.

Reviewed by:	kib
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D36265
2022-08-23 09:12:51 -05:00
Mark Johnston 1dfa8b73f6 tests: Add more shared shadow regression tests
The new tests exercise simulated COW that occurs when the protections on
a wired, copy-on-write mapping are changed from read-only to read-write.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35636
2022-08-09 18:34:01 -04:00
Arka Sharma 766c2466ff mmap map_at_zero test: handle W^X
Use kern.elfXX.allow_wx to decide whether to map W+X or W-only memory.

Future work could expand this test to add an "allow_wx" axis to the
test matrix, but I would argue that a separate test should be written,
since that's orthogonal to map_at_zero.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2022-02-21 09:43:42 -06:00
Ryan Libby 13d4f96130 shared shadow vm object invalidation regression test
Add a regression test for a scenario where a shadow vm object is shared
by multiple mappings.  If a page COW occurs through one of the mappings,
then the virtual-to-physical mapping may become invalidated.

This tests the scenario from CVE-2021-29626 which was fixed by
982693bb72.

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
2021-04-07 12:39:05 -07:00
Adrian Chadd 07a605f427 [tests] Fix unused variable warning in gcc
Reviewed by:	markj, imp, cem,
Approved by:	markj
Differential Revision:	https://reviews.freebsd.org/D26792
2020-11-13 18:50:24 +00:00
Andrew Turner f56a08c810 Fix write only mappings on arm64
When trapping on a wrote access to a buffer the kernel has mapped as write
only we should only pass the VM_PROT_WRITE flag. Previously the call to
vm_fault_trap as the VM_PROT_READ flag was unexpected.

Reported by:	manu
Sponsored by:	Innovate UK
2020-10-13 10:26:15 +00:00
Jilles Tjoelker 4f77551258 Adjust tests after page fault changes in r352807
Commit r352807 fixed various signal numbers and codes from page faults;
adjust the tests so they expect the fixes to be present.

PR:		211924
2019-09-29 15:17:58 +00:00
Jilles Tjoelker 416e2de337 Add some tests for page fault signals and codes
It is useful to have some tests for page fault signals.

More tests would be useful but creating the conditions (such as various
kinds of running out of memory and I/O errors) is more complicated.

The tests page_fault_signal__bus_objerr_1 and
page_fault_signal__bus_objerr_2 depend on https://reviews.freebsd.org/D21566
before they can pass.

PR:		211924
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D21624
2019-09-18 21:00:32 +00:00
Mark Johnston 8beadca53c Add a few regression tests for mlock(2).
These are intended to exercise some rarely executed code paths.

MFC after:	2 weeks
2019-05-01 15:28:23 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Enji Cooper 374d7f62e0 Revert r313565 -- :mmap__bad_arguments passes again after r313655
PR:		216976
Sponsored by:	Dell EMC Isilon
2017-02-11 20:31:57 +00:00
Enji Cooper 28e5919804 Expect :mmap__bad_arguments to fail
Some recent changes to vm related to mmap(2) have broken the prot checks that
would result with an EINVAL with this case

I suspect r313352 is the root-cause the issue

PR:		216976
Sponsored by:	Dell EMC Isilon
2017-02-10 19:31:09 +00:00
Enji Cooper 5fea45956e Fix -Wsign-compare warnings
The loop index (i) doesn't need to be size_t as its comparison is signed

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-01-14 04:09:01 +00:00
Enji Cooper 430f7286a5 Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed
after r298107

Summary of changes:

- Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that
  namespacing is kept with FILES appropriately, and that this shouldn't need
  to be repeated if the namespace changes -- only the definition of PACKAGE
  needs to be changed
- Allow PACKAGE to be overridden by callers instead of forcing it to always be
  `tests`. In the event we get to the point where things can be split up
  enough in the base system, it would make more sense to group the tests
  with the blocks they're a part of, e.g. byacc with byacc-tests, etc
- Remove PACKAGE definitions where possible, i.e. where FILES wasn't used
  previously.
- Remove unnecessary TESTSPACKAGE definitions; this has been elided into
  bsd.tests.mk
- Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES;
  ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk.
- Fix installation of files under data/ subdirectories in lib/libc/tests/hash
  and lib/libc/tests/net/getaddrinfo
- Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup)

Document the proposed changes in share/examples/tests/tests/... via examples
so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of
replacing FILES. share/mk/bsd.README didn't seem like the appropriate method
of communicating that info.

MFC after: never probably
X-MFC with: r298107
PR: 209114
Relnotes: yes
Tested with: buildworld, installworld, checkworld; buildworld, packageworld
Sponsored by: EMC / Isilon Storage Division
2016-05-04 23:20:53 +00:00
Enji Cooper 410757a4f4 Fix leaks and test for getpagesize() returning == -1
- close file descriptors after use.
- Always munmap memory regions after mmap'ing them.
- Make sure getpagesize() returns a value greater than 0 and use a
  cached value instead of always calling getpagesize(3).

CID: 1331374-1331377, 1331653-1331662
Differential Revision: https://reviews.freebsd.org/D6011
MFC after: 2 weeks
Reported by: Coverity
Reviewed by: cem
Sponsored by: EMC / Isilon Storage Division
2016-04-19 22:25:14 +00:00
Glen Barber 7d536dc855 MFH
Sponsored by:	The FreeBSD Foundation
2016-03-10 21:16:01 +00:00
Bryan Drewery 15c433351f DIRDEPS_BUILD: Connect MK_TESTS.
Sponsored by:	EMC / Isilon Storage Division
2016-03-09 22:46:01 +00:00
Glen Barber 2aa00a6001 More 'tests' package fixes.
Sponsored by:	The FreeBSD Foundation
2016-02-03 00:34:23 +00:00
John Baldwin 9695459d02 Add more mmap tests related to character devices.
- Add cdev-related tests for bad args.
- Add two simple tests cases for mapping /dev/zero that test for
  MAP_ANON-like behavior.

Reviewed by:	alc, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3323
2015-09-04 01:02:21 +00:00
John Baldwin 7f43ee0fb7 Add various tests to ensure that invalid arguments passed to mmap()
trigger failures.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D3269
2015-08-06 16:14:29 +00:00
John Baldwin 95eee0d40b Convert the map_at_zero test case to ATF. In particular, this will
facilitate adding more mmap() tests.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D3268
2015-08-06 16:12:12 +00:00
Enji Cooper 42484f6f69 Move tests/sys/kern/mmap_test to tests/sys/vm/mmap_test
As jhb noted, the actual mmap(2) implementation is under sys/vm, not
sys/kern/, so the correct logical place is tests/sys/vm/, not
tests/sys/kern/

X-MFC with: r282076
MFC after: 6 days
2015-04-27 17:53:09 +00:00