From patchwork Sat Jan 22 02:34:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgenii Stepanov X-Patchwork-Id: 12720400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61C2BC433F5 for ; Sat, 22 Jan 2022 02:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version: Message-Id:Date: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=/r0qANijHwJLRXR5a3EPLbowmWPqGoTcEuoWsLKx61s=; b=bde R+aJdp6PQ4jzIuQkJ0n/wfVbRpaVFBjirZ5BdwPT3C4d0vwVoijpAGjEK2zKgAjcsi5NWUKj1p4dM 0DANcLXD/PeCESh6ipOtgJ3f8w++e5VVwL4FMBvb6u+rWPO375FDVxl9n+rFzRb8IMyJKmmTsHopf WTMP1rtIOxi1GDW03hQ/DPXAmHAwUEhQ0JrAd9/tN14cc9BzA1W8i1BDiy74X9BrLJOv6HC6mrtJ/ v0hr7GIgIg3kI6T87lEe5cz2jrQRfT7CkPIuLyQCfnJM73b3zpVfLKWEWI/AVpHx+d+xV9tm/pqSu YWMcmZbN4zVRvntOmZEY7a4dVsJx8rw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nB6F2-00GPQg-Vm; Sat, 22 Jan 2022 02:35:01 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nB6Ez-00GPPh-Bs for linux-arm-kernel@lists.infradead.org; Sat, 22 Jan 2022 02:34:58 +0000 Received: by mail-yb1-xb49.google.com with SMTP id k189-20020a25c6c6000000b0061274ece35eso22782589ybf.22 for ; Fri, 21 Jan 2022 18:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=YL7R6m531ab4mu/nG0Py7+xJnaz+sbZ3l4YcriAUzsE=; b=A5olXp8/l8OAwPc22+ak6thOxleOy/R3vWMG8gDugaByRiJ/WGLSpyNLYqRo/cgVKJ yFKyzjxskrYCGwrIcrQouc3nhQ2bdE8i9R8AfVqCtqpql4C7GQ/H5JJbZR/eMqjVMfiF xCP2mtsGjFmG4xRxrFAtxRs6AECc/6TOINWftjlaFeZuDkCyp35MKeHHu1um49uUBdZQ yhIvl/DWlydR0a0lw0AKYynkImJy5IgRbrHEhybdaGJLoAJnoG5Truw3n4iLqdzvyqtR 5b8s7HlQU4SeYEyoAeNEXMPodAKVJtpMhkLiB9d403G+yhJLTJTrDi+M+Jg96ilftblc vlkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=YL7R6m531ab4mu/nG0Py7+xJnaz+sbZ3l4YcriAUzsE=; b=d1NU3LZeDHWFMvxXN1kfN69ZChS3mTSNc3GUTAFza/lsmkQ2tiweS8nYpTwwm8pWG1 axtZXWFLLUI8wc/+/VM0+2cbVr7nq8v9SsEEXS6bj39hpmEKlWG+fLA41VCggNXHEGZM a9KKNJtjwROXYNjWUMwBxV5+Mqd+UxMoUyXB72lxnWPxZURcGFbDKHVNHaIfxAPQYekZ KFOMdWVASye4Fq85zsC+JGnhfdp6MeiBYnZ8FIe5/6+8VG8OMMlNSvV1ZMvkbgzqEHZR GsADYAkf87ajCQ+s/ewFRj52X1cs63aakeE4i8+mqLiJCSShEzVle5itYxFXZGdCQJHv +WDQ== X-Gm-Message-State: AOAM5335c0v8uL5HcX8lm+9mRQXfi5hrKUGtni+EKFKiAvOngRPYEerJ R7rlCBsze82eL/yN5oSM9H2COJeX5L8j X-Google-Smtp-Source: ABdhPJxZ9V/Y7oCEiURnrv2nzu4eM4nXzJFXdSR6d6I73X2bDUwfe+PomkLFAeL5wQzyOC9gk2vQBaul8uoM X-Received: from eugenis.svl.corp.google.com ([2620:15c:2ce:200:794a:a42f:681b:1b61]) (user=eugenis job=sendgmr) by 2002:a5b:3c1:: with SMTP id t1mr9929040ybp.486.1642818893077; Fri, 21 Jan 2022 18:34:53 -0800 (PST) Date: Fri, 21 Jan 2022 18:34:47 -0800 Message-Id: <20220122023447.1480995-1-eugenis@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog Subject: [PATCH] arm64: extable: fix null deref in load_unaligned_zeropad. From: Evgenii Stepanov To: Catalin Marinas , Will Deacon , Mark Rutland , Ard Biesheuvel , Robin Murphy , Jisheng Zhang Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Evgenii Stepanov X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220121_183457_450172_154F7EDF X-CRM114-Status: GOOD ( 11.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 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 ex_handler_load_unaligned_zeropad extracts the source and data register numbers from the wrong field of the exception table. Fixes: 753b3236 Signed-off-by: Evgenii Stepanov Reviewed-by: Mark Rutland --- arch/arm64/mm/extable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/extable.c b/arch/arm64/mm/extable.c index c0181e60cc98..489455309695 100644 --- a/arch/arm64/mm/extable.c +++ b/arch/arm64/mm/extable.c @@ -40,8 +40,8 @@ static bool ex_handler_load_unaligned_zeropad(const struct exception_table_entry *ex, struct pt_regs *regs) { - int reg_data = FIELD_GET(EX_DATA_REG_DATA, ex->type); - int reg_addr = FIELD_GET(EX_DATA_REG_ADDR, ex->type); + int reg_data = FIELD_GET(EX_DATA_REG_DATA, ex->data); + int reg_addr = FIELD_GET(EX_DATA_REG_ADDR, ex->data); unsigned long data, addr, offset; addr = pt_regs_read_reg(regs, reg_addr);