Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp224742imu; Thu, 10 Jan 2019 22:32:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN6u0e8CQ++KwptbOpGhfxkJYmNmx3D1V5njcT9xKiyfM6AlNge+A+QIVjt2S3Wbfk3oPkJ1 X-Received: by 2002:a63:e80e:: with SMTP id s14mr12236789pgh.30.1547188353350; Thu, 10 Jan 2019 22:32:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547188353; cv=none; d=google.com; s=arc-20160816; b=k5XB9WCvnRJJzTnygTctwwfKhjEV11IU+Xdb1bAxMp/+WRiua5f1GAgKlKyGiXupI2 kddsXex4jMiJffsmhtclTq7mQRqAF/tGN7ZTFoYj+Hx2ry5SsVp9l35l0qbvj+tEso6k GsCN/Bc9FCiF0Sz5DzDxPMkZaCxr+ySstdZXhuENcEjRcXvocRnSTlfbGxF/8tA0Hsao gxgeO8az+F/9VKP84uv1D/JPWdseQ7hwKZKWdNkjP32ojG6e/YpYK4UrvayYTo5y9iZO xBfLegf9MUTlq834F9PI0F72KTXUatqQ14SBndg//hx1GtLGfb94TZCRRAORKMtGDc0A ZAqA== 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:dkim-filter; bh=gaxhBMrxiaTkXMhUzpaE+DTNWXXVNmnaKXsC40qFtKM=; b=hoXpV0nA3etpAis0O/ZBbTQaZONKwW/XCEE5ypIr6Q2Gx3EPLNcL23PCwYVm9p8IWV NWjiObW/38mvuivc5O8uA6m6IR2kuwRnWYnmNnTQ92eFIdc+oTcNa9tFt1LMdFtUclt6 pjMcoIFHULLWYpDgNKWbQDe6dSzBJm+H+eW7CPrPmwgRU5orQa453IH31Z+q3GltfAJg aT5xdpQ+16Ld/kVh2xJ81G/ZugaCeSzbHplxNMI42ybgDfCJ6tmlZ4FmE0g2M3d09lCC GFeqhm4t7tfjZAGB6E8yujsnxKmKb7Q4LLOokcMnTItNeJNA0cmQRH7GAT+uxHQh+yak Zb4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=onLbbVqD; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay4si1569864plb.235.2019.01.10.22.32.14; Thu, 10 Jan 2019 22:32:33 -0800 (PST) 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=@nifty.com header.s=dec2015msa header.b=onLbbVqD; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730136AbfAKDIw (ORCPT + 99 others); Thu, 10 Jan 2019 22:08:52 -0500 Received: from conssluserg-03.nifty.com ([210.131.2.82]:40059 "EHLO conssluserg-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729236AbfAKDIv (ORCPT ); Thu, 10 Jan 2019 22:08:51 -0500 Received: from mail-ua1-f54.google.com (mail-ua1-f54.google.com [209.85.222.54]) (authenticated) by conssluserg-03.nifty.com with ESMTP id x0B38e4v022464 for ; Fri, 11 Jan 2019 12:08:41 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-03.nifty.com x0B38e4v022464 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1547176121; bh=gaxhBMrxiaTkXMhUzpaE+DTNWXXVNmnaKXsC40qFtKM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=onLbbVqDsewx+dJ9dhcavantSpXLMJsvJxb0mOWAgUq9ELRXYYisaqrwiF0OwDzfi a4mkzcs2exr0+Ez6iy3eVleFl2vM5+OMiWXhhITSIqff34lb1o8hbhyRX/BY0WkGmO GF/pOW+Z6s4/logd0N9nWtztU7RjAiWTIU1XpIBnN464dj4Eac7ll8JC/d9kNYDCx0 fZkIi8I5neipFaXsC4bG4xqA/V9ljUE/aur8K0eJ/frHfs+/Jby+FTl3ai/w5Re62f UMFMo/L4w9VDGcl/SGIdJ2xvPeprnmX82dnIa3ZsC8LGauoJogrPhtR69uRvQ49zIR GO+QLh6Aup+gg== X-Nifty-SrcIP: [209.85.222.54] Received: by mail-ua1-f54.google.com with SMTP id p9so4306733uaa.5 for ; Thu, 10 Jan 2019 19:08:41 -0800 (PST) X-Gm-Message-State: AJcUukfaP1WkAtoG2Z/V448USYPeRWM6aHEolxXunb1F8NtCzScuHlDx Tbb9yYoo3oKiN0BQPJI1gUVQsU/YouURHWY4PuE= X-Received: by 2002:ab0:3402:: with SMTP id z2mr4854577uap.6.1547176120170; Thu, 10 Jan 2019 19:08:40 -0800 (PST) MIME-Version: 1.0 References: <20190110054216.74248-1-aik@ozlabs.ru> In-Reply-To: <20190110054216.74248-1-aik@ozlabs.ru> From: Masahiro Yamada Date: Fri, 11 Jan 2019 12:08:04 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH kernel] powerpc/stack_protector: Fix external modules building To: Alexey Kardashevskiy Cc: linuxppc-dev , Michael Ellerman , Christophe Leroy , Linux Kernel Mailing List 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 On Thu, Jan 10, 2019 at 2:44 PM Alexey Kardashevskiy wrote: > > c3ff2a519 "powerpc/32: add stack protector support" addes stack protector > support so now powerpc's "prepare" target depends on prepare0 (via > stack_protector_prepare target). > > It works fine until we try build an external module where it fails with: > Run: 'make -j128 SYSSRC=/home/aik/p/kernel SYSOUT=/home/aik/pbuild/kernel-le-pseries/ ARCH=powerpc' > make[1]: Entering directory '/home/aik/p/kernel' > make[2]: Entering directory '/home/aik/pbuild/kernel-le-pseries' > make[2]: *** No rule to make target 'prepare0', needed by 'stack_protector_prepare'. Stop. > > The reason for that is that the main Linux Makefile defines "prepare0" > only if KBUILD_EXTMOD=="". > > This hacks powerpc's Makefile to make external modules build again. > > Fixes: c3ff2a519 "powerpc/32: add stack protector support" > Signed-off-by: Alexey Kardashevskiy > --- > > > It has been suggested that there is a better way of fixing this hence RFC. > > > --- > arch/powerpc/Makefile | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile > index 488c9ed..0492f62 100644 > --- a/arch/powerpc/Makefile > +++ b/arch/powerpc/Makefile > @@ -419,7 +419,11 @@ archheaders: > ifdef CONFIG_STACKPROTECTOR > prepare: stack_protector_prepare > > +ifeq ($(KBUILD_EXTMOD),) > stack_protector_prepare: prepare0 > +else > +stack_protector_prepare: > +endif Honestly, I think this is ugly. Do you want me to send an alternative solution? > ifdef CONFIG_PPC64 > $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h)) > else > -- > 2.17.1 > -- Best Regards Masahiro Yamada