Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp571959pxv; Thu, 22 Jul 2021 07:14:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEeqb+fKryW/i116tOPz/Mv8k1QFy15YE3z8t6ZMyo8j/ZqdQHyrTLxix57wBDsWIDeoeP X-Received: by 2002:a17:906:c182:: with SMTP id g2mr78758ejz.507.1626963297701; Thu, 22 Jul 2021 07:14:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626963297; cv=none; d=google.com; s=arc-20160816; b=z7epTI2S+JPm54+/4TCKNEI0+EgQFTjdkXRcOejw8lt6tFQH6/Ns959wSzGQLP5CUv 2XGRi8b/DXGg8JKExj+ZNvNvnjj8czqEDz14Q4S8BHIbIb0nTJCspbdNDpOO3PNg1Lh7 B+3nGAuB6HliRjJDtLiMC4TTalVuhYdfy5WXWOQ69nmHF+mrfGm3BFS67kcEssW1m+ub bAq/TS810PbNryXhaFfXGLF1dEv9xM0CF1B28la7ndxUFsXOwEdKcxPXgRDgp2AhkAH+ 6bbjD72hzb8WzsiHGVCYn3qMguPSXseRXTCiBDBdQdR9rY5T+exY4LIZ0A0PL9dEnvq8 7JaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hMZ+bPD0a2JR6fAEyZriF435upIu+1G5f1MnIyR9ZmE=; b=qChIOiNtlNye4fHo+j3Q/LkctRoHkEmp3GBaXOJVBUx8mIpgBCt+cBiLZcnIolpX2l bgi2g6Yi0cqi/1/wnpiQnFiYxCsxqdjYY0DhXH4jhRYmuOQdHPW2TiZeQoeQQMypq/Lm Zwd17+lAxzsR7qJwrOhcfbx6TU4AK1codUVGW6AYghiwbC3n5giXz9gsYNWzIac9HhxA DJeun6lz90KI8NlGB3xqsHlt7kQbe1mud2uhN++pFLv6WH4uR8HNBo4ynkTE6zGLzAb2 1RLjbUMG0shNIkcJ19uL3gpkzEEfurEJhLfyCKq1NHF1E4AHitxQQPnd8f+CdB6Z0nSi 7AvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jN3HspfS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si7174560ejd.638.2021.07.22.07.14.34; Thu, 22 Jul 2021 07:14:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jN3HspfS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232279AbhGVNbJ (ORCPT + 99 others); Thu, 22 Jul 2021 09:31:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:40518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232105AbhGVNbJ (ORCPT ); Thu, 22 Jul 2021 09:31:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9687C6128D; Thu, 22 Jul 2021 14:11:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626963104; bh=V+sLG4qAXAhb4gZ8Cas6iEjPeFVyhWhtpTlGXEov5Lg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jN3HspfSGQrcBDlVWnOQq3eXWx4ndzEz0xp2E9yZsR8SpacrmA5QoUbdA6hhl89mD zmJ74NCQojb5GKkcdVTrQEuFt3TqlT9st9AHgcrvqOWQ9OEY8EP4go0U/i0f+B1RgL V6uqIem/q9mWdBniNzOgU2c2VkABNKNIi9y8KQac= Date: Thu, 22 Jul 2021 16:11:41 +0200 From: Greg Kroah-Hartman To: Joe Korty Cc: Peter Zijlstra , Lee Jones , Steven Rostedt , Thomas Gleixner , Sebastian Andrzej Siewior , LKML Subject: Re: [BUG] 4.4.262: infinite loop in futex_unlock_pi (EAGAIN loop) Message-ID: References: <20210719162418.GA28003@zipoli.concurrent-rt.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210719162418.GA28003@zipoli.concurrent-rt.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 19, 2021 at 12:24:18PM -0400, Joe Korty wrote: > [BUG] 4.4.262: infinite loop in futex_unlock_pi (EAGAIN loop) > > [ replicator, attached ] > [ workaround patch that crudely clears the loop, attached ] > [ 4.4.256 does _not_ have this problem, 4.4.262 is known to have it ] > > When a certain, secure-site application is run on 4.4.262, it locks up and > is unkillable. Crash(8) and sysrq backtraces show that the application > is looping in the kernel in futex_unlock_pi. > > Between 4.4.256 and .257, 4.4 got this 4.12 patch backported into it: > > 73d786b ("[PATCH] futex: Rework inconsistent rt_mutex/futex_q state") > > This patch has the following comment: > > The only problem is that this breaks RT timeliness guarantees. That > is, consider the following scenario: > > T1 and T2 are both pinned to CPU0. prio(T2) > prio(T1) > > CPU0 > > T1 > lock_pi() > queue_me() <- Waiter is visible > > preemption > > T2 > unlock_pi() > loops with -EAGAIN forever > > Which is undesirable for PI primitives. Future patches will rectify > this. > > This describes the situation exactly. To prove, we developed a little > kernel patch that, on loop detection, puts a message into the kernel log for > just the first occurrence, keeps a count of the number of occurrences seen > since boot, and tries to break out of the loop via usleep_range(1000,1000). > Note that the patch is not really needed for replication. It merely shows, > by 'fixing' the problem, that it really is the EAGAIN loop that triggers > the lockup. > > Along with this patch, we submit a replicator. Running this replicator > with this patch, it can be seen that 4.4.256 does not have the problem. > 4.4.267 and the latest 4.4, 4.4.275, do. In addition, 4.9.274 (tested > w/o the patch) does not have the problem. > > >From this pattern there may be some futex fixup patch that was ported > back into 4.9 but failed to make it to 4.4. Odd, I can't seem to find anything that we missed. Can you dig to see if there is something that we need to do here so we can resolve this? thanks, greg k-h