29 Jul, 2020

1 commit

  • [ Upstream commit 7359608a271ce81803de148befefd309baf88c76 ]

    Commit ed66f991bb19 ("module: Refactor section attr into bin attribute")
    removed the 'name' field from 'struct module_sect_attr' triggering the
    following error when invoking lx-symbols:

    (gdb) lx-symbols
    loading vmlinux
    scanning for modules in linux/build
    loading @0xffffffffc014f000: linux/build/drivers/net/tun.ko
    Python Exception There is no member named name.:
    Error occurred in Python: There is no member named name.

    This patch fixes the issue taking the module name from the 'struct
    attribute'.

    Fixes: ed66f991bb19 ("module: Refactor section attr into bin attribute")
    Signed-off-by: Stefano Garzarella
    Signed-off-by: Andrew Morton
    Reviewed-by: Jan Kiszka
    Reviewed-by: Kieran Bingham
    Link: http://lkml.kernel.org/r/20200722102239.313231-1-sgarzare@redhat.com
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Stefano Garzarella
     

27 May, 2020

1 commit

  • [ Upstream commit 50e36be1fb9572b2e4f2753340bdce3116bf2ce7 ]

    The current implementations of the rb_first() and rb_last() gdb
    functions have a variable that references itself in its instanciation,
    which causes the function to throw an error if a specific condition on
    the argument is met. The original author rather intended to reference
    the argument and made a typo. Referring the argument instead makes the
    function work as intended.

    Signed-off-by: Aymeric Agon-Rambosson
    Signed-off-by: Andrew Morton
    Reviewed-by: Stephen Boyd
    Cc: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Jackie Liu
    Cc: Jason Wessel
    Link: http://lkml.kernel.org/r/20200427051029.354840-1-aymeric.agon@yandex.com
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Aymeric Agon-Rambosson
     

07 Nov, 2019

1 commit

  • gcc's -freorder-blocks-and-partition option makes it group frequently
    and infrequently used code in .text.hot and .text.unlikely sections
    respectively. At least when building modules on s390, this option is
    used by default.

    gdb assumes that all code is located in .text section, and that .text
    section is located at module load address. With such modules this is no
    longer the case: there is code in .text.hot and .text.unlikely, and
    either of them might precede .text.

    Fix by explicitly telling gdb the addresses of code sections.

    It might be tempting to do this for all sections, not only the ones in
    the white list. Unfortunately, gdb appears to have an issue, when
    telling it about e.g. loadable .note.gnu.build-id section causes it to
    think that non-loadable .note.Linux section is loaded at address 0,
    which in turn causes NULL pointers to be resolved to bogus symbols. So
    keep using the white list approach for the time being.

    Link: http://lkml.kernel.org/r/20191028152734.13065-1-iii@linux.ibm.com
    Signed-off-by: Ilya Leoshkevich
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Heiko Carstens
    Cc: Vasily Gorbik
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ilya Leoshkevich
     

19 Oct, 2019

2 commits

  • Currently lx-symbols assumes that module text is always located at
    module->core_layout->base, but s390 uses the following layout:

    +------+ core_layout->base
    | GOT |
    +------+ core_layout->base + module->arch->plt_offset
    | PLT |
    +------+ core_layout->base + module->arch->plt_offset +
    | TEXT | module->arch->plt_size
    +------+

    Therefore, when trying to debug modules on s390, all the symbol
    addresses are skewed by plt_offset + plt_size.

    Fix by adding plt_offset + plt_size to module_addr in
    load_module_symbols().

    Link: http://lkml.kernel.org/r/20191017085917.81791-1-iii@linux.ibm.com
    Signed-off-by: Ilya Leoshkevich
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Heiko Carstens
    Cc: Vasily Gorbik
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ilya Leoshkevich
     
  • When CONFIG_PRINTK_CALLER is set, struct printk_log contains an
    additional member caller_id. This affects the offset of the log text.
    Account for this by using the type information from gdb to determine all
    the offsets instead of using hardcoded values.

    This fixes following error:

    (gdb) lx-dmesg
    Python Exception embedded null character:
    Error occurred in Python command: embedded null character

    The read_u* utility functions now take an offset argument to make them
    easier to use.

    Link: http://lkml.kernel.org/r/20191011142500.2339-1-joel.colledge@linbit.com
    Signed-off-by: Joel Colledge
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Leonard Crestez
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joel Colledge
     

