From nobody Sun Aug 27 07:11:42 2023 X-Original-To: dev-commits-src-all@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 4RYPxp6H2Rz4rZvq; Sun, 27 Aug 2023 07:11:42 +0000 (UTC) (envelope-from git@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 4RYPxp5p3Kz4XGs; Sun, 27 Aug 2023 07:11:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693120302; 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=Hkp+jurjM2QgnV9DBvt6zJOoRhHt9C8IKKEzYs5opLw=; b=Blmm4sjXSOvjlJWpi9VGTPGwkDHlf0TYAJL+7jWPzrZ55JwME8Km+LE9UmIk0TAKil4TE1 vJTP3DpbwLLJkHbU2iEN8OCuVLA1LNbGBvlfFxXNB9E2oGM2N+Cjwu14rYXtNQDEnU2gWF TsTmmFvwq7YlmKddjVon9Zj5lkrmnSqXEMORj+U2Wb7aK9+N13a1sCoa3Qoq3vZXWrgEQp FPyDLNqMw4XBNQOByaPO8XX0pn44g/fxuxRxohIQ/7xKroSYW2rGsNaOJKcfQrhdjlg4DN 7nsgrnVxebHIN5TnCOmboNRYlGWwCAHibQCp/rYX8Iq+wPNyNi/rZL0rhTc/aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693120302; 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=Hkp+jurjM2QgnV9DBvt6zJOoRhHt9C8IKKEzYs5opLw=; b=td2ZpUHRNDwtdsqgsEFAUyhfXZH1x3hvReyYDgqtPXIwbezFh/9KRoVNjBimelCA1U2oXH /Zlg9rTPMIa5Kwht+OdvbF5cawOfYP/EDwPl2BZ10jlp7SQetGSSXE/zMZW7IidDTa6wRD 43ALyP6XhSxIxWIbJ8FVHbNqwTaK7jQ3sXDtiAGeufpOcpcCmizr1fEmWUj8Nc6ofEKRr7 i6W0vwpv1+aVlYr/PoVKxd69kpkF9+2T4NF2FeEKfiVDZ/5kxLv83hvcogMvvgAWxjHxxm PiagaTdSSI+K/dVIBMTKPqqmwiizqvGS5gRmUON1AR8NKA7I/trLIAqKxzFslA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693120302; a=rsa-sha256; cv=none; b=mjvyQDczBeieIorRDD5+QwU76wSXmBeYOeBVwmiPNUTqNboBE4wFmbud5eTw6oJ1yTlZ+b +izXvZRmfP0PyzDnKbNMJs95kVCK7rLWMUi3KrHyzRKJvhkcK2hERhuXyYTFiKabJhQSIw RzCNG3HBt+iLgC51AwcGBbUsSRpOBQhbjBcMAq9yZf4CHybn8B4XIJMpoCsQfrCLcek7uD zBuT6pTshbxTiaAla85On0eybjq+F6bOYfwUUNR+Vm5k/RsJOq4/rVX038etEdImXcqk7S 2ZW8UUTxk3iI9FvhZr3mgp8kDoGjt6VJncQKlJ4ajmEsSXhDZ5jh7BeTSqOg+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4RYPxp4kZvz2pL; Sun, 27 Aug 2023 07:11:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37R7BgEg062883; Sun, 27 Aug 2023 07:11:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37R7Bg7k062880; Sun, 27 Aug 2023 07:11:42 GMT (envelope-from git) Date: Sun, 27 Aug 2023 07:11:42 GMT Message-Id: <202308270711.37R7Bg7k062880@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: e579e7e3281f - stable/12 - libthr pshared: correct a bug in allocation List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e579e7e3281f8f096d5a3ca341adcf26bb0df765 Auto-Submitted: auto-generated The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e579e7e3281f8f096d5a3ca341adcf26bb0df765 commit e579e7e3281f8f096d5a3ca341adcf26bb0df765 Author: Konstantin Belousov AuthorDate: 2023-02-01 20:12:45 +0000 Commit: Konstantin Belousov CommitDate: 2023-08-27 07:10:52 +0000 libthr pshared: correct a bug in allocation PR: 269277 (cherry picked from commit 25c862ae503a1c99458f4e055fd50c878fadbea3) --- lib/libthr/thread/thr_pshared.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/libthr/thread/thr_pshared.c b/lib/libthr/thread/thr_pshared.c index 56def22f9ab9..3f303d52c2de 100644 --- a/lib/libthr/thread/thr_pshared.c +++ b/lib/libthr/thread/thr_pshared.c @@ -227,11 +227,16 @@ __thr_pshared_offpage(void *key, int doalloc) int fd, ins_done; curthread = _get_curthread(); - pshared_rlock(curthread); - res = pshared_lookup(key); - pshared_unlock(curthread); - if (res != NULL) - return (res); + if (doalloc) { + pshared_destroy(curthread, key); + res = NULL; + } else { + pshared_rlock(curthread); + res = pshared_lookup(key); + pshared_unlock(curthread); + if (res != NULL) + return (res); + } fd = _umtx_op(NULL, UMTX_OP_SHM, doalloc ? UMTX_SHM_CREAT : UMTX_SHM_LOOKUP, key, NULL); if (fd == -1)