[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [bug report] xen/pv: add fault recovery control to pmu msr accesses
Hello Juergen Gross, The patch 8714f7bcd3c2: "xen/pv: add fault recovery control to pmu msr accesses" from Sep 26, 2022, leads to the following Smatch static checker warning: arch/x86/xen/pmu.c:310 pmu_msr_chk_emulated() error: uninitialized symbol 'index'. arch/x86/xen/pmu.c 302 static bool pmu_msr_chk_emulated(unsigned int msr, uint64_t *val, bool is_read, 303 bool *emul) 304 { 305 int type, index; 306 307 if (is_amd_pmu_msr(msr)) 308 *emul = xen_amd_pmu_emulate(msr, val, is_read); 309 else if (is_intel_pmu_msr(msr, &type, &index)) --> 310 *emul = xen_intel_pmu_emulate(msr, val, type, index, is_read); Smatch is correct that we're passing "index" when it wasn't initialized but it's not used so it's a false positive. I think KMSan will print the same warning as well. It's technically undefined behavior, but also we care more about real life GCC than the C standard... Another thing to consider is that eventually we're going to make zeroing the stack enabled by default and when we do that the performance hit for setting index to zero will go away for most people. (Zeroing the stack makes uninitialized variable bugs defined behavior and has security benefits). 311 else 312 return false; 313 314 return true; 315 } regards, dan carpenter
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |