flathub / com.valvesoftware.Steam.CompatibilityTool.Proton

https://flathub.org/apps/details/com.valvesoftware.Steam.CompatibilityTool.Proton
35 stars 6 forks source link

Update seccomp patch, based on staging patch #9

Closed gasinvein closed 3 years ago

gasinvein commented 3 years ago

Adopted patch from https://github.com/ValveSoftware/wine/issues/99#issuecomment-721260612

Original Wine code from Proton (as before #5) ```c int ret; ``` ```c if (!(ret = prctl(PR_GET_SECCOMP, 0, NULL, 0, 0))) { if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) { perror("prctl(PR_SET_NO_NEW_PRIVS, ...)"); exit(1); } if (sc_seccomp(SECCOMP_SET_MODE_FILTER, flags, &prog)) { perror("prctl(PR_SET_SECCOMP, ...)"); exit(1); } check_bpf_jit_enable(); } else { if (ret == 2) TRACE("Seccomp filters already installed.\n"); else ERR("Seccomp filters cannot be installed, ret %d, error %s.\n", ret, strerror(errno)); } sigaction(SIGSYS, sig_act, NULL); ```
Patched code (after this PR) ```c NTSTATUS status; ``` ```c sigaction(SIGSYS, sig_act, NULL); if ((status = syscall(0xffff)) == STATUS_INVALID_PARAMETER) { TRACE("Seccomp filters already installed.\n"); return; } if (status != -ENOSYS && (status != -1 || errno != ENOSYS)) { ERR("Unexpected status %#x, errno %d.\n", status, errno); return; } if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) { perror("prctl(PR_SET_NO_NEW_PRIVS, ...)"); exit(1); } if (sc_seccomp(SECCOMP_SET_MODE_FILTER, flags, &prog)) { perror("prctl(PR_SET_SECCOMP, ...)"); exit(1); } check_bpf_jit_enable(); ```

Since I'm not familiar with C and not sure if got everything right, a review from someone more knowledgeable would be very useful.

flathubbot commented 3 years ago

Started test build 31985

flathubbot commented 3 years ago

Build 31985 successful To test this build, install it from the testing repository:

flatpak install --user https://dl.flathub.org/build-repo/30801/com.valvesoftware.Steam.CompatibilityTool.Proton.flatpakref
nanonyme commented 3 years ago

LGTM. If hasn't gone through battle testing yet, maybe let's get it tested by end-users while n beta.

gasinvein commented 3 years ago

Ok, let's merge this to beta. Review is still wanted before it lands to master.