26 Sep, 2019

1 commit

  • Some systems (like Chrome OS) may use "split debug" for kernel modules.
    That means that the debug symbols are in a different file than the main
    elf file. Let's handle that by also searching for debug symbols that end
    in ".ko.debug".

    This is a packaging topic. You can take a normal elf file and split the
    debug out of it using objcopy. Try "man objcopy" and then take a look at
    the "--only-keep-debug" option. It'll give you a whole recipe for doing
    splitdebug. The suffix used for the debug symbols is arbitrary. If
    people have other another suffix besides ".ko.debug" then we could
    presumably support that too...

    For portage (which is the packaging system used by Chrome OS) split debug
    is supported by default (and the suffix is .ko.debug). ...and so in
    Chrome OS we always get the installed elf files stripped and then the
    symbols stashed away.

    At the moment we don't actually use the normal portage magic to do this
    for the kernel though since it affects our ability to get good stack dumps
    in the kernel. We instead pass a script as "strip" [1].

    [1] https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/refs/heads/master/eclass/cros-kernel/strip_splitdebug

    Link: http://lkml.kernel.org/r/20190730234052.148744-1-dianders@chromium.org
    Signed-off-by: Douglas Anderson
    Reviewed-by: Stephen Boyd
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Jason Wessel
    Cc: Daniel Thompson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Douglas Anderson
     

17 Jul, 2019

2 commits

  • Add helper commands and functions for finding pointers to struct device
    by enumerating linux device bus/class infrastructure. This can be used
    to fetch subsystem and driver-specific structs:

    (gdb) p *$container_of($lx_device_find_by_class_name("net", "eth0"), "struct net_device", "dev")
    (gdb) p *$container_of($lx_device_find_by_bus_name("i2c", "0-004b"), "struct i2c_client", "dev")
    (gdb) p *(struct imx_port*)$lx_device_find_by_class_name("tty", "ttymxc1")->parent->driver_data

    Several generic "lx-device-list" functions are included to enumerate
    devices by bus and class:

    (gdb) lx-device-list-bus usb
    (gdb) lx-device-list-class
    (gdb) lx-device-list-tree &platform_bus

    Similar information is available in /sys but pointer values are
    deliberately hidden.

    Link: http://lkml.kernel.org/r/c948628041311cbf1b9b4cff3dda7d2073cb3eaa.1561492937.git.leonard.crestez@nxp.com
    Signed-off-by: Leonard Crestez
    Reviewed-by: Stephen Boyd
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: "Rafael J. Wysocki"
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • This is like /sys/kernel/debug/pm/pm_genpd_summary except it's
    accessible through a debugger.

    This can be useful if the target crashes or hangs because power domains
    were not properly enabled.

    Link: http://lkml.kernel.org/r/f9ee627a0d4f94b894aa202fee8a98444049bed8.1561492937.git.leonard.crestez@nxp.com
    Signed-off-by: Leonard Crestez
    Reviewed-by: Stephen Boyd
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: "Rafael J. Wysocki"
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     

10 Jul, 2019

1 commit

  • Commit 25b146c5b8ce ("kbuild: allow Kbuild to start from any directory")
    deprecated KBUILD_SRCTREE.

    It is only used in tools/testing/selftest/ to distinguish out-of-tree
    build. Replace it with a new boolean flag, building_out_of_srctree.

    I also replaced the conditional ($(srctree),.) because the next commit
    will allow an absolute path to be used for $(srctree) even when building
    in the source tree.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

02 Jun, 2019

1 commit

  • CLK_GET_RATE_NOCACHE depends on CONFIG_COMMON_CLK. Importing constants.py
    when CONFIG_COMMON_CLK is not defined causes:

    (gdb) lx-symbols
    (...)
    File "scripts/gdb/linux/proc.py", line 15, in
    from linux import constants
    File "scripts/gdb/linux/constants.py", line 2, in
    LX_CLK_GET_RATE_NOCACHE = gdb.parse_and_eval("CLK_GET_RATE_NOCACHE")
    gdb.error: No symbol "CLK_GET_RATE_NOCACHE" in current context.

    Link: http://lkml.kernel.org/r/20190523195313.24701-1-farosas@linux.ibm.com
    Fixes: e7e6f462c1be ("scripts/gdb: print cached rate in lx-clk-summary")
    Signed-off-by: Fabiano Rosas
    Reviewed-by: Stephen Boyd
    Cc: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Leonard Crestez
    Cc: Jackie Liu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabiano Rosas
     

