Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3440480ybh; Mon, 5 Aug 2019 18:54:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqye/u9VOuney1aZpuC9DGXCVgXijX2n/+Yz8+XEPzdm4vvshCLRLe56zTO/znKE1SYJNQdN X-Received: by 2002:a17:90a:db44:: with SMTP id u4mr650301pjx.52.1565056488092; Mon, 05 Aug 2019 18:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565056488; cv=none; d=google.com; s=arc-20160816; b=YKgjOCyad75fg4+YBQD0UFCEN6u/78lzVNJbE8Xk0DV2Y3otALdTzZtElOrvZ+b8n1 H8YGXXygZX6unvE5aEGRd6Rgj6VH8AWWZL5EwOZfZV8jL4jCXmOEBNqrlLIq9/xjukyk u088HNxZiMQD4MAvm49kplnZfIA7Fgwk55W9oGqXmRWhC51+XdWGJIx0aVNCoIkWOKFU jkhtGGEBwmJ4bwBgd6l23sIebOD02YFudPM85VkAo8uOYiAFWMK1z2iLblzMfZQXXyO2 6f1WtNVGVScOL1aqmPcFtcyz/2ih261Fd6lnnlzMtRDxPwCRWYtcSvj09niDBq3S2o4Y pqlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=d7kc24UT0Ui3ma1mQirb3g1ID4GWXa9XQcfUit7kQkw=; b=coUOIw5jA5OiQ9hEJUbREOXcJf0w6LY8D/VLoOcDlUXG2N1OmE3fdVQsUo9vF4iBYh +ktyW19gqKrw5fa5SFrmaAIHu8gP04xS75oXCnuKw152RBA1Tg8c12TvlS7Mc98dESwB n9wYdE/roDoZcRs5FMlNxpV8g21c28X9okw6OM4Lm3xTLaPqsQL0Ojjm6yuMVwBL5nXS eJF7+7gwT+qAHEvgfLUWLKtbKPNTmW+YGcDD2VTerQD/rXShyMgifXORLlkjwiokNUxa enOCzll/XHX5quWsojqajeFSPNTufU2ol/diFETa94zfC8fCMu8OgPVPZyRMRWTBfSdd /8eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=riia59qc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l70si7691394pje.68.2019.08.05.18.54.32; Mon, 05 Aug 2019 18:54:48 -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=@gmail.com header.s=20161025 header.b=riia59qc; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730578AbfHFBxx (ORCPT + 99 others); Mon, 5 Aug 2019 21:53:53 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:46297 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728922AbfHFBxw (ORCPT ); Mon, 5 Aug 2019 21:53:52 -0400 Received: by mail-qk1-f194.google.com with SMTP id r4so61611170qkm.13 for ; Mon, 05 Aug 2019 18:53:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=d7kc24UT0Ui3ma1mQirb3g1ID4GWXa9XQcfUit7kQkw=; b=riia59qcc0cQpXINkDNLStgnmv/95VnlG86qMLMOWsOC6J2f3POgXMdllI6p2YOwIW frVwwBvzxO5HICfRqE04MJgk+hdxxDjsS8AQLDN6r5cnWb8kAMsbSyfvtAI6PoRkkmx6 Z1U7yNnr47jc8mXTieDX/7gJ108OSmafDwp5Kg3I7/PJhZIppW4FwVmgk2d+OmkLAQur Q6EUXlofGz2375qWDcViMtohrFcNwHsKWvSMQCFUNF70kAkstnoX8UfFlk7OnRxGlSCY ANeRCSqE4Ql6Cj4hx/tyyJTPa2IutfMB+3fQQLsnHC4fGlM/v+26jxInQydAo6OLF0MD AO8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d7kc24UT0Ui3ma1mQirb3g1ID4GWXa9XQcfUit7kQkw=; b=sw8boRGrz8E8P8b6L8vyLw6PfrDuzs7AcC+It77lXF/ho9fTCBlFyZexkJ+63v/jYM 929EdEm1v88FPg3wu+IhWENc/ZbYpjtKaak0XwyxbuL4bfYWol4j1LTwrS7DJ/cXpAX8 IPtsFnIj7nJdixF8PRCvXrkHehASSluMFQ3EKFEfDIyfi8ljb6a0R/9mzA4ab1eKJ2zM eomJEOf4dcs3iC9CVdny4Bvbw48xBi5PAw1FfxGKcsSqXv4RHKwSTp2a1mNEHi9RTdZh cHaEFGbIrN1f1eX73tNEpTt+slxsA7iqh0pnaOeiqsB9N7Oub4B69XRLcLlD8/bG358E 3vnQ== X-Gm-Message-State: APjAAAWcgCS1ZBSU6/p8hsZp+GXp3nFPniMlbhI7w0LybUhGmMj9cazE 76v3z1v1tjPSMfwD6JwXQIwsPOKOVTSbpNspu2Qxhrz7xrs= X-Received: by 2002:a37:3c9:: with SMTP id 192mr1116843qkd.37.1565056431753; Mon, 05 Aug 2019 18:53:51 -0700 (PDT) MIME-Version: 1.0 References: <20190730044326.1805-1-luaraneda@gmail.com> <20190730104746.GA1330@shell.armlinux.org.uk> <26427757-9ed1-36fa-3e4d-7357703ec548@xilinx.com> In-Reply-To: <26427757-9ed1-36fa-3e4d-7357703ec548@xilinx.com> From: Luis Araneda Date: Mon, 5 Aug 2019 21:52:58 -0400 Message-ID: Subject: Re: [RFC PATCH] ARM: zynq: Use memcpy_toio instead of memcpy on smp bring-up To: Michal Simek Cc: Russell King - ARM Linux admin , linux-arm-kernel , linux-kernel@vger.kernel.org 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 Hi Michal, Thanks for the review. On Mon, Aug 5, 2019 at 5:53 AM Michal Simek wrote: > > On 31. 07. 19 6:12, Luis Araneda wrote: > > Hi Russell, > > > > Thanks for reviewing. > > > > On Tue, Jul 30, 2019 at 6:47 AM Russell King - ARM Linux admin > > wrote: > >> > >> On Tue, Jul 30, 2019 at 12:43:26AM -0400, Luis Araneda wrote: > >>> This fixes a kernel panic (read overflow) on memcpy when > >>> FORTIFY_SOURCE is enabled. > > [...] > >> > >> I'm not convinced that this is correct. It looks like > >> zynq_secondary_trampoline could be either ARM or Thumb code - there is > >> no .arm directive before it. If it's ARM code, then this is fine. If > >> Thumb code, then zynq_secondary_trampoline will be offset by one, and > >> we will miss copying the first byte of code. > > > > You're right, I tested what happens if the zynq_secondary_trampoline > > is ARM or Thumb by editing the file where it's defined, headsmp.S > > > > When the .arm directive is used, the CPU is brought-up correctly, > > but if I use .thumb, I get the following message (no panic): > >> CPU1: failed to come online > > > > This seems unrelated to solving the panic, as the message > > even appears with memcpy and FORTIFY_SOURCE disabled. > > > > I could add the .arm directive to headsmp.S > > Is that your expected solution? > > Should that change be on a separate commit? > > > > I'd like to know Michal's opinion, as he wrote the code. > > > > There are two things together. Thanks Russel to pointing to it. > 1. How to support SMP in thumb2 mode? > Adding .arm mode to headsmp.S which ensure that cpu starts in proper > mode and correct code size is copied. > And also point to secondary_startup_arm in zynq_boot_secondary to switch > cpu from arm to thumb mode. > > 2. And the second is this patch to fix FORTIFY_SOURCE. > > Feel free to create the first patch too or I will do it myself. I'll be sending the two patches as a series (I already tested that they work), so they can be picked by the stable trees. Thanks, Luis Araneda.