Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp654772ybg; Thu, 19 Mar 2020 06:29:19 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvTgPcAu98aGsR2i2WkdtxWgALBjSp3UYmD40YooFif1iu/AACG8QfLaEJyEY/QTiFZabxm X-Received: by 2002:aca:5057:: with SMTP id e84mr2392347oib.120.1584624558905; Thu, 19 Mar 2020 06:29:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584624558; cv=none; d=google.com; s=arc-20160816; b=Nj0bl9UWy/O/sp31HH+g5b0Dmzk+zEzBeD6M+kspSnSt9egO/9z7yy8VnS6MVrE7Gk UdBr/M7vj7suMGN7JbXmlF76sKKHko9JNSI5VphxxA2fB8SQHQFy/VHBblpzna0luvgh kqy/cFnmU87sEveLwgObt4aGfX5Yl17gPqih/AwMldeSJbMJboJk2g7t9i3gAEqYtBF2 w3O/4IKADZYYkUy/mpFx9CLKuOEcUPXFAUBb06oeeOd1id9jRWMO1l1iNfMAUSC8cHvi 8Kba5tMFb+5yLkvVH5YOc4eCwujE0Hvcx+TTS/f+Y51M/0hPHOXY85KzBI8CZ7UtAnly JhcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TtND3CoEYyJydS8cjhdJ9lKy6LKyib0KZU5xZ2+wKWw=; b=SRJSLmnxCGbOt98d2gOY0QdsezPoUlqZxEl6OCA8CZTnQMhwn8MyiULFGPFbPxu9N4 j3ZpCX5zD8gkmrBuyqcaHaO9a+zJq9xbPW7/YVzSKY/ygldPAyFY+mW4S3nIQTPYp1Qk W1JJZA5cvtta+mgxnoVKxw0Q5Qel8pa30gH0LUwDvhS/CH8IDpBwxf8tvRQPJYLAqVPP 9iizm4J9pNe9lAndRWyf+TPAiOv0UZ11NXErQMZh3sMlGDJJovmHAQjCEBpWVMl56+jt 1pUpCGxV7oiPPzoSnlMtpfp3ghy1hEyQPGh+sSWiwNXd9QjXlPUef7h5uIX2slDJ/Qhs Jbxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V00+g1Re; 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 p204si1044204oib.241.2020.03.19.06.29.06; Thu, 19 Mar 2020 06:29:18 -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; dkim=pass header.i=@kernel.org header.s=default header.b=V00+g1Re; 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 S1730717AbgCSN0A (ORCPT + 99 others); Thu, 19 Mar 2020 09:26:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:53740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730515AbgCSNZ5 (ORCPT ); Thu, 19 Mar 2020 09:25:57 -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 578FD2080C; Thu, 19 Mar 2020 13:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584624355; bh=5iPR7XCLsazQnaDrcx+zT2BH4J3il51Isf+Aw05JtG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V00+g1ReQ5ZN/S2LQRGaxu6CjECtb2pY2qLqmqQStO9M/zo7vl+bjuSiQdu8A32yP ZGoB69yUYBSPk0Dcc97B8VUPv/G949VaOvPGrXMgx4DVltRdhHD6ZAoEJoeMFYZjXw cHNJ+xcNquBqNGl77AlhtjEDZ7XaSmsMXL6aZJeg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Victor Kamensky , Paul Burton , linux-mips@vger.kernel.org, Ralf Baechle , James Hogan , Vincenzo Frascino , bruce.ashfield@gmail.com, richard.purdie@linuxfoundation.org, Sasha Levin Subject: [PATCH 5.5 15/65] mips: vdso: add build time check that no jalr t9 calls left Date: Thu, 19 Mar 2020 14:03:57 +0100 Message-Id: <20200319123931.264495151@linuxfoundation.org> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200319123926.466988514@linuxfoundation.org> References: <20200319123926.466988514@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Victor Kamensky [ Upstream commit 976c23af3ee5bd3447a7bfb6c356ceb4acf264a6 ] vdso shared object cannot have GOT based PIC 'jalr t9' calls because nobody set GOT table in vdso. Contributing into vdso .o files are compiled in PIC mode and as result for internal static functions calls compiler will generate 'jalr t9' instructions. Those are supposed to be converted into PC relative 'bal' calls by linker when relocation are processed. Mips global GOT entries do have dynamic relocations and they will be caught by cmd_vdso_check Makefile rule. Static PIC calls go through mips local GOT entries that do not have dynamic relocations. For those 'jalr t9' calls could be present but without dynamic relocations and they need to be converted to 'bal' calls by linker. Add additional build time check to make sure that no 'jalr t9' slip through because of some toolchain misconfiguration that prevents 'jalr t9' to 'bal' conversion. Signed-off-by: Victor Kamensky Signed-off-by: Paul Burton Cc: linux-mips@vger.kernel.org Cc: Ralf Baechle Cc: James Hogan Cc: Vincenzo Frascino Cc: bruce.ashfield@gmail.com Cc: richard.purdie@linuxfoundation.org Signed-off-by: Sasha Levin --- arch/mips/vdso/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile index e8585a22b925c..bfb65b2d57c7f 100644 --- a/arch/mips/vdso/Makefile +++ b/arch/mips/vdso/Makefile @@ -93,12 +93,18 @@ GCOV_PROFILE := n UBSAN_SANITIZE := n KCOV_INSTRUMENT := n +# Check that we don't have PIC 'jalr t9' calls left +quiet_cmd_vdso_mips_check = VDSOCHK $@ + cmd_vdso_mips_check = if $(OBJDUMP) --disassemble $@ | egrep -h "jalr.*t9" > /dev/null; \ + then (echo >&2 "$@: PIC 'jalr t9' calls are not supported"; \ + rm -f $@; /bin/false); fi + # # Shared build commands. # quiet_cmd_vdsold_and_vdso_check = LD $@ - cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check) + cmd_vdsold_and_vdso_check = $(cmd_vdsold); $(cmd_vdso_check); $(cmd_vdso_mips_check) quiet_cmd_vdsold = VDSO $@ cmd_vdsold = $(CC) $(c_flags) $(VDSO_LDFLAGS) \ -- 2.20.1