linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: LEROY Christophe <christophe.leroy@csgroup.eu>
To: Paul Moore <paul@paul-moore.com>
Cc: Eric Paris <eparis@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-audit@redhat.com" <linux-audit@redhat.com>
Subject: Re: [PATCH] audit: Fix build failure by renaming struct node to struct audit_node
Date: Mon, 6 Sep 2021 06:41:11 +0000	[thread overview]
Message-ID: <2057e2ab-b303-8ec6-9c43-2c2614591925@csgroup.eu> (raw)
In-Reply-To: <CAHC9VhS4Q8U6ZVPoSaVuDawMLS6VOtwZZVNMT1QeFAJUeQHj-Q@mail.gmail.com>



Le 03/09/2021 à 19:06, Paul Moore a écrit :
> On Fri, Sep 3, 2021 at 11:48 AM Christophe Leroy
> <christophe.leroy@csgroup.eu> wrote:
>>
>> struct node defined in kernel/audit_tree.c conflicts with
>> struct node defined in include/linux/node.h
>>
>>            CC      kernel/audit_tree.o
>>          kernel/audit_tree.c:33:9: error: redefinition of 'struct node'
>>             33 |  struct node {
>>                |         ^~~~
>>          In file included from ./include/linux/cpu.h:17,
>>                           from ./include/linux/static_call.h:102,
>>                           from ./arch/powerpc/include/asm/machdep.h:10,
>>                           from ./arch/powerpc/include/asm/archrandom.h:7,
>>                           from ./include/linux/random.h:121,
>>                           from ./include/linux/net.h:18,
>>                           from ./include/linux/skbuff.h:26,
>>                           from kernel/audit.h:11,
>>                           from kernel/audit_tree.c:2:
>>          ./include/linux/node.h:84:8: note: originally defined here
>>             84 | struct node {
>>                |        ^~~~
>>          make[2]: *** [kernel/audit_tree.o] Error 1
>>
>> Rename it audit_node.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>>   kernel/audit_tree.c | 20 ++++++++++----------
>>   1 file changed, 10 insertions(+), 10 deletions(-)
> 
> That's interesting, I wonder why we didn't see this prior?  Also as an
> aside, there are evidently a good handful of symbols named "node".  In
> fact I don't see this now in the audit/stable-5.15 or Linus' tree as
> of a right now, both using an allyesconfig:
> 
> % git show-ref HEAD
> a9c9a6f741cdaa2fa9ba24a790db8d07295761e3 refs/remotes/linus/HEAD
> % touch kernel/audit_tree.c
> % make C=1 kernel/
>   CALL    scripts/checksyscalls.sh
>   CALL    scripts/atomic/check-atomics.sh
>   DESCEND objtool
>   CHK     kernel/kheaders_data.tar.xz
>   CC      kernel/audit_tree.o
>   CHECK   kernel/audit_tree.c
>   AR      kernel/built-in.a
> 
> What tree and config are you using where you see this error?  Looking
> at your error, I'm guessing this is limited to ppc builds, and if I
> look at the arch/powerpc/include/asm/machdep.h file in Linus tree I
> don't see a static_call.h include so I'm guessing this is a -next tree
> for ppc?  Something else?
> 
> Without knowing the context, is adding the static_call.h include in
> arch/powerpc/include/asm/machdep.h intentional or simply a bit of
> include file creep?
> 

struct machdep_calls in asm/machdep.h is full of function pointers and 
I'm working on converting that to static_calls 
(https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=260878&state=*)

So yes, adding static_call.h in asm/machdep.h is intentional and the 
issue was detected by CI build test 
(http://kisskb.ellerman.id.au/kisskb/buildresult/14628100/)

I submitted this change to you because for me it make sense to not 
re-use globably defined struct names in local C files, and anybody may 
encounter the problem as soon as linux/node.h gets included directly or 
indirectly. But if you prefer I guess the fix may be merged through 
powerpc tree as part of this series.

Thanks,
Christophe

  reply	other threads:[~2021-09-06  6:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 15:48 [PATCH] audit: Fix build failure by renaming struct node to struct audit_node Christophe Leroy
2021-09-03 17:06 ` Paul Moore
2021-09-06  6:41   ` LEROY Christophe [this message]
2021-09-07 15:34     ` Paul Moore
2021-09-07 15:45       ` LEROY Christophe
2021-09-13 20:19         ` Paul Moore
2021-09-03 18:58 ` Richard Guy Briggs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2057e2ab-b303-8ec6-9c43-2c2614591925@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=eparis@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@paul-moore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).