Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1835379imm; Mon, 3 Sep 2018 10:39:45 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZR1h8+GyqpbE45ve++N+DW+z3eavcKwNamG//PeJ0lUZ+jHipmaZJW6qBDZ/Zq0S8w92QL X-Received: by 2002:a17:902:14e:: with SMTP id 72-v6mr29193014plb.299.1535996385183; Mon, 03 Sep 2018 10:39:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535996385; cv=none; d=google.com; s=arc-20160816; b=R/ytXyzUanb27qrWWwclCeOsE0VGwnT1rzcrgBrZAC4qhZToYpMHz4xx38K9XXHTTV Sn469g0PTGuECVsEjFJwFLl0RGI/BPAPiv9kc21viwY9M1pdgLXjO5m9UhvlmkffiXva YbgQAACJ/VK2u/Kbpfpp7SffVMxNTF4HqgrTiLo6QUda5cbAdWrTTWU1qLDOwQc6Kwg8 92XOXz4iP6ZGnYwgMrXCoY+7t0J+pVdgPjEdT0au8pldXj+xVzRKgoy+rOwSGbBYKD44 CWZYYL4yYO0QPRgzcmbPID1G169kmLiRaLoNP+jpho0vuh/nndUlqALS18Sm34/1aXqn 6LdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Kxmnsqg2y8OyQ1QZgdiaKDejVRjht1U7HNwXUutEk2Q=; b=wKVGF3TpWxKm4UMiLhHIr/w01y2vneVwEnBqgsqKyudcLlSM482XZ3DfFbwjCbIQek xVHjHUgXPHdfVjlr3RZy9znPgd3VYD2TCiMaJYO0ZH+SLejgKBNpZE17tiF9XS3MV5DU 8yZBaLT/dGvZCxmwNU7vDWU7VxHivgXNANoPohStW3jJBiKiyHHj3PDCP4lBGgMUW+wI DV7cQvyqQn+EMovP30oTmKN7V+YrkECWtwr4AgbLHgkzbkzjNKkgX+V8FVZtUgpFsxdt 8cZ2t1tl1vKzlfHN3oZJDlB03XfdAKqK2hvHzxttfFBryvuoVcCYHS8gFPk3UIQmEUyK QCug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10-v6si20341108pfb.316.2018.09.03.10.39.30; Mon, 03 Sep 2018 10:39:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731753AbeICV7D (ORCPT + 99 others); Mon, 3 Sep 2018 17:59:03 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48764 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726384AbeICV7C (ORCPT ); Mon, 3 Sep 2018 17:59:02 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2410CA95; Mon, 3 Sep 2018 17:37:50 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philipp Rudo , Heiko Carstens , Martin Schwidefsky Subject: [PATCH 4.18 093/123] s390/purgatory: Fix crash with expoline enabled Date: Mon, 3 Sep 2018 18:57:17 +0200 Message-Id: <20180903165723.458137274@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180903165719.499675257@linuxfoundation.org> References: <20180903165719.499675257@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Philipp Rudo commit ad03b821fbc30395b72af438f5bb41676a5f891d upstream. When the kernel is built with CONFIG_EXPOLINE=y and a compiler with indirect branch mitigation enabled the purgatory crashes. The reason for that is that the macros defined for expoline are used in mem.S. These macros define new sections (.text.__s390x_indirect_*) which are marked executable. Due to the missing linker script those sections are linked to address 0, just as the .text section. In combination with the entry point also being at address 0 this causes the purgatory load code (kernel/kexec_file.c: kexec_purgatory_setup_sechdrs) to update the entry point twice. Thus the old kernel jumps to some 'random' address causing the crash. To fix this turn off expolines for the purgatory. There is no problem with this in this case due to the fact that the purgatory only runs once and the tlb is purged (diag 308) in the end. Fixes: 840798a1f5299 ("s390/kexec_file: Add purgatory") Cc: # 4.17 Signed-off-by: Philipp Rudo Reviewed-by: Heiko Carstens Signed-off-by: Martin Schwidefsky Signed-off-by: Greg Kroah-Hartman --- arch/s390/purgatory/Makefile | 1 + 1 file changed, 1 insertion(+) --- a/arch/s390/purgatory/Makefile +++ b/arch/s390/purgatory/Makefile @@ -23,6 +23,7 @@ KBUILD_CFLAGS += -Wno-pointer-sign -Wno- KBUILD_CFLAGS += -fno-zero-initialized-in-bss -fno-builtin -ffreestanding KBUILD_CFLAGS += -c -MD -Os -m64 -msoft-float KBUILD_CFLAGS += $(call cc-option,-fno-PIE) +KBUILD_AFLAGS := $(filter-out -DCC_USING_EXPOLINE,$(KBUILD_AFLAGS)) $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE $(call if_changed,ld)