21 May, 2019

1 commit


15 May, 2019

10 commits

  • The clk rate is always stored in clk_core but might be out of date and
    require calls to update from hardware.

    Deal with that case by printing a (c) suffix.

    Link: http://lkml.kernel.org/r/1a474318982a5f0125f2360c4161029b17f56bd1.1556881728.git.leonard.crestez@nxp.com
    Signed-off-by: Leonard Crestez
    Cc: Jan Kiszka
    Cc: Jason Wessel
    Cc: Kieran Bingham
    Cc: Stephen Boyd
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • An incorrect argument to list_for_each is an internal error in gdb
    scripts so a TypeError should be raised. The gdb.GdbError exception
    type is intended for user errors such as incorrect invocation.

    Drop the type assertion in list_for_each_entry because list_for_each
    isn't going to suddenly yield something else.

    Applies to both list and hlist

    Link: http://lkml.kernel.org/r/c1d3fd4db13d999a3ba57f5bbc1924862d824f61.1556881728.git.leonard.crestez@nxp.com
    Signed-off-by: Leonard Crestez
    Reviewed-by: Stephen Boyd
    Cc: Jan Kiszka
    Cc: Jason Wessel
    Cc: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • Finding an individual clk_core requires walking the tree which can be
    quite complicated so add a helper for easy access.

    (gdb) print *(struct clk_scu*)$lx_clk_core_lookup("uart0_clk")->hw

    Link: http://lkml.kernel.org/r/Message-ID:
    Signed-off-by: Leonard Crestez
    Cc: Jan Kiszka
    Cc: Jason Wessel
    Cc: Kieran Bingham
    Cc: Stephen Boyd
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • Add an lx-clk-summary command which prints a subset of
    /sys/kernel/debug/clk/clk_summary.

    This can be used to examine hangs caused by clk not being enabled.

    Link: http://lkml.kernel.org/r/Message-ID:
    Signed-off-by: Leonard Crestez
    Cc: Jan Kiszka
    Cc: Jason Wessel
    Cc: Kieran Bingham
    Cc: Stephen Boyd
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • This allows easily examining kernel hlists in python.

    Link: http://lkml.kernel.org/r/Message-ID:
    Signed-off-by: Leonard Crestez
    Reviewed-by: Stephen Boyd
    Cc: Jason Wessel
    Cc: Jan Kiszka
    Cc: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • These scripts have some pep8 style warnings. Fix them up so that this
    directory is all pep8 clean.

    Link: http://lkml.kernel.org/r/20190329220844.38234-6-swboyd@chromium.org
    Signed-off-by: Stephen Boyd
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: Jackie Liu
    Cc: Jason Wessel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     
  • Implement a command to print the timer list, much like how
    /proc/timer_list is implemented. This can be used to look at the
    pending timers on a crashed system.

    [swboyd@chromium.org: v2]
    Link: http://lkml.kernel.org/r/20190329220844.38234-5-swboyd@chromium.org
    Link: http://lkml.kernel.org/r/20190325184522.260535-5-swboyd@chromium.org
    Signed-off-by: Stephen Boyd
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: Jackie Liu
    Cc: Jason Wessel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     
  • Implement gdb functions for rb_first(), rb_last(), rb_next(), and
    rb_prev(). These can be useful to iterate through the kernel's
    red-black trees.

    [swboyd@chromium.org: v2]
    Link: http://lkml.kernel.org/r/20190329220844.38234-4-swboyd@chromium.org
    Link: http://lkml.kernel.org/r/20190325184522.260535-4-swboyd@chromium.org
    Signed-off-by: Stephen Boyd
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: Jackie Liu
    Cc: Jason Wessel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     
  • lx-configdump dumps the contents of the gzipped .config to a text
    file when the config is included in the kernel with CONFIG_IKCONFIG. By
    default, the file written is called config.txt, but it can be any user
    supplied filename as well. If the kernel config is in a module
    (configs.ko), then it can be loaded along with symbols for the module
    loaded with 'lx-symbols' and then this command will still work.

    Obviously if you have the whole vmlinux then this can also be achieved
    with scripts/extract-ikconfig, but this gdb script can be useful to
    confirm that the memory contents of the config in memory and the vmlinux
    contents on disk match what is expected.

    [swboyd@chromium.org: v2]
    Link: http://lkml.kernel.org/r/20190329220844.38234-3-swboyd@chromium.org
    Link: http://lkml.kernel.org/r/20190325184522.260535-3-swboyd@chromium.org
    Signed-off-by: Stephen Boyd
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: Jackie Liu
    Cc: Jason Wessel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     
  • Patch series "gdb script for kconfig and timer list".

    This is a handful of changes to the kernel's gdb scripts to do some more
    debugging with kgdb. The first patch allows the vmlinux to be reloaded
    from where it was specified on the command line so that this set of
    scripts can be used from anywhere. The second patch adds a script to
    dump the config.gz to a file on the host debugging machine. The third
    patch adds some rb tree utilities and the last patch uses those rb tree
    walking utilities to dump out the contents of /proc/timer_list from a
    system under debug.

    This patch (of 5):

    If I run 'gdb ' and there's the vmlinux-gdb.py file
    there I can properly see symbols and use the lx commands provided by the
    GDB scripts. But once I run 'lx-symbols' at the command prompt, gdb
    reloads the vmlinux symbols assuming that this script was run from the
    directory that has vmlinux at the root. That isn't always true, but we
    could just look and see what symbols were already loaded and use that
    instead. Let's do that so this can work by being invoked anywhere.

    Link: http://lkml.kernel.org/r/20190325184522.260535-2-swboyd@chromium.org
    Signed-off-by: Stephen Boyd
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: Jackie Liu
    Cc: Jason Wessel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     

