From nobody Fri Jun 17 19:40:47 2022 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 2FDBB85D39D; Fri, 17 Jun 2022 19:40:49 +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 4LPqCM5QpMz3hZr; Fri, 17 Jun 2022 19:40:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494848; 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=FrofGFDJPz2f9LnVInreL5hDSvYvCi0tSjkJh0Dgvf4=; b=ZfWkYuzyy3X3ygfd9L5VzXaszYqLPB4H9xL8wDWC2XvYb9JVAcryJboC+dOG8eFjKP5cLD 1nVl+wGudowkFuJFUN+JfWeMLdwEyw55I6tQCy0BY63v39/CEBZzcGscozzP3ooWqnaCyj JfE53hhrqVze4sNTQbyLHk0RsQym61Ugsfa5s7BCCjpmN1oVbGCp0OKzEuabWZkdisgceQ KmPQkzxKJnizlkyrRReGRO3/hcVb3R6IyNsSAScN10VqQIWqMV2LmF46NgxKdQvusP0fEm RDo5M7sp3uuNo+99jf7yhF/OcIaKGTmvx7KcF4eMETuQnx496f/u403h7SqFfw== 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 399B325C6B; Fri, 17 Jun 2022 19:40:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 25HJelIS026271; Fri, 17 Jun 2022 19:40:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJeluO026270; Fri, 17 Jun 2022 19:40:47 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:40:47 GMT Message-Id: <202206171940.25HJeluO026270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: ba77290cceac - stable/13 - linux(4): Handle cas failure on ll/sc operations 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: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ba77290cceac3391aa4a3469725e093fb1366fe1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494848; 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=FrofGFDJPz2f9LnVInreL5hDSvYvCi0tSjkJh0Dgvf4=; b=cmcYI8lfitpII6EKKtUIB8X+tiCKgjjGbYk5SVL4K6TrixBUXpjIbpD2MFHBT5OAb3d6Vg d21a8fCdHlRWnJcaSiq5b0qn/yVIjvwlhKqPn/LDQtabFXGm9YOvZBKudMxX8AVRO0aw/K PcSAcm0Y1QAcGIGT2ibLwFMNq+7gBEbdjdBR3L7RZuwMQBqSqpF3m/90RC9gonLnLzwaY4 uSlZ23LDlmaWxaiEz8dNrMNZ54osCkkDrlR5ssLtBLnz+wh3+RGdotqnc6ngE5kVVVV5ev AcKMwBtpPQwhaK/E6Qb+gUge99PiuyYnLQctzdkGRP5lVU4k3INy/QI7MNcveA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494848; a=rsa-sha256; cv=none; b=hQ7NbkFOhAx9+IezB7YpwRKOJVQi7blmJvqXHGOl5PnElljHH0BElcn0D39bOmhvAIMhEw JMRe4gQh5QE94mWugq4GnqF5lgBEYEfBreMckQiGnlGa++cx0iRvgq/1c+tk5sEZl4ZYC1 aCw3O38+wph/iZjNKzraAczo3Spn9kO2hG5pXEWfFl+F2huJo0HM3TUyDlROkXJmHez40O 1D6duMID/HaqL8B0ZpEv33Rl6WEhStjg7e/dEIO1/mVZDO7Yl5zPQNsUIM0v7B8gntENEV 8aDpBkMT0DP5Y9Yg5QTn/1qd7QJub7VsXP/oTy3UyOKjD7UorGSFgFfQrNCWtw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=ba77290cceac3391aa4a3469725e093fb1366fe1 commit ba77290cceac3391aa4a3469725e093fb1366fe1 Author: Dmitry Chagin AuthorDate: 2022-05-19 16:52:18 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:35:25 +0000 linux(4): Handle cas failure on ll/sc operations Follow the 11a6ecd4. Check and handle the case when the ll/sc casu fails even when the compare succeeds. For more details PR/263825, https://reviews.freebsd.org/D35150. Obtained from: Andrew@ MFC after: 2 weeks (cherry picked from commit 2cd662064a0cd8d179cbb5a06378fce0ec458747) --- sys/compat/linux/linux_futex.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 6825d13e1aab..8bcdc378cf70 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -410,6 +410,17 @@ linux_futex_lock_pi(struct thread *td, bool try, struct linux_futex_args *args) break; } + /* + * Nobody owns it, but the acquire failed. This can happen + * with ll/sc atomic. + */ + if (owner == 0) { + error = thread_check_susp(td, true); + if (error != 0) + break; + continue; + } + /* * Avoid overwriting a possible error from sleep due * to the pending signal with suspension check result.