Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 675334 - sys-kernel/gentoo-sources-4.14.x / sys-kernel/ck-sources-4.14.x - arch/powerpc/kernel/kvm.c: In function `kvm_guest_init': ./arch/powerpc/include/asm/epapr_hcalls.h:470:42: error: `in' may be used uninitialized in this function [-Werror=maybe-uninitialize
Summary: sys-kernel/gentoo-sources-4.14.x / sys-kernel/ck-sources-4.14.x - arch/powerp...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC64 Linux
: Normal normal (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL: https://forums.gentoo.org/viewtopic-p...
Whiteboard:
Keywords: PATCH
Depends on: 679558
Blocks:
  Show dependency tree
 
Reported: 2019-01-13 15:36 UTC by Michael 'veremitz' Everitt
Modified: 2019-06-11 15:20 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
.config (file_675334.txt,72.26 KB, text/plain)
2019-01-13 15:36 UTC, Michael 'veremitz' Everitt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 'veremitz' Everitt 2019-01-13 15:36:58 UTC
Created attachment 560854 [details]
.config

See forum post for gentoo-sources-4.14.74

Also applies to ck-sources-4.14.x - config attached for 4.14.66-ck1.
Comment 1 Michael 'veremitz' Everitt 2019-01-13 15:46:29 UTC
In file included from ./arch/powerpc/include/uapi/asm/kvm_para.h:82:0,                                                           
                 from ./arch/powerpc/include/asm/kvm_para.h:22,                                                                  
                 from ./include/uapi/linux/kvm_para.h:33,                                                                        
                 from ./include/linux/kvm_para.h:5,                                                                                               from ./include/linux/kvm_host.h:33,
                 from arch/powerpc/kernel/kvm.c:22:
arch/powerpc/kernel/kvm.c: In function ?kvm_guest_init?:
./arch/powerpc/include/asm/epapr_hcalls.h:470:42: error: ?in? may be used uninitialized in this function [-Werror=maybe-uninitia$
ized]                                                                                                                           
  unsigned long register r3 asm("r3") = in[0];        
                                        ~~^~~
./arch/powerpc/include/asm/epapr_hcalls.h:471:25: error: ?*((void *)&in+8)? may be used uninitialized in this function [-Werror=$
aybe-uninitialized]          
  unsigned long register r4 asm("r4") = in[1];
                         ^~           
./arch/powerpc/include/asm/epapr_hcalls.h:472:25: error: ?*((void *)&in+16)? may be used uninitialized in this function [-Werror$
maybe-uninitialized]   
  unsigned long register r5 asm("r5") = in[2];
                         ^~               
./arch/powerpc/include/asm/epapr_hcalls.h:473:25: error: ?*((void *)&in+24)? may be used uninitialized in this function [-Werror$
maybe-uninitialized]                  
  unsigned long register r6 asm("r6") = in[3];                                                                                  
                         ^~                                   
./arch/powerpc/include/asm/epapr_hcalls.h:474:25: error: ?*((void *)&in+32)? may be used uninitialized in this function [-Werror$
maybe-uninitialized]                       
  unsigned long register r7 asm("r7") = in[4];
                         ^~
./arch/powerpc/include/asm/epapr_hcalls.h:475:25: error: ?*((void *)&in+40)? may be used uninitialized in this function [-Werror$
maybe-uninitialized]
  unsigned long register r8 asm("r8") = in[5];
                         ^~
./arch/powerpc/include/asm/epapr_hcalls.h:476:25: error: ?*((void *)&in+48)? may be used uninitialized in this function [-Werror=
maybe-uninitialized]
  unsigned long register r9 asm("r9") = in[6];
                         ^~
./arch/powerpc/include/asm/epapr_hcalls.h:477:25: error: ?*((void *)&in+56)? may be used uninitialized in this function [-Werror=
maybe-uninitialized]
  unsigned long register r10 asm("r10") = in[7];
                         ^~~
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:329: arch/powerpc/kernel/kvm.o] Error 1
make: *** [Makefile:1035: arch/powerpc/kernel] Error 2
Comment 2 Michael 'veremitz' Everitt 2019-01-14 07:09:43 UTC
Re-CC'ing toolchain per slyfox's original request.

Adding ppc64 project for info.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2019-02-09 21:27:04 UTC
Reproduced build failure on vanilla linux-4.14. vanilla linux-master builds fine.

Build command I used:
  $ cat mk.sh
    ARCH=powerpc                                 \
        CROSS_COMPILE=powerpc-unknown-linux-gnu- \
        make -C ../linux,git                     \
        O="$(pwd)"                               \
                                                 \
        "$@"
  $ ./mk.sh -j9 arch/powerpc/kernel/kvm.o

Bisected upstream fix down to a reasonable commit:

186b8f1587c79c2fa04bfa392fdf084443e398c1 is the first bad commit
commit 186b8f1587c79c2fa04bfa392fdf084443e398c1
Author: Seth Forshee <seth.forshee@canonical.com>
Date:   Thu Sep 28 09:33:39 2017 -0400

    powerpc: Always initialize input array when calling epapr_hypercall()
    
    Several callers to epapr_hypercall() pass an uninitialized stack
    allocated array for the input arguments, presumably because they
    have no input arguments. However this can produce errors like
    this one
    
     arch/powerpc/include/asm/epapr_hcalls.h:470:42: error: 'in' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      unsigned long register r3 asm("r3") = in[0];
                                            ~~^~~
    
    Fix callers to this function to always zero-initialize the input
    arguments array to prevent this.
    
    Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

:040000 040000 9707d8aa4afad3c40e7d48fd1dc048f21fe44626 212dbb76e660e5b26c5639c6acf32aca4ad58875 M      arch

Bisected as:
  $ git bisect start master v4.14
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2019-02-09 21:30:17 UTC
kernel@ please consider backportng
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=186b8f1587c79c2fa04bfa392fdf084443e398c1
to 4.14 branch to fix above build failure for kvm on ppc64.

The following applies cleanly on vanilla v4.14 and fixes build:
    $ git cherry-pick 186b8f1587c79c2fa04bfa392fdf084443e398c1

The fix looks like a low-risk change.
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2019-03-02 20:30:14 UTC
Backport for all LTS kernels requested, https://lore.kernel.org/stable/dc0ba1c6-89cb-90ff-f336-e7a5108f02ac@gentoo.org/
Comment 7 Mike Pagano gentoo-dev 2019-06-11 15:20:35 UTC
I see this has propagated to :

4.4.177
4.9.162
4.14.105

veremitz, I think we're ok here.  Re-open if I am incorrect.