Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6773374rwn; Tue, 13 Sep 2022 08:50:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR6bUt2J23xpoMUtkTFcVExezxDh3G9KmWPoR0yQFfNBox0DOHBHu18P7Y5zex2wZaUBxhFN X-Received: by 2002:a17:907:1de6:b0:77a:c72a:b853 with SMTP id og38-20020a1709071de600b0077ac72ab853mr12048698ejc.353.1663084242371; Tue, 13 Sep 2022 08:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663084242; cv=none; d=google.com; s=arc-20160816; b=plnmAkvKgmIhUqdyU+RnSbS1uOKcSxMdzL7UbK0YmRvaRpvX3vA0Puo2Ud6gMDf3Pa IjpK1vFJfrmE3N1PUsLKMila8neF9/R14DNQ2rdCA2+R1p3TGaHYcZLAkJwdV9ryMO85 Q8sH9BUs9MOIGLZIlY5wL3UMuFhlDEfuyX4ntG57hXum4tZnZtRZCowB0zohDRHTqg+u 2T1Auk3kH1zyvc0NdxYB+22x59ThGrVCksa2GlXmnF5oTkX1E8ErkXLqAtR7wjwn81SU Jdl3U28re7b+GnnQlLak4aMuKMtZ+cEfgudXVb21nyFgmdupUSyCQRJt9001HYmy+j6a DmKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Zronp57+sC2chp4RNgE7A1MFoVFnNovKtMmbKCooAvs=; b=P+mloW2Ees53Sm1D858y3liXHVSe92Q+nhfZpoJ5er0LRSyef1aB2S4GyoKK0Ly+3Y Bx0MueypPLE6Zaq5njgaZ+PKtsxuN0liJpE58D1fpYpY2JK3I4yHlB9VMe8voF5Tjrhf Xn6WOsIqp7q8ktEV6gnaPgP2S4kZ26PkGgMkJyCYjfgkpAA8ZIQ4oFDRz0gDQpMKE6z1 mNnL9oEThafc9TAhzflcq+mNmIXhDiJvoOdwu9JsqgCF1AnxgVsHqfnEQclBkxHdzY8I pUW2RyDZdb5ms34pIRGNSXEEoFPX9kbanNIYlfGaxSGRwt5Z/LT63oB5wVpF2wtUkVWY YN0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Nhefyjd9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne18-20020a1709077b9200b0076f23cf9c76si9017775ejc.195.2022.09.13.08.50.15; Tue, 13 Sep 2022 08:50:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Nhefyjd9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236294AbiIMP1h (ORCPT + 99 others); Tue, 13 Sep 2022 11:27:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236282AbiIMPZt (ORCPT ); Tue, 13 Sep 2022 11:25:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EEA37DF46; Tue, 13 Sep 2022 07:38:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2F3B2614D4; Tue, 13 Sep 2022 14:31:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41FB8C433D6; Tue, 13 Sep 2022 14:31:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1663079476; bh=Sd0dpX/2W+jDhqDyoYomDpBo+orj3hzg0AEtI3Yg6fo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nhefyjd9nIlhtY09S2hpECXe683RUU4VgGX72lInkLl7cjd5JTTr+BDaikKHe26wG P+HyAVYEO9CWAxdl3X4M95LYfK8MuuH3BXHEntm16eOUMQ4CldpKaikmKQsGFn0HwH WiQDkB+WWSxDch64wZHhfbyyWJTi8oxg4WQiCae8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Poimboeuf , Heiko Carstens , Vasily Gorbik Subject: [PATCH 4.19 42/79] s390: fix nospec table alignments Date: Tue, 13 Sep 2022 16:07:00 +0200 Message-Id: <20220913140350.942768586@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220913140348.835121645@linuxfoundation.org> References: <20220913140348.835121645@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josh Poimboeuf commit c9305b6c1f52060377c72aebe3a701389e9f3172 upstream. Add proper alignment for .nospec_call_table and .nospec_return_table in vmlinux. [hca@linux.ibm.com]: The problem with the missing alignment of the nospec tables exist since a long time, however only since commit e6ed91fd0768 ("s390/alternatives: remove padding generation code") and with CONFIG_RELOCATABLE=n the kernel may also crash at boot time. The above named commit reduced the size of struct alt_instr by one byte, so its new size is 11 bytes. Therefore depending on the number of cpu alternatives the size of the __alt_instructions array maybe odd, which again also causes that the addresses of the nospec tables will be odd. If the address of __nospec_call_start is odd and the kernel is compiled With CONFIG_RELOCATABLE=n the compiler may generate code that loads the address of __nospec_call_start with a 'larl' instruction. This will generate incorrect code since the 'larl' instruction only works with even addresses. In result the members of the nospec tables will be accessed with an off-by-one offset, which subsequently may lead to addressing exceptions within __nospec_revert(). Fixes: f19fbd5ed642 ("s390: introduce execute-trampolines for branches") Signed-off-by: Josh Poimboeuf Link: https://lore.kernel.org/r/8719bf1ce4a72ebdeb575200290094e9ce047bcc.1661557333.git.jpoimboe@kernel.org Cc: # 4.16 Reviewed-by: Heiko Carstens Signed-off-by: Heiko Carstens Signed-off-by: Vasily Gorbik Signed-off-by: Greg Kroah-Hartman --- arch/s390/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+) --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S @@ -121,6 +121,7 @@ SECTIONS /* * Table with the patch locations to undo expolines */ + . = ALIGN(4); .nospec_call_table : { __nospec_call_start = . ; *(.s390_indirect*)