02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

09 Sep, 2017

1 commit

  • I had stupidly missed one special use of 'is_reserved_word()' when I
    converted the code to avoid gperf.

    I had changed that function to return the token ID directly rather than
    a pointer to the token descriptor structure, but that meant that the
    test for "is this a reserved word" changed from checking the return
    value against NULL, to checking that it wasn't negative.

    And while I had converted the main token parser over, I missed the
    special case of the typeof phrase handling. And since our dependency
    chain for genksyms does not include the genksyms program itself
    changing, my kernel rebuild didn't show the problem.

    Fixes: bb3290d91695 ("Remove gperf usage from toolchain")
    Reported-by: Masahiro Yamada
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

20 Aug, 2017

1 commit

  • It turns out that gperf-3.1 changed types in the generated code in ways
    that aren't even trivially detectable without having to generate a test-file.

    It's just not worth using tools and libraries from clowns that don't
    understand or care about compatibility. So get rid of gperf.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

06 Jun, 2017

1 commit

  • When compiling with -Wsuggest-attribute=format in HOSTCFLAGS, gcc
    complains that error_with_pos() may be declared with a printf format
    attribute:

    scripts/genksyms/genksyms.c:726:3: warning: function might be
    possible candidate for ‘gnu_printf’ format attribute
    [-Wsuggest-attribute=format]
    vfprintf(stderr, fmt, args);
    ^~~~~~~~

    This would allow catching printf-format errors at compile time in
    callers to error_with_pos(). Add this attribute.

    Signed-off-by: Nicolas Iooss
    Signed-off-by: Masahiro Yamada

    Nicolas Iooss
     

11 Mar, 2017

1 commit


04 Feb, 2017

1 commit

  • This add the kbuild infrastructure that will allow architectures to emit
    vmlinux symbol CRCs as 32-bit offsets to another location in the kernel
    where the actual value is stored. This works around problems with CRCs
    being mistaken for relocatable symbols on kernels that self relocate at
    runtime (i.e., powerpc with CONFIG_RELOCATABLE=y)

    For the kbuild side of things, this comes down to the following:

    - introducing a Kconfig symbol MODULE_REL_CRCS

    - adding a -R switch to genksyms to instruct it to emit the CRC symbols
    as references into the .rodata section

    - making modpost distinguish such references from absolute CRC symbols
    by the section index (SHN_ABS)

    - making kallsyms disregard non-absolute symbols with a __crc_ prefix

    Signed-off-by: Ard Biesheuvel
    Signed-off-by: Linus Torvalds

    Ard Biesheuvel
     

05 Jan, 2017

