From patchwork Wed Jul 12 14:44:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9836869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 01FDC60363 for ; Wed, 12 Jul 2017 14:45:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7039204C1 for ; Wed, 12 Jul 2017 14:45:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA86C284FF; Wed, 12 Jul 2017 14:45:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id E5AC0204C1 for ; Wed, 12 Jul 2017 14:45:34 +0000 (UTC) Received: (qmail 1506 invoked by uid 550); 12 Jul 2017 14:45:16 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 32182 invoked from network); 12 Jul 2017 14:45:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s5MtTZWC8YlaS45CYOUb6uhjmlS0k6naCIE2hg54y0I=; b=bAHvAb9xxFir97Muvv7oSJe7SNEu1KgeKLb3o/ujYTfFd+txJwP5iZgYJrYbVnuNyu pKi8PtcBlktY38UM9JW7rzU/p84NfNQ2KO66I3K91Z6pFTUpwXnEaczPS/YZuMGhFoLH ndVivkP8WvaiqHAKXR7BA3S1L1x+qJIgM+t8Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=s5MtTZWC8YlaS45CYOUb6uhjmlS0k6naCIE2hg54y0I=; b=umtgWOtMfCmGKC0QqgOvvHegdLo9o6IXJY634BH3s4XISJfKrPTG/K3YjWWYs8UQBO T8IobZa+VETT1afDAOUbu84B9DT0awcmuEmp+74sc0IVoACTIm71m8nB6ObQ0Cgyj7y/ cw/J0Q4he0/luzjwGzUdPTV+CFSe90AigzKNMc0Uwr1+NajF0X5OTwqJck/UwnJkHWkj B+ml2SZ6+0siK9A7iENPWo2oaqOUwrvdt7JUT3wCISq4BfiJp+SjkXxKiN11ra1tV0Vb fIz17o4sDayi37pME57TNY86hXn6y/QVxUvtk45v7paPxwS7tNlTIb1RAaaBDXC9yqGc kjsg== X-Gm-Message-State: AIVw1109sykq6dNUcRJUi+flin6XcaJS8C+GDrEZtQilE46jaT5GD8jU RnqOI7jtrmCRmFvw X-Received: by 10.28.125.3 with SMTP id y3mr2986146wmc.31.1499870696950; Wed, 12 Jul 2017 07:44:56 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com Cc: mark.rutland@arm.com, labbott@fedoraproject.org, will.deacon@arm.com, dave.martin@arm.com, catalin.marinas@arm.com, Ard Biesheuvel Date: Wed, 12 Jul 2017 15:44:15 +0100 Message-Id: <20170712144424.19528-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170712144424.19528-1-ard.biesheuvel@linaro.org> References: <20170712144424.19528-1-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [RFC PATCH 02/10] arm64/lib: copy_page: avoid x18 register in assembler code X-Virus-Scanned: ClamAV using ClamSMTP Register x18 will no longer be used as a caller save register in the future, so stop using it in the copy_page() code. Signed-off-by: Ard Biesheuvel --- arch/arm64/lib/copy_page.S | 38 ++++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/arch/arm64/lib/copy_page.S b/arch/arm64/lib/copy_page.S index 076c43715e64..ba84a992b362 100644 --- a/arch/arm64/lib/copy_page.S +++ b/arch/arm64/lib/copy_page.S @@ -45,45 +45,45 @@ alternative_else_nop_endif ldp x14, x15, [x1, #96] ldp x16, x17, [x1, #112] - mov x18, #(PAGE_SIZE - 128) + add x0, x0, #256 add x1, x1, #128 1: - subs x18, x18, #128 + tst x0, #(PAGE_SIZE - 1) alternative_if ARM64_HAS_NO_HW_PREFETCH prfm pldl1strm, [x1, #384] alternative_else_nop_endif - stnp x2, x3, [x0] + stnp x2, x3, [x0, #-256] ldp x2, x3, [x1] - stnp x4, x5, [x0, #16] + stnp x4, x5, [x0, #-240] ldp x4, x5, [x1, #16] - stnp x6, x7, [x0, #32] + stnp x6, x7, [x0, #-224] ldp x6, x7, [x1, #32] - stnp x8, x9, [x0, #48] + stnp x8, x9, [x0, #-208] ldp x8, x9, [x1, #48] - stnp x10, x11, [x0, #64] + stnp x10, x11, [x0, #-192] ldp x10, x11, [x1, #64] - stnp x12, x13, [x0, #80] + stnp x12, x13, [x0, #-176] ldp x12, x13, [x1, #80] - stnp x14, x15, [x0, #96] + stnp x14, x15, [x0, #-160] ldp x14, x15, [x1, #96] - stnp x16, x17, [x0, #112] + stnp x16, x17, [x0, #-144] ldp x16, x17, [x1, #112] add x0, x0, #128 add x1, x1, #128 - b.gt 1b + b.ne 1b - stnp x2, x3, [x0] - stnp x4, x5, [x0, #16] - stnp x6, x7, [x0, #32] - stnp x8, x9, [x0, #48] - stnp x10, x11, [x0, #64] - stnp x12, x13, [x0, #80] - stnp x14, x15, [x0, #96] - stnp x16, x17, [x0, #112] + stnp x2, x3, [x0, #-256] + stnp x4, x5, [x0, #-240] + stnp x6, x7, [x0, #-224] + stnp x8, x9, [x0, #-208] + stnp x10, x11, [x0, #-192] + stnp x12, x13, [x0, #-176] + stnp x14, x15, [x0, #-160] + stnp x16, x17, [x0, #-144] ret ENDPROC(copy_page)