02 Apr, 2019

1 commit

  • KBUILD_SRC was conventionally used for some different purposes:
    [1] To remember the source tree path
    [2] As a flag to check if sub-make is already done
    [3] As a flag to check if Kbuild runs out of tree

    For [1], we do not need to remember it because the top Makefile
    can compute it by $(realpath $(dir $(lastword $(MAKEFILE_LIST))))

    [2] has been replaced with self-commenting 'sub_make_done'.

    For [3], we can distinguish in-tree/out-of-tree by comparing
    $(srctree) and '.'

    This commit converts [3] to prepare for the KBUILD_SRC removal.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

11 Mar, 2019

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - do not generate unneeded top-level built-in.a

    - let git ignore O= directory entirely

    - optimize scripts/kallsyms slightly

    - exclude DWARF info from *.s regardless of config options

    - fix GCC toolchain search path for Clang to prepare ld.lld support

    - do not generate modules.order when CONFIG_MODULES is disabled

    - simplify single target rules and remove VPATH for external module
    build

    - allow to add optional flags to dpkg-buildpackage when building
    deb-pkg

    - move some compiler option tests from Makefile to Kconfig

    - various Makefile cleanups

    * tag 'kbuild-v5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (40 commits)
    kbuild: remove scripts/basic/% build target
    kbuild: use -Werror=implicit-... instead of -Werror-implicit-...
    kbuild: clean up scripts/gcc-version.sh
    kbuild: remove cc-version macro
    kbuild: update comment block of scripts/clang-version.sh
    kbuild: remove commented-out INITRD_COMPRESS
    kbuild: move -gsplit-dwarf, -gdwarf-4 option tests to Kconfig
    kbuild: [bin]deb-pkg: add DPKG_FLAGS variable
    kbuild: move ".config not found!" message from Kconfig to Makefile
    kbuild: invoke syncconfig if include/config/auto.conf.cmd is missing
    kbuild: simplify single target rules
    kbuild: remove empty rules for makefiles
    kbuild: make -r/-R effective in top Makefile for old Make versions
    kbuild: move tools_silent to a more relevant place
    kbuild: compute false-positive -Wmaybe-uninitialized cases in Kconfig
    kbuild: refactor cc-cross-prefix implementation
    kbuild: hardcode genksyms path and remove GENKSYMS variable
    scripts/gdb: refactor rules for symlink creation
    kbuild: create symlink to vmlinux-gdb.py in scripts_gdb target
    scripts/gdb: do not descend into scripts/gdb from scripts
    ...

    Linus Torvalds
     

