lkml.org 
[lkml]   [2021]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] gcov: add basic gcov_info validation to gcov initialization
On Mon, Jun 07, 2021 at 11:59:45AM +0200, Peter Oberparleiter wrote:
> On 02.06.2021 12:24, Luis Henriques wrote:
> > Add a basic gcov_info struct validation helper to gcc to ensure we have
> > sane from the compiler.
> >
> > Signed-off-by: Luis Henriques <lhenriques@suse.de>
> > ---
> > Hi!
> >
> > I know this won't really validate the gcov_info struct, but it will at
> > least prevent kernel crashes in simple scenarios (such as the one I'm
> > seeing with gcc 9.3.1).
>
> Thanks for your suggestion of adding validity checking for the gcov_info
> struct. The goal you aim at is definitely something that we want to have
> to reduce the impact of fallout from changes to GCC's gcov_info struct.
>
> In my opinion though the approach you described - looking at the
> contents of specific fields in gcov_info - isn't the correct way to go
> forward. Since you cannot know how gcov_info changed, accessing any data
> in it is very dangerous. Even if there's no out-of-bounds access (if the
> struct's size was reduced) the field you are checking could have moved
> elsewhere so the meaningfulness of the check is very limited.
>
> In a previous discussion on the same topic I proposed a different
> approach for a build-time check that would fully check the compatibility
> of kernel code and GCC-emitted gcov-related data structures. See:
>
> https://lore.kernel.org/patchwork/patch/1393585/#1592411
>

Thanks, I see the problem is way more complex and I understand that my
patch is just wrong. Thanks for pointing me at this thread.

> Unfortunately I have not yet found the time to implement this approach
> but it's still on my to-do-list.
>
> Regarding the cause of the error you're seeing I'll have a look at the
> corresponding GCC source to see if there's anything that could be
> causing the issue.

Great, thanks. Let me know if you need me to provide more info or
testing. I'll be glad to help.

Cheers,
--
Luís

\
 
 \ /
  Last update: 2021-06-07 12:48    [W:0.398 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site