From nobody Thu Dec 2 21:11:38 2021 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 13EB918C847E for ; Thu, 2 Dec 2021 21:11:39 +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 4J4pY66W6vz3LRh for ; Thu, 2 Dec 2021 21:11:38 +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 C0C3D24374 for ; Thu, 2 Dec 2021 21:11:38 +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 1B2LBc0T056319 for ; Thu, 2 Dec 2021 21:11:38 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 1B2LBcvK056318 for bugs@FreeBSD.org; Thu, 2 Dec 2021 21:11:38 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 234775] PTHREAD_STACK_MIN is too small on amd64 Date: Thu, 02 Dec 2021 21:11:38 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: pjfloyd@wanadoo.fr X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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=1638479498; 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: in-reply-to:in-reply-to:references:references; bh=wicHzZJ34srIlblINEXe1VfiVE3wmqyGO0ajRmtxevU=; b=GXkVBIrJx8VwY/em28hXKIBdOV/8pCHFPbl5OqSjEd6KyuM7wLtXoKUzFc4yBP+1IIZ3Pj zdIM8rV2HVqydo5YLDAXQMvY7zyPGR7dFXSN58kgbCQ91rWDY8r49w5zO4FyXRI/c1UCjs r6JAR4EnjdadhU4/ko9o7sKZLtaK2GItcz5mjijKzWhNFUp//TWm4/01acB1OItNa3PYoh eEeNnjfFjQWXD8LNilrVha5k8wlVZBgcDKszpzMKLH+zTgN9DCTFJ+8s5Xgsor/Q82zu/J VQcILRklHmk/jZUmvqNy3wbVNl59SAyjPoCHLrykK2RZ35LiobG7nSmoEFUdzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638479498; a=rsa-sha256; cv=none; b=R6IE1NeZBpn/6Kv4ACo88XjrKLqrfp7pGMul9DiPN/z7xPQFv58Yf/bFFNgguGgEBn6F1t zIrA9p5ReFDNSPYsHsTv06yvXZDnN/RKyM/yfLbnNita1phzF89ThAjex1dvfJOShg7qta /jZBrQBtfkkxfwJN6iFSp0sRsTZnuX3NWNJeMzbxNgcirYTMtZsX3WEOSgID955DKKCSct CLnPbFafP4Q1MEf2QnT0oB0GS4ravcvL79AjLcVhkBT/aU00HtoDdiM6H3+yWOetqfM7aa BvMxqbDUm7wUtBGPKmVO2cyIdYNOXUPZj++Whv62bE8/JN1SZL2CkJ3zEVWCIQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D234775 --- Comment #6 from Paul Floyd --- I modified the testcase to take the stack size as an argument and print "success" if the thread gets created and joins. #include #include #include #include static void * fn(void *arg __unused) { return (NULL); } int main(int argc, char** argv) { pthread_t t; pthread_attr_t attr; size_t size =3D (size_t)atoi(argv[1]); (void)pthread_attr_init(&attr); /*(void)pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);*/ (void)pthread_attr_setstacksize(&attr, size); (void)pthread_create(&t, &attr, fn, NULL); (void)pthread_join(t, NULL); printf("success\n"); return (0); } then I wrote a little python script to do a binary search to find the minim= um #!/usr/local/bin/python3.8 import subprocess def binary_search(start, end): while (start <=3D end): mid =3D (start + end ) // 2 status =3D subprocess.run(['./pthread_stack', str(mid)], capture_output=3DTrue) if (status.stdout.decode().strip("\n") =3D=3D "success"): end =3D mid - 1 else: start =3D mid + 1 return mid res =3D binary_search(1, 10000) print("res " + str(res)) For an i386 binary compiled with clang -g -o pthread_stack pthread_stack.c -pthread -m32 I get res 2788 and for an amd64 binary (as before but without -m32) I get res 3024 --=20 You are receiving this mail because: You are the assignee for the bug.=