From patchwork Wed Jun 15 10:03:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1643569 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=Rzx6w7fe; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LNLXG0PGYz9t6h for ; Wed, 15 Jun 2022 20:05:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1BBE18448B; Wed, 15 Jun 2022 12:04:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=monstr.eu Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=monstr-eu.20210112.gappssmtp.com header.i=@monstr-eu.20210112.gappssmtp.com header.b="Rzx6w7fe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 657BB84453; Wed, 15 Jun 2022 12:04:19 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7639F84459 for ; Wed, 15 Jun 2022 12:04:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=monstr.eu Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x633.google.com with SMTP id m20so22129664ejj.10 for ; Wed, 15 Jun 2022 03:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1PSFw/GXIunUH9AyDLtTr1daRQcTtBjiK6dcDxt5n/M=; b=Rzx6w7fe+qERaKw49S574JVXfpzstoqK4/vf5geXc07ffk6B3oYgqzyUAYPn6wYZaH xLrkI7oUQ6zXqd0dTEBw6Icklam/+EJRYBV6O6ex6AH7r7BCzhgwfGcAGifV85LQvhtm YnQKbETjBm1nUm2v1Pfx5KkObLtA7pqGvZP7bWxFKkMHqIOdtdPKxJafFpIg/0hCqHqf 7R/hWTkg8J1k1MO2xBeCbLM4eZCh60VLX3HhSurwKuJU05vnRYZ0UQspkOQ+PQHfwRwT loUMIaS4IeRbI9myFz9oJ/UZyXXEMp0GQY6sa4xrh0gYSBLy6bVIRStp5x6s1Ln255mg zIJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1PSFw/GXIunUH9AyDLtTr1daRQcTtBjiK6dcDxt5n/M=; b=VCYZH5JEDm+te1HR/ecInhphrtbS5rL8QW9zUjXpgNagUo0rCyTI2+fmMNpmOZDuBo ZDvKLHRi4qrPZYxMoLgeRG0YVX7u2nXHUBTz+nUihpMF3umT/v9XURbvcTaxcLO1bhNS sMFknBTLFKNgaNk6fmvfInFnso50gw249EZRuW//vgrQXjgJxh667ftQ8q+qGmWHwZvK TTzQWuTGDeKBfLrvWQvdGxR2x+GYbBs9Jkqrh4eqweZ/0Sojm9sF1UrTaXJTaEF6H+Q7 ywh4HY1/IkEHs8fp5WRfqTffXz7yuvR4BgQ6l2MSETGjn6sQgMcjBk5Da7xcGSTC1Bzw 8TVA== X-Gm-Message-State: AJIora+My7FHyHCV+f3TYXkYGu3jeXV3wHQkq+uCWmbKkPiyqXx2YkII dcPt59+dwdjbaw5MUffq0VDhq8mf0PjigA== X-Google-Smtp-Source: AGRyM1vJh90pJEuYaPjBPm6M2yVAYT0VMVvHzgs4lx/nZaR25Tl36X1ddA6EkIZHZ0Jx+2sMEEWRsA== X-Received: by 2002:a17:906:2001:b0:6f3:bd7f:d878 with SMTP id 1-20020a170906200100b006f3bd7fd878mr8282134ejo.133.1655287453700; Wed, 15 Jun 2022 03:04:13 -0700 (PDT) Received: from localhost ([2a02:768:2307:40d6::f9e]) by smtp.gmail.com with ESMTPSA id o11-20020a056402438b00b0042dc9aafbfbsm9243679edc.39.2022.06.15.03.04.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 03:04:13 -0700 (PDT) From: Michal Simek X-Google-Original-From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Cc: Michal Simek , Ovidiu Panait Subject: [PATCH v3 06/23] microblaze: Fix stack protection behavior Date: Wed, 15 Jun 2022 12:03:43 +0200 Message-Id: X-Mailer: git-send-email 2.36.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean When U-Boot starts stack protection can be already enabled that's why setup the lowest possible SLR value which is address 0. And the highest possible stack in front of U-Boot. That's why you should never load U-Boot to the beginning of DDR. There must be some space reserved. Code is using this location for early malloc space, early global data and stack. Signed-off-by: Michal Simek --- (no changes since v1) arch/microblaze/cpu/start.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S index 9e00eef1f4b6..715ef37b39d9 100644 --- a/arch/microblaze/cpu/start.S +++ b/arch/microblaze/cpu/start.S @@ -15,8 +15,9 @@ _start: mts rmsr, r0 /* disable cache */ - addi r8, r0, _end - mts rslr, r8 + mts rslr, r0 + addi r8, r0, _start + mts rshr, r8 #if defined(CONFIG_SPL_BUILD) addi r1, r0, CONFIG_SPL_STACK_ADDR