08 Mar, 2019

1 commit

  • Since commit 1751e8a6cb93 ("Rename superblock flags (MS_xyz ->
    SB_xyz)"), scripts/gdb should be updated to replace MS_xyz with SB_xyz.

    This change didn't directly affect the running operation of scripts/gdb
    until commit e262e32d6bde "vfs: Suppress MS_* flag defs within the
    kernel unless explicitly enabled" removed the definitions used by
    constants.py.

    Update constants.py.in to utilise the new internal flags, matching the
    implementation at fs/proc_namespace.c::show_sb_opts.

    Note to stable, e262e32d6bde landed in v5.0-rc1 (which was just
    released), so we'll want this picked back to 5.0 stable once this patch
    hits mainline (akpm just picked it up). Without this, debugging a
    kernel a kernel via GDB+QEMU is broken in the 5.0 release.

    [kieran.bingham@ideasonboard.com: add fixes tag, reword commit message]
    Link: http://lkml.kernel.org/r/20190305103014.25847-1-kieran.bingham@ideasonboard.com
    Fixes: e262e32d6bde "vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled"
    Signed-off-by: Jackie Liu
    Signed-off-by: Kieran Bingham
    Tested-by: Nick Desaulniers
    Tested-by: Kieran Bingham
    Cc: Felipe Balbi
    Cc: Dan Robertson
    Cc: Jan Kiszka
    Cc: David Howells
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jackie Liu
     

27 Feb, 2019

2 commits


05 Jan, 2019

1 commit

  • A bug is present in GDB which causes early string termination when
    parsing variables. This has been reported [0], but we should ensure
    that we can support at least basic printing of the core kernel strings.

    For current gdb version (has been tested with 7.3 and 8.1), 'lx-version'
    only prints one character.

    (gdb) lx-version
    L(gdb)

    This can be fixed by casting 'linux_banner' as (char *).

    (gdb) lx-version
    Linux version 4.19.0-rc1+ (changbin@acer) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #21 SMP Sat Sep 1 21:43:30 CST 2018

    [0] https://sourceware.org/bugzilla/show_bug.cgi?id=20077

    [kbingham@kernel.org: add detail to commit message]
    Link: http://lkml.kernel.org/r/20181111162035.8356-1-kieran.bingham@ideasonboard.com
    Fixes: 2d061d999424 ("scripts/gdb: add version command")
    Signed-off-by: Du Changbin
    Signed-off-by: Kieran Bingham
    Acked-by: Jan Kiszka
    Cc: Jan Kiszka
    Cc: Jason Wessel
    Cc: Daniel Thompson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Du Changbin
     

20 Jan, 2018

