From patchwork Tue May 26 18:54:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 225336 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, 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 3F04FC433E1 for ; Tue, 26 May 2020 19:15:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 143FD214F1 for ; Tue, 26 May 2020 19:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590520510; bh=dx72DlEhizNWX/XIZA22NubdAcBm3H7jRg6ps1o/qVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=a+PVM2usvn+mxeU9yirYtl1PXYRBVmZondGFiYXmYdHWmybZ3sAS0NTafI2k9EAlK 1FrSXRQHPgSQ/8yDQN3cMNZy7khTc1bYXZFSVPy4LYX1oXn1D+TUxXIhjb2tto8EzJ +/M88WrtabBT1HA2Owxewpg+7wCtA2DHCwskowU0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404020AbgEZTPJ (ORCPT ); Tue, 26 May 2020 15:15:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:46584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392251AbgEZTPI (ORCPT ); Tue, 26 May 2020 15:15:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BA108208A7; Tue, 26 May 2020 19:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1590520508; bh=dx72DlEhizNWX/XIZA22NubdAcBm3H7jRg6ps1o/qVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vWn0ogPYS0qPCmq25pkcGUETJUbN415O3HG1jLRgEANXqg/vPoP7zYuyoMvBG7T91 dDywiQZsRp3M3jzp8N+SQz2uawsmj3/M0NdNhfp1o9gfxmSfiUdII3XPLJX/X8j7eP P6ccYIbFxGG3bUmFVK3/1QXwf1C6fy6HCXX5OXJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gerald Schaefer , Philipp Rudo , Vasily Gorbik Subject: [PATCH 5.6 106/126] s390/kaslr: add support for R_390_JMP_SLOT relocation type Date: Tue, 26 May 2020 20:54:03 +0200 Message-Id: <20200526183946.546777067@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200526183937.471379031@linuxfoundation.org> References: <20200526183937.471379031@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Gerald Schaefer commit 4c1cbcbd6c56c79de2c07159be4f55386bb0bef2 upstream. With certain kernel configurations, the R_390_JMP_SLOT relocation type might be generated, which is not expected by the KASLR relocation code, and the kernel stops with the message "Unknown relocation type". This was found with a zfcpdump kernel config, where CONFIG_MODULES=n and CONFIG_VFIO=n. In that case, symbol_get() is used on undefined __weak symbols in virt/kvm/vfio.c, which results in the generation of R_390_JMP_SLOT relocation types. Fix this by handling R_390_JMP_SLOT similar to R_390_GLOB_DAT. Fixes: 805bc0bc238f ("s390/kernel: build a relocatable kernel") Cc: # v5.2+ Signed-off-by: Gerald Schaefer Reviewed-by: Philipp Rudo Signed-off-by: Vasily Gorbik Signed-off-by: Greg Kroah-Hartman --- arch/s390/kernel/machine_kexec_reloc.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/s390/kernel/machine_kexec_reloc.c +++ b/arch/s390/kernel/machine_kexec_reloc.c @@ -28,6 +28,7 @@ int arch_kexec_do_relocs(int r_type, voi break; case R_390_64: /* Direct 64 bit. */ case R_390_GLOB_DAT: + case R_390_JMP_SLOT: *(u64 *)loc = val; break; case R_390_PC16: /* PC relative 16 bit. */