From patchwork Tue Nov 10 22:20:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11895721 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,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_GIT 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 52F87C4742C for ; Tue, 10 Nov 2020 22:34:37 +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 CB6972068D for ; Tue, 10 Nov 2020 22:34:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QmE7m7kZ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="ljjlpu85" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CB6972068D Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com 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:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4RZ41Q75Du3qLh4lvMdHmQetXjue8QcrnYR9mb3CmWg=; b=QmE7m7kZtR/yissvKtmDklKFR 9dqq/6qv5X7SORF3dSX1b1MbgDlpAaBXEbVYN2Q9zW0Ja4emfi3otR5MGn152d5/wqB5Cdi3lEpmQ TbhvbslsjkUwjKVaaNtCs+38WNUFZtRetZbMUwJsxfvZGmWmeyUxMMKvILIw/w9l1A9Q2CvuIlTeR ISJ87y17MLm8p7s1Icv2CX7CZ1sfWm74duKUxvt6vaA2xPBpf4pJ5SHyXY7ue3+Ap0xYk9Uc1+87b vJkNc17eTgauu4qFXZqPpbLpuwt9HqYXsqPz+VjFT97sHpA1voHsGKb26+WVEtQdfUr+LibrXV+u+ fGF7hWlXA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kccD7-00069l-H3; Tue, 10 Nov 2020 22:33:57 +0000 Received: from mail-wr1-x44a.google.com ([2a00:1450:4864:20::44a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcc0O-0000Ho-T3 for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 22:21:00 +0000 Received: by mail-wr1-x44a.google.com with SMTP id 67so6236110wra.2 for ; Tue, 10 Nov 2020 14:20:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=gyGUZGx6qFH2jkAU5L1Nk+VZLXl2e4B3h6WrDO5AJuc=; b=ljjlpu8510giM6ompwxwC9fW/XdFC8qbLxu53fZ6U03b6EYiKpJWB0pnDuMqHGR+jN r5TObzaeFfHiWBeyCqwixdqdi5C/59498RU2S9dfH8AcpG/uescXFFAI4vk1MFIFdUxs aKXAW+Igl/dpH9QlRqyELk9F5/tXGDupazh551//E9tyUg+sj67imZtPjKwh90Ayg1OS vnltrTuRHfB3/tkF78B29cR78uIqwsQ9sGY6GIW8WBL94NHckeVhPN4/F3EutOAkS+Ln 5/kQaGmI93yINQy4OgjBA4Oz+orNqVJURp3LVEBZBzBxMrSgh386MQ6eowcq/tXep6fs h8og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=gyGUZGx6qFH2jkAU5L1Nk+VZLXl2e4B3h6WrDO5AJuc=; b=ZYw3pY/N2QvtRyuQ1+0gy50W6zPQyIO/84xHBO4fkmWINzEO8cC3iCFGO+fI4zUyOF 6dasP5b95O14LZIXnYegsY4l9z5Ciz4/tR1XBnwR0mg4++tK3bgGwhp973dd79RMr/+S mcRlJj2rXmSDe1vGkBPlvdRBC1yxwDOo6/9DcqIGW75VW4xFmx/GrP/QWnLYrf0V9bEb 0GNsN197htnlf627ZhCkFTbXPIozInjh89inQ7E+paCSlxRABFO/yZ/uilAIJboiWSbu jeTn5nMrE8XdlP9D8FJ7Kryvji9X/qpkGl+vN35V8rWZTrsjUNz1LprVeQKQLZBrhKYy yp1Q== X-Gm-Message-State: AOAM533VQHId7JYtBRc83mADGV7liyUkyHQCXvXhno+SBfyw6udNtadH FOl7/oYXWGUdVWVtqluT5ea3+WkhGhrPYY4q X-Google-Smtp-Source: ABdhPJwekepriFSyzIoCXRNKCGpvFiq2NnAR4bAyn052jaQHzEPlcFfRQSyz8Y0DdueqyddIpnCAMwTZ+WqCAiQP X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:a5d:630b:: with SMTP id i11mr5840517wru.404.1605046843285; Tue, 10 Nov 2020 14:20:43 -0800 (PST) Date: Tue, 10 Nov 2020 23:20:10 +0100 In-Reply-To: Message-Id: <462c375f39ba8c4c105b3a9bf3b5db17f3720159.1605046662.git.andreyknvl@google.com> Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.222.g5d2a92d10f8-goog Subject: [PATCH v2 06/20] kasan: remove __kasan_unpoison_stack From: Andrey Konovalov To: Dmitry Vyukov , Alexander Potapenko , Marco Elver X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_172049_948907_AF90542D X-CRM114-Status: GOOD ( 12.37 ) 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: , Cc: Branislav Rankov , Catalin Marinas , Kevin Brodsky , Will Deacon , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, Andrey Konovalov , Andrey Ryabinin , Andrew Morton , Vincenzo Frascino , Evgenii Stepanov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There's no need for __kasan_unpoison_stack() helper, as it's only currently used in a single place. Removing it also removes unneeded arithmetic. No functional changes. Signed-off-by: Andrey Konovalov Reviewed-by: Dmitry Vyukov Link: https://linux-review.googlesource.com/id/Ie5ba549d445292fe629b4a96735e4034957bcc50 Reviewed-by: Marco Elver --- mm/kasan/common.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index a3e67d49b893..9008fc6b0810 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -59,18 +59,12 @@ void kasan_disable_current(void) #endif /* CONFIG_KASAN_GENERIC || CONFIG_KASAN_SW_TAGS */ #if CONFIG_KASAN_STACK -static void __kasan_unpoison_stack(struct task_struct *task, const void *sp) -{ - void *base = task_stack_page(task); - size_t size = sp - base; - - kasan_unpoison_memory(base, size); -} - /* Unpoison the entire stack for a task. */ void kasan_unpoison_task_stack(struct task_struct *task) { - __kasan_unpoison_stack(task, task_stack_page(task) + THREAD_SIZE); + void *base = task_stack_page(task); + + kasan_unpoison_memory(base, THREAD_SIZE); } /* Unpoison the stack for the current task beyond a watermark sp value. */