From mboxrd@z Thu Jan 1 00:00:00 1970 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=-4.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no 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 6D565C433E1 for ; Tue, 30 Jun 2020 19:50:33 +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 334B3206A1 for ; Tue, 30 Jun 2020 19:50:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qCzkE1BV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 334B3206A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.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:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=nW/guldvUhXd4kxSeq5FZhWz1e88PNXaMK1y/UTwihg=; b=qCzkE1BVqaBe2oCE+HHmYZGbFa xFpl2rsgXdwD3CmJladWroiuQ/T9wDmmsea4hOJofcL2H9gEKntWStWIcc+PoS020b5D+wpEY3IhA 4JJe1t876VKXjbjLXNchJceC5BG8muv7wWKmtNgaolctcKs0iYUKN7eEMmPR0ITuPZWdi4qvlKZ2q j0I8CAVP+2uQg7M/KjRfu+zLbwvbhfIpBTKGt7OmKFnFMcz0JQ11UscR6aq45OBKjNwpPBqH/fxtt cUvYIF6ThoCsX6XsPaneNlXgQ76mMmJMeCloefbJIhWbaqIy006QSTvw9uQmWwHmAa2rJRhympFhy T92+uk9g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqMFX-0002SN-K1; Tue, 30 Jun 2020 19:48:59 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqMFL-0002Nv-R7 for linux-arm-kernel@lists.infradead.org; Tue, 30 Jun 2020 19:48:49 +0000 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 4C47931B; Tue, 30 Jun 2020 12:48:43 -0700 (PDT) Received: from seattle-bionic.arm.com.Home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5819D3F73C; Tue, 30 Jun 2020 12:48:42 -0700 (PDT) From: Oliver Swede To: Will Deacon , Catalin Marinas Subject: [PATCH v4 00/14] arm64: Optimise and update memcpy, user copy and string routines Date: Tue, 30 Jun 2020 19:48:08 +0000 Message-Id: <20200630194822.1082-1-oli.swede@arm.com> X-Mailer: git-send-email 2.17.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200630_154848_028539_3061F89A X-CRM114-Status: GOOD ( 16.23 ) 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: Robin Murphy , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, This contains an update to the cortex-strings patchset: the correctness of the fixup routines are improved, with the aim being to return the exact number of remaining bytes for all copy sizes. To ensure they are exact - which the current fixups are not for some copy sizes and are off by a few byes - is an extension to the original intention of fixing an issue reported by an LTP run last year, where the fixup routine in v2 of this patchset (which was importing the cortex-strings memcpy implementation) would over-report the number of bytes that successfully copied. Version 3 addressed this but I later found some issues with the fixup correctness after further testing, and have partially re-written them here, and addressed some other behaviours of the copy algorithm. Comments welcome, Thanks Oliver v1: https://lore.kernel.org/linux-arm-kernel/cover.1571073960.git.robin.murphy@arm.com/ v2: https://lore.kernel.org/linux-arm-kernel/cover.1571421836.git.robin.murphy@arm.com/ v3: https://lore.kernel.org/linux-arm-kernel/20200514143227.605-1-oli.swede@arm.com/ Changes since v3: * Improves the accuracy of the fixups in response to issues that arose during futher testing * Accounts for faults on store instructions on systems with UAO enabled * Expands on comments detailing the implementation Changes since v2: * Adds Robin's separate patch that fixes a compilation issue with KProbes fixup [1] * Imports the most recent memcpy implementation by updating Sam's patch (and moves this patch to occur after the cortex-strings importing so that it's closer to the patches containing its corresponding fixups) * Uses the stack to preserve the initial parameters * Replaces the usercopy fixup routine in v2 with multiple longer fixups that each make use of the fault address to return the exact number of bytes that haven't yet copied. [1] https://lore.kernel.org/linux-arm-kernel/e70f7b9de7e601b9e4a6fedad8eaf64d304b1637.1571326276.git.robin.murphy@arm.com/ Oliver Swede (5): arm64: Store the arguments to copy_*_user on the stack arm64: Use additional memcpy macros and fixups arm64: Add fixup routines for usercopy load exceptions arm64: Add fixup routines for usercopy store exceptions arm64: Improve accuracy of fixup for UAO cases Robin Murphy (2): arm64: kprobes: Drop open-coded exception fixup arm64: Tidy up _asm_extable_faultaddr usage Sam Tebbs (7): arm64: Allow passing fault address to fixup handlers arm64: Import latest version of Cortex Strings' memcmp arm64: Import latest version of Cortex Strings' memmove arm64: Import latest version of Cortex Strings' strcmp arm64: Import latest version of Cortex Strings' strlen arm64: Import latest version of Cortex Strings' strncmp arm64: Import latest optimization of memcpy arch/arm64/include/asm/alternative.h | 36 --- arch/arm64/include/asm/assembler.h | 13 + arch/arm64/include/asm/extable.h | 10 +- arch/arm64/kernel/probes/kprobes.c | 7 - arch/arm64/lib/copy_from_user.S | 272 +++++++++++++++-- arch/arm64/lib/copy_in_user.S | 287 ++++++++++++++++-- arch/arm64/lib/copy_template.S | 377 +++++++++++++---------- arch/arm64/lib/copy_template_user.S | 50 ++++ arch/arm64/lib/copy_to_user.S | 273 +++++++++++++++-- arch/arm64/lib/copy_user_fixup.S | 433 +++++++++++++++++++++++++++ arch/arm64/lib/memcmp.S | 333 ++++++++------------ arch/arm64/lib/memcpy.S | 127 ++++++-- arch/arm64/lib/memmove.S | 232 +++++--------- arch/arm64/lib/strcmp.S | 272 +++++++---------- arch/arm64/lib/strlen.S | 247 ++++++++++----- arch/arm64/lib/strncmp.S | 363 ++++++++++------------ arch/arm64/mm/extable.c | 13 +- arch/arm64/mm/fault.c | 2 +- 18 files changed, 2228 insertions(+), 1119 deletions(-) create mode 100644 arch/arm64/lib/copy_template_user.S create mode 100644 arch/arm64/lib/copy_user_fixup.S -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel