From patchwork Thu Oct 29 16:11:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 11866745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22BBAC55179 for ; Thu, 29 Oct 2020 16:11:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8B87B20838 for ; Thu, 29 Oct 2020 16:11:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tysw2UEy"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="JVxM8AsO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B87B20838 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:Date:Message-ID:Subject:From:To:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=qrWwiiu7uxHsT4pvBWEPlqe4kyCvvDBNN1AE3EP62Zw=; b=tysw2UEyIHFrHeXO/kGkm1mJA0 H3vby3fNX8yHKJeffN0NTeIFycaKNF31Rl5A9MzYdDT0vUt8zEuvZW3+mkq0vgU1Kf3ocvjKZrPx3 z4EmYxkpVmJrgGi/NUroIHI5qvzZ0nxpYziHqKW7apky2z2Zw+e8pLLV5tOa+6Vq2+5h/nTP6q2ei PXoR+RGN+U16hVLCAthBivoW/DQj/oFH7IYQBfKiJQLWp7z6gvG5kypMnsvgjOc8agH18El8YKoSk K+YZMcFcQVs2mbwDm8Q/WWR3n7BUfqmYGEWHSX44jdyQH+/qvsYzAoJVas32twPijnYIExPsoco35 mc9ykB7w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYAW9-0000mx-Te; Thu, 29 Oct 2020 16:11:13 +0000 Received: from mail-il1-x144.google.com ([2607:f8b0:4864:20::144]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYAW7-0000m2-DI for linux-arm-kernel@lists.infradead.org; Thu, 29 Oct 2020 16:11:12 +0000 Received: by mail-il1-x144.google.com with SMTP id k6so3616849ilq.2 for ; Thu, 29 Oct 2020 09:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=inqGqac6Tmktrm9Jtf9ly87fKAGgV9GX8FGoC4M0c+A=; b=JVxM8AsOnTq5KB9N1q/nRGw45wmCgWSTZD6X9mOVu8r6L18kyoO2bo6EUH0bghbpkx J3bI4NGibqq8LxKrEzuKoROWkZEipvivAgenVHyP98XLTGYip4BxR01z21HvfCIijYXa qoKo/ImLY9gLAWbVL/vJNQYGzi7Y5dGFILlVt+zH6uH06yKhvCQJizqn6IqFuVyZ1dik ERybN/3cjKFscum598iYK9mgDzf8cnelBJr/aqHicsieMR9D4r2W2KbAjhdD1bj1M70Z PCBMdVKdyBiHTjw+mLxVCOyueMD2IQ75QGdhPXSmFajEgRHV5gLI09wzWEHlEucKlaV2 4Caw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=inqGqac6Tmktrm9Jtf9ly87fKAGgV9GX8FGoC4M0c+A=; b=NBWlg6ozzWLM2MBRFraVebtjHwXw/MrEsoCNsUwnphsT7dH8svqBfw+b4DhEnrQ/7s oUWF9SivWXm932ENRzKftCx0LDs8mWLAieOBB4Oh+ZDWlIXgq1NrJ/rkOkuiynVU/j3R yDAMqq7S0Co3upholbtEJWUzT0j7sD7cUWV0TbDJUG2DZGvr1yDLTq5OC2h4Tw0hi05e OsnF/s5ZXcAd461IDmnzpwVe9Z3GFtXNaUgBUTW3SZSPj8RmTKqOZofxeyxsFAuMZ7yG j6chZ2hKyCeify5FBiVC0edWjsTc4Llk1o+eoQGW1YvSBg3fVzR+T5Q5yI0dGnwQ2hsw yHyQ== X-Gm-Message-State: AOAM533nVpOqxgr8PRa4I3zQtoERlyttvdjvjlR+qI4spSQGDClNXHmm tXe6OaOoa6wDommb3W5TVJinVwGBrdSJDg== X-Google-Smtp-Source: ABdhPJz576D4pSqcV57/p9DzjGKntna9r4QSkF7F5X+29z/F/mcs/2sNkp+lJnQ0N9IEKpwLBnbx2g== X-Received: by 2002:a92:3408:: with SMTP id b8mr4147108ila.78.1603987868897; Thu, 29 Oct 2020 09:11:08 -0700 (PDT) Received: from [192.168.1.30] ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id j3sm2674863ilq.85.2020.10.29.09.11.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Oct 2020 09:11:08 -0700 (PDT) To: "linux-arm-kernel@lists.infradead.org" From: Jens Axboe Subject: [PATCH] arm: add support for TIF_NOTIFY_SIGNAL Message-ID: <3c1ebfa5-38d9-e6b2-fcf7-d8b17c0fa515@kernel.dk> Date: Thu, 29 Oct 2020 10:11:07 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201029_121111_471787_EB74CC83 X-CRM114-Status: GOOD ( 19.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Wire up TIF_NOTIFY_SIGNAL handling for arm. Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Jens Axboe Acked-by: Russell King --- 5.11 has support queued up for TIF_NOTIFY_SIGNAL, see this posting for details: https://lore.kernel.org/io-uring/20201026203230.386348-1-axboe@kernel.dk/ As part of that work, I'm adding TIF_NOTIFY_SIGNAL support to all archs, as that will enable a set of cleanups once all of them support it. This needs a bit of asm help, immediate doesn't like anything outside of 1 byte, it seems. Any clues? arch/arm/include/asm/thread_info.h | 5 ++++- arch/arm/kernel/entry-common.S | 9 ++++++--- arch/arm/kernel/signal.c | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index 536b6b979f63..fec16d770180 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h @@ -135,6 +135,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, #define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */ #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */ #define TIF_SECCOMP 7 /* seccomp syscall filtering active */ +#define TIF_NOTIFY_SIGNAL 8 /* signal notifications exist */ #define TIF_USING_IWMMXT 17 #define TIF_MEMDIE 18 /* is terminating due to OOM killer */ @@ -148,6 +149,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) #define _TIF_SECCOMP (1 << TIF_SECCOMP) +#define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) #define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) /* Checks for any syscall work in entry-common.S */ @@ -158,7 +160,8 @@ extern int vfp_restore_user_hwstate(struct user_vfp *, * Change these and you break ASM code in entry-common.S */ #define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \ - _TIF_NOTIFY_RESUME | _TIF_UPROBE) + _TIF_NOTIFY_RESUME | _TIF_UPROBE | \ + _TIF_NOTIFY_SIGNAL) #endif /* __KERNEL__ */ #endif /* __ASM_ARM_THREAD_INFO_H */ diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index 271cb8a1eba1..7485b58673b4 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -53,7 +53,8 @@ __ret_fast_syscall: cmp r2, #TASK_SIZE blne addr_limit_check_failed ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing - tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK + ldr r2, =#_TIF_SYSCALL_WORK | _TIF_WORK_MASK + tst r1, r2 bne fast_work_pending @@ -90,7 +91,8 @@ __ret_fast_syscall: cmp r2, #TASK_SIZE blne addr_limit_check_failed ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing - tst r1, #_TIF_SYSCALL_WORK | _TIF_WORK_MASK + ldr r2, =#_TIF_SYSCALL_WORK | _TIF_WORK_MASK + tst r1, r2 beq no_work_pending UNWIND(.fnend ) ENDPROC(ret_fast_syscall) @@ -131,7 +133,8 @@ ENTRY(ret_to_user_from_irq) cmp r2, #TASK_SIZE blne addr_limit_check_failed ldr r1, [tsk, #TI_FLAGS] - tst r1, #_TIF_WORK_MASK + ldr r2, =#_TIF_WORK_MASK + tst r1, r2 bne slow_work_pending no_work_pending: asm_trace_hardirqs_on save = 0 diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 585edbfccf6d..9d2e916121be 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c @@ -655,7 +655,7 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall) if (unlikely(!user_mode(regs))) return 0; local_irq_enable(); - if (thread_flags & _TIF_SIGPENDING) { + if (thread_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) { int restart = do_signal(regs, syscall); if (unlikely(restart)) { /*