Commit Graph

12 Commits

Author SHA1 Message Date
HATAYAMA Daisuke
a0cea9fcec coredump: fix segmentation fault caused by type mismatch
Backport from the upstream crash-gcore.

commit 1ba701c1d7bd94cc5a02f51652712acdcbf0875c
Author: Vincent Whitchurch <vincent.whitchurch@axis.com>
Date:   Tue Jun 21 09:15:33 2022 +0000

    coredump: fix segmentation fault caused by type mismatch

    crash gcore command on ARM sometimes results in segmentation fault:

        crash> gcore -v 0
        Segmentation fault (core dumped)

    This is caused by type mismatch of a variable paddr in function
    gcore_readmem_user() to hold a physical address, which is indicated by
    the following warning message:

     libgcore/gcore_coredump.c: In function ‘gcore_readmem_user’:
     libgcore/gcore_coredump.c:85:26: warning: passing argument 2 of
     ‘uvtop_quiet’ from incompatible pointer type
     [-Wincompatible-pointer-types]

        if (!uvtop_quiet(addr, &paddr)) {
                               ^~~~~~
     libgcore/gcore_coredump.c:71:49: note: expected ‘physaddr_t *’ {aka
     ‘long long unsigned int *’} but argument is of type ‘ulong *’ {aka ‘long
     unsigned int *’}

      static int uvtop_quiet(ulong vaddr, physaddr_t *paddr);
                                          ~~~~~~~~~~~~^~~~~

    On ARM, long unsigned int has 4 byte length, while physaddr_t has 8
    byte length. The mismatch causes overwriting of stack variables.

    Fix this by changing the type of the variable paddr to physaddr_t.

    Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>

Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
2022-07-26 15:13:44 +09:00
HATAYAMA Daisuke
ae4ad4d495 x86: Fix failure of collecting vsyscall mapping due to change of enum type of vsyscall_mode
Backport from the upstream crash-gcore.

commit 03f9360715731f18e4fdae7b30aa34b30dddcd57
Author: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
Date:   Sat Mar 26 21:42:02 2022 +0900

    x86: Fix failure of collecting vsyscall mapping due to change of enum type of vsyscall_mode

    vsyscall mapping fails to get collected because the commit
    bd49e16e3339 (x86/vsyscall: Add a new vsyscall=xonly mode) merged at
    kernel v5.2-rc7 added constant XONLY to the anonymous enumeration type
    of variable vsyscall_mode, which made the value of constant NONE
    change from 1 to 2.

    This commit fixes the issue by checking the value of constant NONE
    using gdb's print command and typeof operator since there's no utility
    function to handle such anonymous enumeration type currently in crash
    utility.

    Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>

Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
2022-07-26 15:13:42 +09:00
HATAYAMA Daisuke
5f7e55f54c gcore: fix memory allocation failure during processing NT_AUXV note
Backport from the upstream crash-gcore.

commit 4cb65a0d9168778d120920418b968d05da10989f
Author: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
Date:   Fri Feb 25 04:59:48 2022 -0500

    gcore: fix memory allocation failure during processing NT_AUXV note

    For crash dumps generated using kernel-4.18.0-365.el8 or later on
    CentOS stream 8, crash gcore command fails as follows:

        crash> gcore -v 7 -f 128 10604
        gcore: Opening file core.10604.test-dumpfilter ...
        gcore: done.
        gcore: Writing ELF header ...
        gcore:  done.
        gcore: Retrieving and writing note information ...
        gcore: zero-size memory allocation! (called from 7fd558ce1e05)
        Failed.

    This memory allocation failure occurs in fill_auxv_note() that creates
    NT_AUXV note due to saved_auxv entries of size and offset tables are
    somehow 0.

    This is because during the merge of the upstream kernel commit
    1c33bb0507508af24fd754dd7123bd8e997fab2f (x86/elf: Support a new ELF
    aux vector AT_MINSIGSTKSZ), location of saved_auxv of struct mm_struct
    has been moved as workaround in order to avoid kABI breakage.

    Fix this by using RHEL-specific location for saved_auxv if there is
    member rh_reserved_saved_auxv in struct mm_struct.

    Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>

Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
2022-07-26 15:13:40 +09:00
HATAYAMA Daisuke
fa82591a3b gcore, defs: remove definitions and initializations for saved_auxv entries of offset and size tables
Backport from the upstream crash-gcore.

commit 6f4357340807f70bd1999f0b88435361c583f0b9
Author: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
Date:   Fri Feb 25 04:51:06 2022 -0500

    gcore, defs: remove definitions and initializations for saved_auxv entries of offset and size tables

    saved_auxv entries of offset and size tables are now not used in the
    source code by the previous commit. Let's remove definitions and
    initializations for them.

    Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>

Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
2022-07-26 15:13:38 +09:00
HATAYAMA Daisuke
bf661e7ba2 coredump: use MEMBER_{OFFSET, SIZE} instead of GCORE_{OFFSET, SIZE}
Backport from the upstream crash-gcore.

commit 4731ebf085fe6322ba8c7ca14918d3cab2186cf0
Author: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
Date:   Fri Feb 25 04:45:37 2022 -0500

    coredump: use MEMBER_{OFFSET, SIZE} instead of GCORE_{OFFSET, SIZE}

    fill_auxv_note() and compat_fill_auxv_note() is called just once each
    time gcore command is invoked because each process has just one
    NT_AUXV. This means using MEMBER_{OFFSET, SIZE} is enough; using
    GCORE_{OFFSET, SIZE} is overkill.

    Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>

Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
2022-07-26 15:13:32 +09:00
Fedora Release Engineering
403d800813 Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-20 23:43:32 +00:00
Fedora Release Engineering
c5784ea2f6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-19 23:58:26 +00:00
HATAYAMA Daisuke
3a9436d775 Update to latest upstream release v2
This commit retries the update to the latest upstream release because
the previous commit didn't update the tarball.

Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>

Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
2021-12-20 06:18:09 +09:00
HATAYAMA Daisuke
b010f0dba0 Update to latest upstream release
Signed-off-by: HATAYAMA Daisuke <d.hatayama@fujitsu.com>
2021-12-16 23:18:15 +09:00
Fedora Release Engineering
0768ae21c6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-21 20:05:43 +00:00
HATAYAMA Daisuke
e0ed466213 Initial import (#1919347). 2021-02-18 19:17:20 +09:00
Mohan Boddu
54a85ce760 Added the README 2021-02-17 14:38:01 +00:00