From mboxrd@z Thu Jan 1 00:00:00 1970 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=unavailable 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 00A22C32792 for ; Thu, 3 Oct 2019 16:56:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCB3720673 for ; Thu, 3 Oct 2019 16:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570121815; bh=gHBXCwehdpgM+xbkDasC+q/jnyRk+Cs4NobCvALNRa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SUPT4/BVg45Dy6DzwWMrdV+8SXTf10UnTewUqFr6NecmdoNPTO6188xod38pVnmIm Ykg2JgE7To5OQEn0Vv2B8n3Ql8zr/Oq9ItWEmloty5xKmcn12w/69axieAn5UwIsg2 CPMmCZgH7w/h4FuNk1+EIWENFpZ5Pr+NwskdBorY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392771AbfJCQ4u (ORCPT ); Thu, 3 Oct 2019 12:56:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:38088 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405966AbfJCQuq (ORCPT ); Thu, 3 Oct 2019 12:50:46 -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 F411120867; Thu, 3 Oct 2019 16:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570121445; bh=gHBXCwehdpgM+xbkDasC+q/jnyRk+Cs4NobCvALNRa0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hbPGvM6ALVEYwEcAotM7pZxA7M38S6uUbwqSOqJdXSEt2wcPedUaKyDKS9tRGYLDj Mglzx1WHkhoU8DPoChsnhc353DFJ45IAH6LIcv+H/AczKKy1ZIDIAEC+tKoA8Cl53l TsvFRu6OHVmBJdp0yNJmQBc3BVJZkhXQYVeH5o2w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luis Araneda , Michal Simek Subject: [PATCH 5.3 281/344] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up Date: Thu, 3 Oct 2019 17:54:06 +0200 Message-Id: <20191003154607.700521567@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154540.062170222@linuxfoundation.org> References: <20191003154540.062170222@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Luis Araneda commit b7005d4ef4f3aa2dc24019ffba03a322557ac43d upstream. This fixes a kernel panic on memcpy when FORTIFY_SOURCE is enabled. The initial smp implementation on commit aa7eb2bb4e4a ("arm: zynq: Add smp support") used memcpy, which worked fine until commit ee333554fed5 ("ARM: 8749/1: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE") enabled overflow checks at runtime, producing a read overflow panic. The computed size of memcpy args are: - p_size (dst): 4294967295 = (size_t) -1 - q_size (src): 1 - size (len): 8 Additionally, the memory is marked as __iomem, so one of the memcpy_* functions should be used for read/write. Fixes: aa7eb2bb4e4a ("arm: zynq: Add smp support") Signed-off-by: Luis Araneda Cc: stable@vger.kernel.org Signed-off-by: Michal Simek Signed-off-by: Greg Kroah-Hartman --- arch/arm/mach-zynq/platsmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm/mach-zynq/platsmp.c +++ b/arch/arm/mach-zynq/platsmp.c @@ -57,7 +57,7 @@ int zynq_cpun_start(u32 address, int cpu * 0x4: Jump by mov instruction * 0x8: Jumping address */ - memcpy((__force void *)zero, &zynq_secondary_trampoline, + memcpy_toio(zero, &zynq_secondary_trampoline, trampoline_size); writel(address, zero + trampoline_size);