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 0CCDBC433F5 for ; Thu, 18 Nov 2021 07:27:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DFE5B61A3D for ; Thu, 18 Nov 2021 07:27:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243789AbhKRHa3 (ORCPT ); Thu, 18 Nov 2021 02:30:29 -0500 Received: from smtp-out2.suse.de ([195.135.220.29]:52098 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243448AbhKRHa1 (ORCPT ); Thu, 18 Nov 2021 02:30:27 -0500 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id D00401FD35; Thu, 18 Nov 2021 07:27:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1637220446; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6lR2NN1KvVP4Jy99ruifaDovy1lCX/AMdZlr3TKX9DI=; b=1HpnTCZ9U/GMu7P3LSTPoQh3w21KE35/2v8sT4qxlCHO5NbkgNJMlIOwWMQda+6TtnaX9g YqfPmOV5BQZ6PXArGLXJWU+W+7qhXVVdfwhCVGXoptrSgCpyqE5QbwAmX3U1agR3mAnN7x 8knUGlla/ypu+zjraFUsmJPyJYMuNNI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1637220446; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6lR2NN1KvVP4Jy99ruifaDovy1lCX/AMdZlr3TKX9DI=; b=WL01u1cV8AlwnIgEoh8zaUvwYS9usF7MNUWALOFGFm5BcZBf9Sc5AtO/SJDMqDHTdpDs2/ aV5z9BUNE0T/Q1Cw== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id C755EA3B85; Thu, 18 Nov 2021 07:27:26 +0000 (UTC) Date: Thu, 18 Nov 2021 08:27:26 +0100 Message-ID: From: Takashi Iwai To: Kees Cook Cc: Takashi Iwai , Dinh Nguyen , "Ivan T . Ivanov" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] ARM: socfpga: Fix crash with CONFIG_FORTIRY_SOURCE In-Reply-To: <202111171400.618456DCE9@keescook> References: <20211117193244.31162-1-tiwai@suse.de> <202111171400.618456DCE9@keescook> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Nov 2021 23:01:50 +0100, Kees Cook wrote: > > On Wed, Nov 17, 2021 at 08:32:44PM +0100, Takashi Iwai wrote: > > 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! > > > > The way these have been fixed in the past is to declare these as char > arrays (see include/asm-generic/sections.h). I'd prefer something like > this (totally untested): (snip) That looks better, indeed. I'll rebuild the kernel with it and ask the bug reporter for testing it. Thanks! Takashi