From patchwork Wed Nov 17 19:32:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12692988 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A587C4332F for ; Wed, 17 Nov 2021 19:34:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 0A5E560EC0 for ; Wed, 17 Nov 2021 19:34:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0A5E560EC0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=hrHbwQ49Db/i6pSYhs+6J6ZPwGqDoTCp8dwhXKvWUmY=; b=QX2M0oll3ligmF OvStW0OPb2BcQyM5OkteDPsvVVmJnhdOwyQjaYF9E7FFV8CzLFkRUhkijBeGoa5WbMBAZK73DT5oP cyavPwEYvv1lb4H+bq15FzkB5P3LYXrH3hS/uvZUjIsQuoP+aEokSFgWrKFA07ohidjtkfk8hoXcQ /jA5UKi7tSrRSHDI1ihe8/KMwjmItoMvBnTeskDXesWChhy2uqNbVAXrLX8W2pbSFvHSxtPpNuwRz oWRIp+LE72yVBhk0qDP3VfD+u/K8aTgQvLIyqh5/vismyzfoJcDZWuF7n9p5wk5PaMzD+l8Gf5aln H6JAHNs4gmc+kgSvkKog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnQg0-0069xL-Lx; Wed, 17 Nov 2021 19:33:00 +0000 Received: from smtp-out1.suse.de ([195.135.220.28]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnQfv-0069vw-Vi for linux-arm-kernel@lists.infradead.org; Wed, 17 Nov 2021 19:32:57 +0000 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 38EAE2114D; Wed, 17 Nov 2021 19:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1637177572; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=FF7UCsojzx3IaFcpe06QskS6C/FUMgVa9wc/j/zbQpI=; b=wFh+tS38p135YLWS+v9cM8nb3RACUC+QIMgsWQ3zv3tl5+Qo0YipkVWqOFEUV6x1f3q6ug CG8IQDvpFPpK8Grl4253ezKmzJmHqqRrSnYtcdvRyVSyyIeRXHm4GfV1DCsbwbFKKuAbrG 3zYYbKrlnBMAFAtagFc8LW+nJkVi8LY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1637177572; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=FF7UCsojzx3IaFcpe06QskS6C/FUMgVa9wc/j/zbQpI=; b=4nNnpszVTKbNOhb2TehHMDxIVLnmC5IJs3YAIgWkedIRDZAFUNZWGAf/s9brtdUQfzvSwn hf1O3Nx6bZ3Cj/Ag== Received: from alsa1.nue.suse.com (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id 26EC9A3B85; Wed, 17 Nov 2021 19:32:52 +0000 (UTC) From: Takashi Iwai To: Dinh Nguyen Cc: Kees Cook , "Ivan T . Ivanov" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: socfpga: Fix crash with CONFIG_FORTIRY_SOURCE Date: Wed, 17 Nov 2021 20:32:44 +0100 Message-Id: <20211117193244.31162-1-tiwai@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211117_113256_210593_F0961FE5 X-CRM114-Status: GOOD ( 10.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When CONFIG_FORTIFY_SOURCE is set, memcpy() checks the potential buffer overflow and panics. The code in sofcpga bootstrapping contains the memcpy() calls are mistakenly translated as the shorter size, hence it triggers a panic as if it were overflowing. This patch adds the __NO_FORTIFY define for avoiding the false-positive crash. Buglink: https://bugzilla.suse.com/show_bug.cgi?id=1192473 Signed-off-by: Takashi Iwai --- I took an easier path for now, as the attempt with a foced cast failed. If there is a better way to handle, let me know, I'd happily resubmit. Thanks! arch/arm/mach-socfpga/platsmp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-socfpga/platsmp.c b/arch/arm/mach-socfpga/platsmp.c index fbb80b883e5d..d46b1af96a8a 100644 --- a/arch/arm/mach-socfpga/platsmp.c +++ b/arch/arm/mach-socfpga/platsmp.c @@ -5,6 +5,9 @@ * Based on platsmp.c, Copyright (C) 2002 ARM Ltd. * Copyright (C) 2012 Altera Corporation */ + +#define __NO_FORTIFY /* need to avoid the crash with memcpy() calls */ + #include #include #include