Linux Hardening
 help / color / mirror / Atom feed
* __fortify_panic() question
@ 2024-05-29 14:36 Jeff Johnson
  2024-05-29 16:55 ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Johnson @ 2024-05-29 14:36 UTC (permalink / raw)
  To: linux-hardening; +Cc: Kees Cook

'make W=1 C=1' on x86 gives the warning:
arch/x86/boot/compressed/misc.c:535:6: warning: symbol '__fortify_panic' was not declared. Should it be static?

Looking at this I see for ARM there is a prototype for __fortify_panic() in
arch/arm/boot/compressed/misc.h
And there is a matching implementation in arch/arm/boot/compressed/misc.c

But for x86 there is only the implementation in
arch/x86/boot/compressed/misc.c
There is not a prototype in arch/x86/boot/compressed/misc.h.

The easy fix for this would be to add a prototype to
arch/x86/boot/compressed/misc.h.

But it seems strange to me to add a prototype to a header file that is only 
for the benefit of the callee and is not the prototype/header used by the 
caller, in this case the one in include/linux/fortify-string.h

Is there a reason this prototype can't be defined in a single header file that 
is then included by all callers and callees?

/jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: __fortify_panic() question
  2024-05-29 14:36 __fortify_panic() question Jeff Johnson
@ 2024-05-29 16:55 ` Kees Cook
  2024-05-29 17:09   ` Jeff Johnson
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2024-05-29 16:55 UTC (permalink / raw)
  To: Jeff Johnson; +Cc: linux-hardening

On Wed, May 29, 2024 at 07:36:25AM -0700, Jeff Johnson wrote:
> 'make W=1 C=1' on x86 gives the warning:
> arch/x86/boot/compressed/misc.c:535:6: warning: symbol '__fortify_panic' was not declared. Should it be static?

Hm, I can't reproduce this currently (but yes, it looks like arm vs x86
is mismatched). What tree is this?

> Looking at this I see for ARM there is a prototype for __fortify_panic() in
> arch/arm/boot/compressed/misc.h
> And there is a matching implementation in arch/arm/boot/compressed/misc.c
> 
> But for x86 there is only the implementation in
> arch/x86/boot/compressed/misc.c
> There is not a prototype in arch/x86/boot/compressed/misc.h.
> 
> The easy fix for this would be to add a prototype to
> arch/x86/boot/compressed/misc.h.

Yeah, I think this is the right solution.

> But it seems strange to me to add a prototype to a header file that is only 
> for the benefit of the callee and is not the prototype/header used by the 
> caller, in this case the one in include/linux/fortify-string.h

The stuff in boot/ doesn't tend to include fortify-string.h (since it's
sort of "outside" the kernel), hence the need for additional prototypes.

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: __fortify_panic() question
  2024-05-29 16:55 ` Kees Cook
@ 2024-05-29 17:09   ` Jeff Johnson
  2024-05-29 17:18     ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Johnson @ 2024-05-29 17:09 UTC (permalink / raw)
  To: Kees Cook; +Cc: linux-hardening

On 5/29/2024 9:55 AM, Kees Cook wrote:
> On Wed, May 29, 2024 at 07:36:25AM -0700, Jeff Johnson wrote:
>> 'make W=1 C=1' on x86 gives the warning:
>> arch/x86/boot/compressed/misc.c:535:6: warning: symbol '__fortify_panic' was not declared. Should it be static?
> 
> Hm, I can't reproduce this currently (but yes, it looks like arm vs x86
> is mismatched). What tree is this?

e0cce98fe279 (linus/master, linux-master) Merge tag 'tpmdd-next-6.10-rc2' of
git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd

> 
>> Looking at this I see for ARM there is a prototype for __fortify_panic() in
>> arch/arm/boot/compressed/misc.h
>> And there is a matching implementation in arch/arm/boot/compressed/misc.c
>>
>> But for x86 there is only the implementation in
>> arch/x86/boot/compressed/misc.c
>> There is not a prototype in arch/x86/boot/compressed/misc.h.
>>
>> The easy fix for this would be to add a prototype to
>> arch/x86/boot/compressed/misc.h.
> 
> Yeah, I think this is the right solution.

You want to do this, or should I?

> 
>> But it seems strange to me to add a prototype to a header file that is only 
>> for the benefit of the callee and is not the prototype/header used by the 
>> caller, in this case the one in include/linux/fortify-string.h
> 
> The stuff in boot/ doesn't tend to include fortify-string.h (since it's
> sort of "outside" the kernel), hence the need for additional prototypes.
> 

thanks for the info!

/jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: __fortify_panic() question
  2024-05-29 17:09   ` Jeff Johnson
@ 2024-05-29 17:18     ` Kees Cook
  0 siblings, 0 replies; 4+ messages in thread
From: Kees Cook @ 2024-05-29 17:18 UTC (permalink / raw)
  To: Jeff Johnson; +Cc: linux-hardening

On Wed, May 29, 2024 at 10:09:45AM -0700, Jeff Johnson wrote:
> On 5/29/2024 9:55 AM, Kees Cook wrote:
> > On Wed, May 29, 2024 at 07:36:25AM -0700, Jeff Johnson wrote:
> >> 'make W=1 C=1' on x86 gives the warning:
> >> arch/x86/boot/compressed/misc.c:535:6: warning: symbol '__fortify_panic' was not declared. Should it be static?
> > 
> > Hm, I can't reproduce this currently (but yes, it looks like arm vs x86
> > is mismatched). What tree is this?
> 
> e0cce98fe279 (linus/master, linux-master) Merge tag 'tpmdd-next-6.10-rc2' of
> git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd
> 
> > 
> >> Looking at this I see for ARM there is a prototype for __fortify_panic() in
> >> arch/arm/boot/compressed/misc.h
> >> And there is a matching implementation in arch/arm/boot/compressed/misc.c
> >>
> >> But for x86 there is only the implementation in
> >> arch/x86/boot/compressed/misc.c
> >> There is not a prototype in arch/x86/boot/compressed/misc.h.
> >>
> >> The easy fix for this would be to add a prototype to
> >> arch/x86/boot/compressed/misc.h.
> > 
> > Yeah, I think this is the right solution.
> 
> You want to do this, or should I?

Please feel free! I'd appreciate it. :)

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-29 17:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-29 14:36 __fortify_panic() question Jeff Johnson
2024-05-29 16:55 ` Kees Cook
2024-05-29 17:09   ` Jeff Johnson
2024-05-29 17:18     ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox