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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 19435C3A5A2 for ; Tue, 3 Sep 2019 21:48:18 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8AE1E2087E for ; Tue, 3 Sep 2019 21:48:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=fossix-org.20150623.gappssmtp.com header.i=@fossix-org.20150623.gappssmtp.com header.b="I71crMcs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8AE1E2087E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fossix.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46NLDH2LDSzDqqW for ; Wed, 4 Sep 2019 07:48:15 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=fossix.org (client-ip=2607:f8b0:4864:20::642; helo=mail-pl1-x642.google.com; envelope-from=santosh@fossix.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=fossix.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=fossix-org.20150623.gappssmtp.com header.i=@fossix-org.20150623.gappssmtp.com header.b="I71crMcs"; dkim-atps=neutral Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46NL7v5KRxzDqVT for ; Wed, 4 Sep 2019 07:44:27 +1000 (AEST) Received: by mail-pl1-x642.google.com with SMTP id bd8so2210148plb.6 for ; Tue, 03 Sep 2019 14:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fossix-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Pyrn+TuqDwSTTQ+EHQ8Cby3wlz6YBVisGZIc3udip+Q=; b=I71crMcsQBm+d9YfMSapo2x0qldgqXhBDcZA0uuzFr0ZGvXWSfAG8k064oVYr0BSlW kw5tOQE3d7IxnmPyAA34s2JVMb2dI09dlsC+xScLwQvlNZmewiMujGJhm/MJhtHn7Bu/ rz2/YaI0KNF1k5dXJmexd7Kuq589dy1SR6PF0oKXyb5MGEGKDTrL0j/wY9D1WwHOQb/L qpdcFrC7923DV15FGWpHFuYDu9QmXfvvgjtG1X8iRAodDIhnbLnM4ebyAD7PIpEH4xga GTcVG7o6ptYqzu0Zrof2xxIEMmP0l8KKU26ZmX1ci8W0dDlaFTk2ShknU9mCR9k8zb/m IgAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Pyrn+TuqDwSTTQ+EHQ8Cby3wlz6YBVisGZIc3udip+Q=; b=JZVyTQVLB+CkbIsW7qYjzrf4IpUu4cWLCMDVGNhWvdKN1ZSi8jD6GHOggNtYUSWK3i 15gLKJA/x+7LWaynI5Hrr46Mj0juk9H/XwVbsfJCICXFeg8/14TeB39R4oQ4U3TGxyIw 7NusA9/4Njns3MwBT78SDuwc54p3IXjdBE4XQLfysx7UXPklHVtd5uDeFO5MPdqOE4WW yVAS2qqfhwIta1J8sSRM1SfNNlVKeS1kbDTEt24JvbePCq2TPZBJUnua19N/HnBgKGXJ xz0Aodws5c7GyfmDS8C6r9Xi6k0sSXcyxjyWzJDGDbaWch5JKg32ytAHaNY+HVzA/KAP 6kHg== X-Gm-Message-State: APjAAAXSnLINjFM3odLM5PqG0zAksdPiOmBLxCCFFFX2kl0jtyQZL71m 3IbTjflJQvoz1Hss61/6yHCOwidsZ7Q= X-Google-Smtp-Source: APXvYqx9t8Evz57Bc4A3OcxvNBfLAa6EHMeMXlyLgcQAsGfIYCFbUow1WSnqAOeuUXz9Dyypv5hWOQ== X-Received: by 2002:a17:902:c9:: with SMTP id a67mr30831830pla.178.1567547062268; Tue, 03 Sep 2019 14:44:22 -0700 (PDT) Received: from santosiv.in.ibm.com.com ([49.207.60.65]) by smtp.gmail.com with ESMTPSA id t6sm487970pjy.18.2019.09.03.14.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 14:44:21 -0700 (PDT) From: Santosh Sivaraj To: linuxppc-dev , Michael Ellerman Subject: [PATCH 1/2] powerpc/memcpy: Fix stack corruption for smaller sizes Date: Wed, 4 Sep 2019 03:13:58 +0530 Message-Id: <20190903214359.23887-1-santosh@fossix.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Aneesh Kumar K.V" Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" For sizes lesser than 128 bytes, the code branches out early without saving the stack frame, which when restored later drops frame of the caller. Tested-by: Aneesh Kumar K.V Signed-off-by: Santosh Sivaraj --- arch/powerpc/lib/memcpy_mcsafe_64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/lib/memcpy_mcsafe_64.S b/arch/powerpc/lib/memcpy_mcsafe_64.S index 949976dc115d..cb882d9a6d8a 100644 --- a/arch/powerpc/lib/memcpy_mcsafe_64.S +++ b/arch/powerpc/lib/memcpy_mcsafe_64.S @@ -84,7 +84,6 @@ err1; stw r0,0(r3) 3: sub r5,r5,r6 cmpldi r5,128 - blt 5f mflr r0 stdu r1,-STACKFRAMESIZE(r1) @@ -99,6 +98,7 @@ err1; stw r0,0(r3) std r22,STK_REG(R22)(r1) std r0,STACKFRAMESIZE+16(r1) + blt 5f srdi r6,r5,7 mtctr r6 -- 2.21.0