Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vm_native: fix overcommit on FreeBSD #10989

Merged
merged 2 commits into from Oct 11, 2021
Merged

vm_native: fix overcommit on FreeBSD #10989

merged 2 commits into from Oct 11, 2021

Conversation

jbeich
Copy link
Contributor

@jbeich jbeich commented Oct 11, 2021

rpcs3 shm-crash

shm_open(2) says:

If successful, memfd_create() and shm_open() both return a non-negative integer, and shm_rename() and shm_unlink() return zero. All functions return -1 on failure, and set errno to indicate the error.

shm_open() returns a file descriptor on success, not zero. As SHM_ANON
only exists on FreeBSD which also has memfd_create use the same code
as on Linux.

$ rpcs3
[...]
Verification failed (in file rpcs3/util/vm_native.cpp:478[:4], in function shm) (errno=2)
Segmentation fault
dragonfly$ sysctl vm.overcommit
sysctl: unknown oid 'vm.overcommit'

freebsd$ rg VM_OVERCOMMIT /usr/include
/usr/include/vm/vm_param.h
89:#define VM_OVERCOMMIT                12      /* vm.overcommit */
@jbeich jbeich changed the title vm_native: fix shm_open on FreeBSD vm_native: fix overcommit on FreeBSD Oct 11, 2021
@Nekotekina Nekotekina merged commit 7a24642 into RPCS3:master Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants