From patchwork Tue Jun 11 14:56:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 166462 Delivered-To: patch@linaro.org Received: by 2002:ac9:2a84:0:0:0:0:0 with SMTP id p4csp4866179oca; Tue, 11 Jun 2019 07:56:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqylSeQYwtPDOlCjXGtUf6Q5R81mfw2sUuD+d+QrhtbqzWu6cbXksjkoaljSVgwvRZD3WqBj X-Received: by 2002:a17:902:21:: with SMTP id 30mr75424327pla.302.1560265000989; Tue, 11 Jun 2019 07:56:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560265000; cv=none; d=google.com; s=arc-20160816; b=eNRdLa/NzfOEX6bqWB6NY9FN1Q8jEsV5bUB4NfhiGxGcG/1EGKEBtnbNsOp9KvZsJk xG5u6Y96Yil8J0AE0jM/cna3SveyPyMhxmLBAifrNx7M2NgYQzCYambQTHr3wJGbFzr5 v5f5saq59c1E1v/iaDYGpvqRJ1OUNlvofTMB4t/rDg0NJW5PVxJQq3Z319i5I692sDyc 4pm9OE78Ti7TcGqh84OMTxdN9KLsUf4gKgHFKqtBJNC/pk0pKLswm0cWblkq1eLLNwEE XdD8dwpZhZkAI+SVAVr14jxzvNpf8fn+1tHzK87G9iYpVmB1qefKvVuTvvRa5X3VBKtR lkHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=BwezbQXLwb9/3r1iwZqsY8z2Y++D6mKh9hMZvIt2UOc=; b=tG5tfxy/2m702mdPOz0m6AwK/KAdpJhEOJBLPjP9tVpdHNcWZmv+X24coDj/JHTZmH zPQS3DRRAYTqCoDBhpXMH+U57FO4GQ304Q3Iz+lwUmd04ng7qDYoc9v+ecVbzdiLK1VV c1DQnpkpXaSPsasBQR3WgJs0/D6AhNwg17CC+mjg668Vccs+Vr0Qp9wX4MiDmcos9ZtU jNuFiZPKWrOO0gMFRi57QxGnQolGVv8HzyiUsdZRngKnCqA05dE81LcJwzVOTZB+7XHI qAxMSBjHMHVHbA3kuGhuXqv/Y2DYsz7a7NrKY0TGAtuNDihtM1yXIZDHJJSnj1smXlUs KZ2Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si4606850pgi.228.2019.06.11.07.56.40; Tue, 11 Jun 2019 07:56:40 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389384AbfFKO4j (ORCPT + 30 others); Tue, 11 Jun 2019 10:56:39 -0400 Received: from foss.arm.com ([217.140.110.172]:35194 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387887AbfFKO4j (ORCPT ); Tue, 11 Jun 2019 10:56:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A7FC3337; Tue, 11 Jun 2019 07:56:38 -0700 (PDT) Received: from usa.arm.com (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BB9203F246; Tue, 11 Jun 2019 07:56:36 -0700 (PDT) From: Sudeep Holla To: x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Catalin Marinas Cc: Sudeep Holla , Will Deacon , Oleg Nesterov , Thomas Gleixner , Richard Weinberger , jdike@addtoit.com, Steve Capper , Haibo Xu , Andy Lutomirski , Ingo Molnar , Borislav Petkov Subject: [PATCH v5 2/4] x86/entry: Simplify _TIF_SYSCALL_EMU handling Date: Tue, 11 Jun 2019 15:56:27 +0100 Message-Id: <20190611145627.23229-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190523090618.13410-3-sudeep.holla@arm.com> References: <20190523090618.13410-3-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The usage of emulated and _TIF_SYSCALL_EMU flags in syscall_trace_enter is more complicated than required. Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Borislav Petkov Acked-by: Oleg Nesterov Reviewed-by: Thomas Gleixner Signed-off-by: Sudeep Holla --- arch/x86/entry/common.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) Hi Catalin, I assume you can now pick up this patch. Regards, Sudeep v4->v5: Updated changelog as suggested by tglx and added his Reviewed-by -- 2.17.1 diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index a986b3c8294c..0a61705d62ec 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -72,23 +72,18 @@ static long syscall_trace_enter(struct pt_regs *regs) struct thread_info *ti = current_thread_info(); unsigned long ret = 0; - bool emulated = false; u32 work; if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) BUG_ON(regs != task_pt_regs(current)); - work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY; + work = READ_ONCE(ti->flags); - if (unlikely(work & _TIF_SYSCALL_EMU)) - emulated = true; - - if ((emulated || (work & _TIF_SYSCALL_TRACE)) && - tracehook_report_syscall_entry(regs)) - return -1L; - - if (emulated) - return -1L; + if (work & (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU)) { + ret = tracehook_report_syscall_entry(regs); + if (ret || (work & _TIF_SYSCALL_EMU)) + return -1L; + } #ifdef CONFIG_SECCOMP /*