Re: [PATCH v5 01/12] modpost: split the section mismatch checks into section-check.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 12, 2022 at 7:31 AM Nick Desaulniers
<ndesaulniers@xxxxxxxxxx> wrote:
>
> On Wed, May 11, 2022 at 9:49 AM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> >
> > -/* sections that we do not want to do full section mismatch check on */
> > -static const char *const section_white_list[] =
> > -{
> > -       ".comment*",
> > -       ".debug*",
> > -       ".cranges",             /* sh64 */
> > -       ".zdebug*",             /* Compressed debug sections. */
> > -       ".GCC.command.line",    /* record-gcc-switches */
> > -       ".mdebug*",        /* alpha, score, mips etc. */
> > -       ".pdr",            /* alpha, score, mips etc. */
> > -       ".stab*",
> > -       ".note*",
> > -       ".got*",
> > -       ".toc*",
> > -       ".xt.prop",                              /* xtensa */
> > -       ".xt.lit",         /* xtensa */
> > -       ".arcextmap*",                  /* arc */
> > -       ".gnu.linkonce.arcext*",        /* arc : modules */
> > -       ".cmem*",                       /* EZchip */
> > -       ".fmt_slot*",                   /* EZchip */
> > -       ".gnu.lto*",
> > -       ".discard.*",
> > -       NULL
> > -};
>
>
> > -/**
> > - * Whitelist to allow certain references to pass with no warning.
> > - *
> > - * Pattern 1:
> > - *   If a module parameter is declared __initdata and permissions=0
> > - *   then this is legal despite the warning generated.
> > - *   We cannot see value of permissions here, so just ignore
> > - *   this pattern.
> > - *   The pattern is identified by:
> > - *   tosec   = .init.data
> > - *   fromsec = .data*
> > - *   atsym   =__param*
> > - *
> > - * Pattern 1a:
> > - *   module_param_call() ops can refer to __init set function if permissions=0
> > - *   The pattern is identified by:
> > - *   tosec   = .init.text
> > - *   fromsec = .data*
> > - *   atsym   = __param_ops_*
> > - *
> > - * Pattern 2:
> > - *   Many drivers utilise a *driver container with references to
> > - *   add, remove, probe functions etc.
> > - *   the pattern is identified by:
> > - *   tosec   = init or exit section
> > - *   fromsec = data section
> > - *   atsym = *driver, *_template, *_sht, *_ops, *_probe,
> > - *           *probe_one, *_console, *_timer
> > - *
> > - * Pattern 3:
> > - *   Whitelist all references from .head.text to any init section
> > - *
> > - * Pattern 4:
> > - *   Some symbols belong to init section but still it is ok to reference
> > - *   these from non-init sections as these symbols don't have any memory
> > - *   allocated for them and symbol address and value are same. So even
> > - *   if init section is freed, its ok to reference those symbols.
> > - *   For ex. symbols marking the init section boundaries.
> > - *   This pattern is identified by
> > - *   refsymname = __init_begin, _sinittext, _einittext
> > - *
> > - * Pattern 5:
> > - *   GCC may optimize static inlines when fed constant arg(s) resulting
> > - *   in functions like cpumask_empty() -- generating an associated symbol
> > - *   cpumask_empty.constprop.3 that appears in the audit.  If the const that
> > - *   is passed in comes from __init, like say nmi_ipi_mask, we get a
> > - *   meaningless section warning.  May need to add isra symbols too...
> > - *   This pattern is identified by
> > - *   tosec   = init section
> > - *   fromsec = text section
> > - *   refsymname = *.constprop.*
> > - *
> > - * Pattern 6:
> > - *   Hide section mismatch warnings for ELF local symbols.  The goal
> > - *   is to eliminate false positive modpost warnings caused by
> > - *   compiler-generated ELF local symbol names such as ".LANCHOR1".
> > - *   Autogenerated symbol names bypass modpost's "Pattern 2"
> > - *   whitelisting, which relies on pattern-matching against symbol
> > - *   names to work.  (One situation where gcc can autogenerate ELF
> > - *   local symbols is when "-fsection-anchors" is used.)
> > - **/
>
> Losing the ability to git blame (from the top level) the above lines
> does cause me grief and mental anguish though. It's not gone, just
> buried a bit deeper.


According to 'man git-blame', -C option is needed
to follow the code move between files.

git blame -C  scripts/mod/section-check.c

showed me the origin commit of each line.





> --
> Thanks,
> ~Nick Desaulniers



--
Best Regards
Masahiro Yamada



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux