From nobody Mon Nov 07 14:15:15 2022 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N5YCm1SkDz4h5RZ for ; Mon, 7 Nov 2022 14:15:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N5YCl61pqz3j43 for ; Mon, 7 Nov 2022 14:15:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N5YCl4yDPz1446 for ; Mon, 7 Nov 2022 14:15:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 2A7EFFnp067055 for ; Mon, 7 Nov 2022 14:15:15 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 2A7EFFCT067054 for bugs@FreeBSD.org; Mon, 7 Nov 2022 14:15:15 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 267616] Linuxulator: get_robust_list is slightly broken on amd64 for 32-bit apps Date: Mon, 07 Nov 2022 14:15:15 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 13.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: iwtcex@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667830515; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/kDN/msBlK2lHGbqAbEiFJetVAP7ndjl/SLyFzDFdkU=; b=DR3Nnsd96h+ZvltrWxIoWMxH9/e7S8LlRjIn/24c894vvk/MB8Tgz1X2VKpaVPmlvslFoj +PyNTgOL67lS4jxXyU/ZR/vDAqjMzGtURDBGxsW3jJKyQ0d7wbc0lNl+USnPI0QWxjVtSC bDPlotZ8u0vyiHrKFpNF4zUqmOj+s/5VlMX5JPe/ghgELvhLFKL8jFT7CWLZ5yP7PyemJf Of2Y0sjfaA0G+tIFzvCEgFux4FfwN6BMpnTMzlTAUsXq/2a8KTuLbLwV+erBIIV1bnrjCy 6Om0RvpSiRztkOa3pspkiAr+y7tge4E0zvmRVx4ODrbFSEMYsPkGHik/eiRFuw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667830515; a=rsa-sha256; cv=none; b=hmJEJzldiCaxUzZpY8HCeIdNkeUj8VUlT2T9gIvr4kqjhkBwY888TJCdO/DGyQN7LqIvBd YxLZ+nwWDfL0tyL80zj5med0MvIVOg5uPCj96aaQxvjTqEJIlXOM8R/T2sVMG6ewmt1Hds /1t0CK6QEz1JbgYG/A4xx5W0W4+7R8itqq/jrnMJX/QqwuQVnUfT6PB3ufPXR3OLnoOrMI krf5OHmuPfPnd2QcZDwRN3EIaycYy52ENCdZcKa7AVPS5hR53yCOY9Vg0DWeUFpLXm7FzA dNWFEFefH4myvHJTyMDwFjW+3Y0+otfghDwSwvgqhXxNLmLRrWtrWAFBJaZmUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267616 Bug ID: 267616 Summary: Linuxulator: get_robust_list is slightly broken on amd64 for 32-bit apps Product: Base System Version: 13.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: iwtcex@gmail.com CC: trasz@FreeBSD.org New Steam beta fails with "Fatal error: futex robust_list not initialized by pthreads". % uname -a FreeBSD desktop 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64 % cat robust.c #include #include #include #include #include int main() { assert(sizeof(size_t) =3D=3D sizeof(void*)); { void* x[2]; int err =3D syscall(SYS_get_robust_list, 0, &x[0], &x[1]); assert(err =3D=3D 0); struct robust_list_head* head =3D x[0]; size_t len =3D (size_t)x[1]; printf("head: %p, len: 0x%x, offset =3D %ld\n", head, len, head->futex_offset); } { void* x[2]; int err =3D syscall(SYS_get_robust_list, 0, &x[1], &x[0]); assert(err =3D=3D 0); struct robust_list_head* head =3D x[1]; size_t len =3D (size_t)x[0]; printf("head: %p, len: 0x%x, offset =3D %ld\n", head, len, head->futex_offset); } return 0; } % /compat/linux/bin/cc robust.c -pthread -m32 -Wall -o robust32 % ./robust3 head: 0x28261770, len: 0x0, offset =3D -20 # len is being overwritten by the previous argument, not ok head: 0x28261770, len: 0xc, offset =3D -20 # ok I locally patched the issue like this: --- linux_futex.c.orig 2022-11-07 16:09:35.911266000 +0300 +++ linux_futex.c 2022-11-07 16:12:48.581662000 +0300 @@ -1179,7 +1179,7 @@ linux_get_robust_list(struct thread *td, struct linux_ return (EFAULT); } - error =3D copyout(&head, args->head, sizeof(head)); + error =3D copyout(&head, args->head, sizeof(l_uintptr_t)); if (error) { LIN_SDT_PROBE1(futex, linux_get_robust_list, copyout_error, error); --=20 You are receiving this mail because: You are the assignee for the bug.=