Received: by 10.223.185.116 with SMTP id b49csp3152317wrg; Sun, 25 Feb 2018 15:22:36 -0800 (PST) X-Google-Smtp-Source: AH8x227e2+V7lIutRiaibppWcDSIRZmq9jzmj60Sp+i1X9pZcqs9QexGFHPzULay5VmeYgqYtk+P X-Received: by 2002:a17:902:bd94:: with SMTP id q20-v6mr8703055pls.247.1519600955896; Sun, 25 Feb 2018 15:22:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519600955; cv=none; d=google.com; s=arc-20160816; b=g5HkK4FCD7MLPy/SaCtW1N7P3iXNJKIRkCXzpT/0oyX0hWRXjSo/ftJ/s1IfSJUnBG 0nP49PU3UDmT3jYBrskUUFgC90QA81VZ5CSG6im6IsTJH3o6u7mTtthdAfgDwsVmrGxT J7i4YlZu5PzMlFyQS1KbbaCm5gA3q+dxehB+SHPu62ndSRpQX1agfKopzSXdeYuFcHM9 7/iquAYYsApPH+FObStdgqj/gx5Z6nl59TP2JlX7xlN1j6AWcvzrUDNlDo/TnNEVaji5 JviZfXKORXT/rPwLFshzNgJ3dPzXgXXXFVYmzPSKydSax9oBeLEym6eiOgQhW1/bUbf5 sbJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=8o9hL21uhNnSMv3mudd8IcNZb+Df6066ppXGE9L94sQ=; b=dOfVPMx18AxBPtqwZSgIsfxkaMMrmBVVeG6WUh0mvRhucMTYz6QhG3n184SWhjqTcg 8shVElJiLNLZDwCD5AooiOiqDEa5ZfO3/FngwwXC2+42+JnBTH9HFBg6hFX/zkhAoh3V AvYCMC5jt1FuybJ3DOtLqNphxTm0ATgjnNepuJoSuGqEkE3wScrx9Jsi8ul9XNvxdwue Gatd/rRU/yUBEYvTZ+mlYaCxpeb8fzGn1f6i4VmVBYPjBv550TgriVt0RvmDJaDFBlHY c7LocMTR0lsRUm5GAmFzXr20O9cw6vpIWAEs3YAdBAzL96JYv64lINV+gWihUc8g2t7C xTUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pzb4QiwR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8si531036pfa.203.2018.02.25.15.21.49; Sun, 25 Feb 2018 15:22:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pzb4QiwR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751947AbeBYXUN (ORCPT + 99 others); Sun, 25 Feb 2018 18:20:13 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37923 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751738AbeBYXUE (ORCPT ); Sun, 25 Feb 2018 18:20:04 -0500 Received: by mail-pf0-f194.google.com with SMTP id d26so5773534pfn.5; Sun, 25 Feb 2018 15:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8o9hL21uhNnSMv3mudd8IcNZb+Df6066ppXGE9L94sQ=; b=pzb4QiwR9166rkIi9j6ollZhquDNhORP/JIh6otG/HOkuxy5+Xy69hIwTxdAJpAc/e /eaeQLeoR/dIngxnr/WEAOygwVZyLEhIpAsBudoYrcRNhcdtqtbny0ISBbQIBMhQr2YN 4qDoM5SwmOvP/K4+aVaWgU5aPnpgoc3aJpTZTVxxBK46ajG47IShe/xFhxX/SVYvX5x9 UvkbcZUM92nYSksb7T/gYPfJ/F0TQcdvGCgVBzj+LakUNLTc4s/F8oR14hlh4tfvWMTK Ugs+tCnArYsUgllLa/lqw7rK7NIBOmAqhCe8hMsGDTq05pPBRIcwz2DXdpv8XmLRtgjr Nlfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8o9hL21uhNnSMv3mudd8IcNZb+Df6066ppXGE9L94sQ=; b=jVq1Ifzm0GWV4bI1FjHF2xZZyUYp1szBpKl5zpoOKBLTMeGZrMy34oLDGA3WFCBbrj gPfn9M8ztCzFaqSDfM1/3frNzfgpcdErawu5djYJR62vrrcVJh0anTE1Er32DwIWDglS 1NlKqfEl9aEXbEp5a82O0Pm7GCZxRRUWM2ynqgVr4UiK8i1qV6j/Dy72Z+FpY5NybJTu WKdVQ8mLoWcele6x7ODYI2sQMIUYaGjha7/3iSSvSakvc+iU/e1fGmt1RTG3PdARZocT 9dl8BVV0AwcqKc+cxZBRqmVRvfrEq96eW1X1kmslxfJ5rxXBGgqL7nomyvWzzwG2Ft0U 0OUA== X-Gm-Message-State: APf1xPD6bup5FCXVN7tAYgz1Nmkwfej29DS6ewhPMqjGretu879/6EPW rsRw8U7+t7SJ1Gra1fXyexM= X-Received: by 10.98.36.25 with SMTP id r25mr8718096pfj.106.1519600803565; Sun, 25 Feb 2018 15:20:03 -0800 (PST) Received: from balbir.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id m80sm16566609pfj.163.2018.02.25.15.19.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 25 Feb 2018 15:20:03 -0800 (PST) Date: Mon, 26 Feb 2018 10:19:51 +1100 From: Balbir Singh To: Ram Pai Cc: shuahkh@osg.samsung.com, linux-kselftest@vger.kernel.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, akpm@linux-foundation.org, dave.hansen@intel.com, benh@kernel.crashing.org, paulus@samba.org, khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, hbabu@us.ibm.com, mhocko@kernel.org, bauerman@linux.vnet.ibm.com, ebiederm@xmission.com, arnd@arndb.de Subject: Re: [PATCH v12 22/22] selftests/vm: Fix deadlock in protection_keys.c Message-ID: <20180226101951.0136f963@balbir.ozlabs.ibm.com> In-Reply-To: <1519264541-7621-23-git-send-email-linuxram@us.ibm.com> References: <1519264541-7621-1-git-send-email-linuxram@us.ibm.com> <1519264541-7621-23-git-send-email-linuxram@us.ibm.com> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 21 Feb 2018 17:55:41 -0800 Ram Pai wrote: > From: Thiago Jung Bauermann > > The sig_chld() handler calls dprintf2() taking care of setting > dprint_in_signal so that sigsafe_printf() won't call printf(). > Unfortunately, this precaution is is negated by dprintf_level(), which > has a call to fflush(). > fflush() is not the signal-safe function list, so this makes sense. I wonder if fflush() is needed in sigsafe_printf()? How about? diff --git a/tools/testing/selftests/x86/pkey-helpers.h b/tools/testing/selftests/x86/pkey-helpers.h index b3cb7670e026..2c3b39851f10 100644 --- a/tools/testing/selftests/x86/pkey-helpers.h +++ b/tools/testing/selftests/x86/pkey-helpers.h @@ -29,6 +29,7 @@ static inline void sigsafe_printf(const char *format, ...) va_start(ap, format); if (!dprint_in_signal) { vprintf(format, ap); + fflush(NULL); \ } else { int ret; int len = vsnprintf(dprint_in_signal_buffer, @@ -49,7 +50,6 @@ static inline void sigsafe_printf(const char *format, ...) #define dprintf_level(level, args...) do { \ if (level <= DEBUG_LEVEL) \ sigsafe_printf(args); \ - fflush(NULL); \ } while (0) #define dprintf0(args...) dprintf_level(0, args) #define dprintf1(args...) dprintf_level(1, args) But both are equivalent I guess, so Acked-by: Balbir Singh