1 commit

  • Since kernel 4.9, the thread_info has been moved into task_struct, no
    longer locates at the bottom of kernel stack.

    See commits c65eacbe290b ("sched/core: Allow putting thread_info into
    task_struct") and 15f4eae70d36 ("x86: Move thread_info into
    task_struct").

    Before fix:
    (gdb) set $current = $lx_current()
    (gdb) p $lx_thread_info($current)
    $1 = {flags = 1470918301}
    (gdb) p $current.thread_info
    $2 = {flags = 2147483648}

    After fix:
    (gdb) p $lx_thread_info($current)
    $1 = {flags = 2147483648}
    (gdb) p $current.thread_info
    $2 = {flags = 2147483648}

    Link: http://lkml.kernel.org/r/20180118210159.17223-1-imxikangjie@gmail.com
    Fixes: 15f4eae70d36 ("x86: Move thread_info into task_struct")
    Signed-off-by: Xi Kangjie
    Acked-by: Jan Kiszka
    Acked-by: Kieran Bingham
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Xi Kangjie
     

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
     

01 Sep, 2017

1 commit

  • Kbuild conventionally uses $(shell cd ... && /bin/pwd) idiom to get
    the absolute path of the directory because GNU Make 3.80, the minimal
    supported version at that time, did not support $(abspath ...) or
    $(realpath ...).

    Commit 37d69ee30808 ("docs: bump minimal GNU Make version to 3.81")
    dropped the GNU Make 3.80 support, so we are now allowed to use those
    make-builtin helpers.

    This conversion will provide better portability without relying on
    the pwd command or its location /bin/pwd.

    I am intentionally using $(realpath ...) instead $(abspath ...) in
    some places. The difference between the two is $(realpath ...)
    returns an empty string if the given path does not exist. It is
    convenient in places where we need to error-out if the makefile fails
    to create an output directory.

    Signed-off-by: Masahiro Yamada
    Acked-by: Thierry Reding

    Masahiro Yamada
     

13 Jul, 2017

3 commits

  • Use errors=replace because it is never desirable for lx-dmesg to fail on
    string decoding errors, not even if the log buffer is corrupt and we
    show incorrect info.

    The kernel will sometimes print utf8, for example the copyright symbol
    from jffs2. In order to make this work specify 'utf8' everywhere
    because python2 otherwise defaults to 'ascii'.

    In theory the second errors='replace' is not be required because
    everything that can be decoded as utf8 should also be encodable back to
    utf8. But it's better to be extra safe here. It's worth noting that
    this is definitely not true for encoding='ascii', unknown characters are
    replaced with U+FFFD REPLACEMENT CHARACTER and they fail to encode back
    to ascii.

    Link: http://lkml.kernel.org/r/acee067f3345954ed41efb77b80eebdc038619c6.1498481469.git.leonard.crestez@nxp.com
    Signed-off-by: Leonard Crestez
    Acked-by: Jan Kiszka
    Cc: Jason Wessel
    Cc: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • In some cases it is possible for the str() conversion here to throw
    encoding errors because log_buf might not point to valid ascii. For
    example:

    (gdb) python print str(gdb.parse_and_eval("log_buf"))
    Traceback (most recent call last):
    File "", line 1, in
    UnicodeEncodeError: 'ascii' codec can't encode character u'\u0303' in
    position 24: ordinal not in range(128)

    Avoid this by explicitly casting to (void *) inside the gdb expression.

    Link: http://lkml.kernel.org/r/ba6f85dbb02ca980ebd0e2399b0649423399b565.1498481469.git.leonard.crestez@nxp.com
    Signed-off-by: Leonard Crestez
    Reviewed-by: Jan Kiszka
    Cc: Jason Wessel
    Cc: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • lx-fdtdump dumps the flattened device tree passed to the kernel from the
    bootloader to the filename specified as the command argument. If no
    argument is provided it defaults to fdtdump.dtb. This then allows
    further post processing on the machine running GDB. The fdt header is
    also also printed in the GDB console. For example:

    (gdb) lx-fdtdump
    fdt_magic: 0xD00DFEED
    fdt_totalsize: 0xC108
    off_dt_struct: 0x38
    off_dt_strings: 0x3804
    off_mem_rsvmap: 0x28
    version: 17
    last_comp_version: 16
    Dumped fdt to fdtdump.dtb

    >fdtdump fdtdump.dtb | less

    This command is useful as the bootloader can often re-write parts of the
    device tree, and this can sometimes cause the kernel to not boot.

    Link: http://lkml.kernel.org/r/1481280065-5336-2-git-send-email-kbingham@kernel.org
    Signed-off-by: Peter Griffin
    Signed-off-by: Kieran Bingham
    Cc: Jason Wessel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Griffin
     

03 Jun, 2017

1 commit

  • lx-dmesg needs access to the log_buf symbol from printk.c.
    Unfortunately, the symbol log_buf also exists in BPF's verifier.c and
    hence gdb can pick one or the other. If it happens to pick BPF's
    log_buf, lx-dmesg doesn't work:

    (gdb) lx-dmesg
    Python Exception Cannot access memory at address 0x0:
    Error occurred in Python command: Cannot access memory at address 0x0
    (gdb) p log_buf
    $15 = 0x0

    Luckily, GDB has a way to deal with this, see
    https://sourceware.org/gdb/onlinedocs/gdb/Symbols.html

    (gdb) info variables ^log_buf$
    All variables matching regular expression "^log_buf$":

    File /kernel/bpf/verifier.c:
    static char *log_buf;

    File /kernel/printk/printk.c:
    static char *log_buf;
    (gdb) p 'verifier.c'::log_buf
    $1 = 0x0
    (gdb) p 'printk.c'::log_buf
    $2 = 0x811a6aa0 ""
    (gdb) p &log_buf
    $3 = (char **) 0x8120fe40
    (gdb) p &'verifier.c'::log_buf
    $4 = (char **) 0x8120fe40
    (gdb) p &'printk.c'::log_buf
    $5 = (char **) 0x8048b7d0

    By being explicit about the location of the symbol, we can make lx-dmesg
    work again. While at it, do the same for the other symbols we need from
    printk.c

    Link: http://lkml.kernel.org/r/20170526112222.3414-1-git@andred.net
    Signed-off-by: André Draszik
    Tested-by: Kieran Bingham
    Acked-by: Jan Kiszka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    André Draszik
     

15 Jul, 2016

5 commits

  • This reverts commit e127a73d41ac ("scripts/gdb: add a Radix Tree
    Parser")

    The python implementation of radix-tree was merged at the same time as
    the radix-tree system was heavily reworked from commit e9256efcc8e3
    ("radix-tree: introduce radix_tree_empty") to 3bcadd6fa6c4 ("radix-tree:
    free up the bottom bit of exceptional entries for reuse") and no longer
    functions, but also prevents other gdb scripts from loading.

    This functionality has not yet hit a release, so simply remove it for
    now

    Link: http://lkml.kernel.org/r/1467127337-11135-6-git-send-email-kieran@bingham.xyz
    Signed-off-by: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kieran Bingham
     
  • Python doesn't do automatic expansion of paths. In case one passes path
    of the from ~/foo/bar the gdb scripts won't automatically expand that
    and as a result the symbols files won't be loaded.

    Fix this by explicitly expanding all paths which begin with "~"

    Link: http://lkml.kernel.org/r/1467127337-11135-5-git-send-email-kieran@bingham.xyz
    Signed-off-by: Nikolay Borisov
    Signed-off-by: Kieran Bingham
    Reviewed-by: Jan Kiszka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nikolay Borisov
     
  • Since scripts/gdb/linux/constants.py is autogenerated, this should have
    been added to .gitignore when it was introduced.

    Fixes: f197d75fcad1 ("scripts/gdb: provide linux constants")
    Link: http://lkml.kernel.org/r/1467127337-11135-4-git-send-email-kieran@bingham.xyz
    Signed-off-by: Omar Sandoval
    Signed-off-by: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Omar Sandoval
     
  • The autogenerated constants.py file was only being built on the initial
    call, and if the constants.py.in file changed. As we are utilising the
    CPP hooks, we can successfully use the call if_changed_dep rules to
    determine when to rebuild the file based on it's inclusions.

    Link: http://lkml.kernel.org/r/1467127337-11135-3-git-send-email-kieran@bingham.xyz
    Signed-off-by: Kieran Bingham
    Reported-by: Jan Kiszka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kieran Bingham
     
  • The constants.py generation, involves a rule to link into the main
    makefile. This rule has no command and generates a spurious warning
    message in the build logs when CONFIG_SCRIPTS_GDB is enabled.

    Fix simply by giving a no-op action

    Link: http://lkml.kernel.org/r/1467127337-11135-2-git-send-email-kieran@bingham.xyz
    Signed-off-by: Kieran Bingham
    Reported-by: Jan Kiszka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kieran Bingham
     

24 May, 2016

1 commit

  • The recent fixes to lx-dmesg, now allow the command to print
    successfully on Python3, however the python interpreter wraps the bytes
    for each line with a b'' marker.

    To remove this, we need to decode the line, where .decode() will default
    to 'UTF-8'

    Link: http://lkml.kernel.org/r/d67ccf93f2479c94cb3399262b9b796e0dbefcf2.1462865983.git.jan.kiszka@siemens.com
    Signed-off-by: Kieran Bingham
    Acked-by: Dom Cote
    Tested-by: Dom Cote
    Signed-off-by: Jan Kiszka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kieran Bingham