2 commits

  • Regenerate the parser after d920f7c6628c ("genksyms: Fix segfault with
    invalid declarations").

    Reported-and-tested-by: Borislav Petkov
    Signed-off-by: Michal Marek

    Michal Marek
     
  • Do not try to recover too early and segfault when parsing invalid
    declarations such as

    echo 'int (int);' | scripts/genksyms/genksyms
    echo 'int a, (int);' | scripts/genksyms/genksyms
    echo 'extern void *__inline_memcpy((void *), (const void *), (__kernel_size_t));' | scripts/genksyms/genksyms

    The last one was a real-life bug with
    include/asm-generic/asm-prototypes.h on x86_64.

    Reported-and-tested-by: Borislav Petkov
    Signed-off-by: Michal Marek

    Michal Marek
     

29 Nov, 2016

2 commits

  • Regenerate the keyword table and parser after commit 0efdb2282343
    ("kbuild/genksyms: handle va_list type").

    Signed-off-by: Michal Marek

    Michal Marek
     
  • genksyms currently does not handle va_list. Add the __builtin_va_list
    keyword as a type. This reduces the amount of syntax errors thrown,
    but so far no export symbol has a type with a va_list argument, so
    there is currently no bug in the end result.

    Note: this patch does not regenerate shipped parser files.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michal Marek

    Nicholas Piggin
     

26 Aug, 2016

2 commits

  • Update the lexer after 4fab91605a6b ("kbuild: genksyms fix for typeof
    handling").

    Signed-off-by: Michal Marek

    Michal Marek
     
  • The tokenizer misses counting an open-parenthesis when parsing a
    non-trivial typeof beginning with an open-parenthesis. This function
    in include/linux/ceph/libceph.h

    static type *lookup_##name(struct rb_root *root,
    typeof(((type *)0)->keyfld) key)

    When instantiated in net/ceph/mon_client.c, causes subsequent symbols
    including an EXPORT_SYMBOL in that file to be lost.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Michal Marek

    Nicholas Piggin
     

20 Apr, 2016

1 commit


09 Dec, 2015

1 commit

  • The reference files use spaces to separate tokens, however, we must
    preserve spaces inside string literals. Currently the only case in the
    tree is struct edac_raw_error_desc in :

    $ KBUILD_SYMTYPES=1 make -s drivers/edac/amd64_edac.symtypes
    $ mv drivers/edac/amd64_edac.{symtypes,symref}
    $ KBUILD_SYMTYPES=1 make -s drivers/edac/amd64_edac.symtypes
    drivers/edac/amd64_edac.c:527: warning: amd64_get_dram_hole_info: modversion changed because of changes in struct edac_raw_error_desc

    Signed-off-by: Michal Marek

    Michal Marek
     

20 Aug, 2015

2 commits

  • Rebuild the parser after commit 1c722503fa81 (genksyms: Duplicate
    function pointer type definitions segfault), using bison 2.7.

    Signed-off-by: Michal Marek

    Michal Marek
     
  • I noticed that genksyms will segfault when it sees duplicate function
    pointer type declaration when I placed the same function pointer
    definition in two separate headers in a local branch as an intermediate
    step of some refactoring. This can be reproduced by piping the following
    minimal test case into `genksyms -r /dev/null` or alternatively, putting
    it into a C file attempting a build:

    typedef int (*f)();
    typedef int (*f)();

    Attaching gdb to genksyms to understand this failure is useless without
    changing CFLAGS to emit debuginfo. Once you have debuginfo, you will
    find that the failure is that `char *s` was NULL and the program
    executed `while(*s)`. At which point, further debugging requires
    familiarity with compiler front end / parser development.

    What happens is that flex identifies the first instance of the token "f"
    as IDENT and the yacc parser adds it to the symbol table. On the second
    instance, flex will identify "f" as TYPE, which triggers an error case
    in the yacc parser. Given that TYPE would have been IDENT had it not
    been in the symbol table, the the segmentaion fault could be avoided by
    treating TYPE as IDENT in the affected rule.

    Some might consider placing identical function pointer type declarations
    in different headers to be poor style might consider a failure to be
    beneficial. However, failing through a segmentation fault makes the
    cause non-obvious and can waste the time of anyone who encounters it.

    Signed-off-by: Richard Yao
    Acked-by: Madhuri Yechuri
    Signed-off-by: Michal Marek

    Richard Yao
     

04 Apr, 2014

1 commit

  • Recent increased use of typeof() throughout the tree resulted in a
    number of symbols (25 in a typical distro config of ours) not getting a
    proper CRC calculated for them anymore, due to the parser in genksyms
    not coping with several of these uses (interestingly in the majority of
    [if not all] cases the problem is due to the use of typeof() in code
    preceding a certain export, not in the declaration/definition of the
    exported function/object itself; I wasn't able to find a way to address
    this more general parser shortcoming).

    The use of parameter_declaration is a little more relaxed than would be
    ideal (permitting not just a bare type specification, but also one with
    identifier), but since the same code is being passed through an actual
    compiler, there's no apparent risk of allowing through any broken code.

    Otoh using parameter_declaration instead of the ad hoc
    "decl_specifier_seq '*'" / "decl_specifier_seq" pair allows all types to
    be handled rather than just plain ones and pointers to plain ones.

    Signed-off-by: Jan Beulich
    Cc: Michal Marek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Beulich
     

20 Mar, 2013

1 commit

  • Pass symbol-prefix to genksyms instead of arch, so that the decision
    what symbol prefix to use is kept in one place.

    Basically genksyms used to take a -a $ARCH argument and it used that to
    determine whether to add an underscore symbol prefix. It's now changed
    to take a -s $SYMBOL_PREFIX argument so that the caller decides whether
    a symbol prefix is required. The build system then uses
    CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX to determine whether to pass the
    argument.

    Signed-off-by: James Hogan
    Signed-off-by: Rusty Russell

    James Hogan
     

03 Mar, 2013

1 commit


08 Jan, 2012

1 commit


11 Oct, 2011

3 commits


25 Jul, 2011

1 commit

  • The ARRAY_SIZE macro in scripts/genksyms/genksyms.c returns a value of
    type size_t. That value is being compared to a variable of type int in
    a loop in read_node(). Change the int variable to size_t type as well,
    so we don't do signed vs unsigned type comparisons with all the
    potential promotion/sign extension trouble that can cause (also
    silences compiler warnings at high levels of warnings).

    Signed-off-by: Jesper Juhl
    Signed-off-by: Michal Marek

    Jesper Juhl
     

10 Jun, 2011

4 commits


17 Mar, 2011

7 commits


25 Nov, 2010

1 commit


02 Feb, 2010

1 commit


12 Dec, 2009

1 commit

  • Despite being unused these should also get a CRC calculated.
    Primarily I view this as a consistency thing. But I also think this is
    one of the reasons why __crc_* need to be weak (which I think should be
    avoided, and hence we should have the goal to eliminate this so that
    failure to calculate a proper CRC for a symbol causes the build to fail).

    Signed-off-by: Jan Beulich
    Cc: Anibal Monsalve Salazar
    Cc: Steven Rostedt
    Cc: Sam Ravnborg
    Signed-off-by: Andrew Morton
    Signed-off-by: Michal Marek

    Jan Beulich
     

16 Nov, 2009

1 commit

  • The genksyms keyword gperf hash provides a function is_reserved_word.
    genksyms #includes the resulting generated file keywords.c, so the
    function gets used only in the same source file that defines it. Mark
    is_reserved_word static, and regenerate the corresponding generated
    file.

    Signed-off-by: Josh Triplett

    Josh Triplett
     

23 Sep, 2009

1 commit