# git rev-parse -q --verify 65ea11ec6a82b1d44aba62b59e9eb20247e57c6e^{commit} 65ea11ec6a82b1d44aba62b59e9eb20247e57c6e already have revision, skipping fetch # git checkout -q -f -B kisskb 65ea11ec6a82b1d44aba62b59e9eb20247e57c6e # git clean -qxdf # git log -1 commit 65ea11ec6a82b1d44aba62b59e9eb20247e57c6e Author: Ville Syrjälä Date: Mon Aug 8 20:35:29 2016 +0300 x86/hweight: Don't clobber %rdi The caller expects %rdi to remain intact, push+pop it make that happen. Fixes the following kind of explosions on my core2duo machine when trying to reboot or shut down: general protection fault: 0000 [#1] PREEMPT SMP Modules linked in: i915 i2c_algo_bit drm_kms_helper cfbfillrect syscopyarea cfbimgblt sysfillrect sysimgblt fb_sys_fops cfbcopyarea drm netconsole configfs binfmt_misc iTCO_wdt psmouse pcspkr snd_hda_codec_idt e100 coretemp hwmon snd_hda_codec_generic i2c_i801 mii i2c_smbus lpc_ich mfd_core snd_hda_intel uhci_hcd snd_hda_codec snd_hwdep snd_hda_core ehci_pci 8250 ehci_hcd snd_pcm 8250_base usbcore evdev serial_core usb_common parport_pc parport snd_timer snd soundcore CPU: 0 PID: 3070 Comm: reboot Not tainted 4.8.0-rc1-perf-dirty #69 Hardware name: /D946GZIS, BIOS TS94610J.86A.0087.2007.1107.1049 11/07/2007 task: ffff88012a0b4080 task.stack: ffff880123850000 RIP: 0010:[] [] x86_perf_event_update+0x52/0xc0 RSP: 0018:ffff880123853b60 EFLAGS: 00010087 RAX: 0000000000000001 RBX: ffff88012fc0a3c0 RCX: 000000000000001e RDX: 0000000000000000 RSI: 0000000040000000 RDI: ffff88012b014800 RBP: ffff880123853b88 R08: ffffffffffffffff R09: 0000000000000000 R10: ffffea0004a012c0 R11: ffffea0004acedc0 R12: ffffffff80000001 R13: ffff88012b0149c0 R14: ffff88012b014800 R15: 0000000000000018 FS: 00007f8b155cd700(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f8b155f5000 CR3: 000000012a2d7000 CR4: 00000000000006f0 Stack: ffff88012fc0a3c0 ffff88012b014800 0000000000000004 0000000000000001 ffff88012fc1b750 ffff880123853bb0 ffffffff81003d59 ffff88012b014800 ffff88012fc0a3c0 ffff88012b014800 ffff880123853bd8 ffffffff81003e13 Call Trace: [] x86_pmu_stop+0x59/0xd0 [] x86_pmu_del+0x43/0x140 [] event_sched_out.isra.105+0xbd/0x260 [] __perf_remove_from_context+0x2d/0xb0 [] __perf_event_exit_context+0x4d/0x70 [] generic_exec_single+0xb6/0x140 [] ? __perf_remove_from_context+0xb0/0xb0 [] ? __perf_remove_from_context+0xb0/0xb0 [] smp_call_function_single+0xdf/0x140 [] perf_event_exit_cpu_context+0x87/0xc0 [] perf_reboot+0x13/0x40 [] notifier_call_chain+0x4a/0x70 [] __blocking_notifier_call_chain+0x47/0x60 [] blocking_notifier_call_chain+0x16/0x20 [] kernel_restart_prepare+0x1d/0x40 [] kernel_restart+0x12/0x60 [] SYSC_reboot+0xf6/0x1b0 [] ? mntput_no_expire+0x2c/0x1b0 [] ? mntput+0x24/0x40 [] ? __fput+0x16c/0x1e0 [] ? ____fput+0xe/0x10 [] ? task_work_run+0x83/0xa0 [] ? exit_to_usermode_loop+0x53/0xc0 [] ? trace_hardirqs_on_thunk+0x1a/0x1c [] SyS_reboot+0xe/0x10 [] entry_SYSCALL_64_fastpath+0x18/0xa3 Code: 7c 4c 8d af c0 01 00 00 49 89 fe eb 10 48 09 c2 4c 89 e0 49 0f b1 55 00 4c 39 e0 74 35 4d 8b a6 c0 01 00 00 41 8b 8e 60 01 00 00 <0f> 33 8b 35 6e 02 8c 00 48 c1 e2 20 85 f6 7e d2 48 89 d3 89 cf RIP [] x86_perf_event_update+0x52/0xc0 RSP ---[ end trace 7ec95181faf211be ]--- note: reboot[3070] exited with preempt_count 2 Cc: Borislav Petkov Cc: H. Peter Anvin Cc: Andy Lutomirski Cc: Brian Gerst Cc: Denys Vlasenko Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Fixes: f5967101e9de ("x86/hweight: Get rid of the special calling convention") Signed-off-by: Ville Syrjälä Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/gcc-4.6.3-nolibc/um-x86_64-linux/bin/x86_64-linux-gcc --version # < git log --format=%s --max-count=1 65ea11ec6a82b1d44aba62b59e9eb20247e57c6e # < make -j 48 ARCH=um O=/home/kisskb/slave/build/linus_um-defconfig_um-x86_64 CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/um-x86_64-linux/bin/x86_64-linux- SUBARCH=x86_64 defconfig kernel/time/Kconfig:155:warning: range is invalid # make -j 48 ARCH=um O=/home/kisskb/slave/build/linus_um-defconfig_um-x86_64 CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/um-x86_64-linux/bin/x86_64-linux- SUBARCH=x86_64 make[1]: Entering directory '/home/kisskb/slave/build/linus_um-defconfig_um-x86_64' GEN ./Makefile scripts/kconfig/conf --silentoldconfig arch/x86/um/Kconfig kernel/time/Kconfig:155:warning: range is invalid CHK include/generated/uapi/linux/version.h UPD include/generated/uapi/linux/version.h HOSTCC scripts/basic/bin2c WRAP arch/um/include/generated/asm/barrier.h WRAP arch/um/include/generated/asm/bug.h WRAP arch/um/include/generated/asm/clkdev.h WRAP arch/um/include/generated/asm/cputime.h WRAP arch/um/include/generated/asm/current.h WRAP arch/um/include/generated/asm/device.h WRAP arch/um/include/generated/asm/delay.h WRAP arch/um/include/generated/asm/exec.h WRAP arch/um/include/generated/asm/ftrace.h WRAP arch/um/include/generated/asm/emergency-restart.h WRAP arch/um/include/generated/asm/futex.h WRAP arch/um/include/generated/asm/irq_regs.h WRAP arch/um/include/generated/asm/hardirq.h WRAP arch/um/include/generated/asm/mcs_spinlock.h WRAP arch/um/include/generated/asm/hw_irq.h WRAP arch/um/include/generated/asm/mutex.h WRAP arch/um/include/generated/asm/irq_work.h WRAP arch/um/include/generated/asm/kdebug.h WRAP arch/um/include/generated/asm/param.h WRAP arch/um/include/generated/asm/pci.h WRAP arch/um/include/generated/asm/io.h WRAP arch/um/include/generated/asm/mm-arch-hooks.h WRAP arch/um/include/generated/asm/percpu.h WRAP arch/um/include/generated/asm/preempt.h WRAP arch/um/include/generated/asm/switch_to.h WRAP arch/um/include/generated/asm/topology.h WRAP arch/um/include/generated/asm/trace_clock.h WRAP arch/um/include/generated/asm/word-at-a-time.h WRAP arch/um/include/generated/asm/xor.h CHK include/config/kernel.release GEN ./Makefile HOSTCC scripts/kallsyms CC scripts/mod/empty.o HOSTCC scripts/mod/mk_elfconfig CC scripts/mod/devicetable-offsets.s GEN scripts/mod/devicetable-offsets.h MKELF scripts/mod/elfconfig.h HOSTCC scripts/mod/modpost.o HOSTCC scripts/mod/file2alias.o HOSTCC scripts/mod/sumversion.o UPD include/config/kernel.release SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h SYSHDR arch/x86/entry/syscalls/../../include/generated/asm/unistd_32_ia32.h SYSHDR arch/x86/entry/syscalls/../../include/generated/asm/unistd_64_x32.h SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_64.h SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_64.h SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_x32.h HOSTLD scripts/mod/modpost Using /home/kisskb/slave/src as source for kernel CHK include/generated/utsrelease.h UPD include/generated/utsrelease.h HOSTCC scripts/unifdef CC arch/x86/um/user-offsets.s In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from /home/kisskb/slave/src/arch/x86/um/user-offsets.c:1: /opt/cross/gcc-4.6.3-nolibc/x86_64-linux/lib/gcc/x86_64-linux/4.6.3/../../../../x86_64-linux/include/sys/cdefs.h:385:27: fatal error: bits/wordsize.h: No such file or directory compilation terminated. /home/kisskb/slave/src/scripts/Makefile.build:153: recipe for target 'arch/x86/um/user-offsets.s' failed make[2]: *** [arch/x86/um/user-offsets.s] Error 1 arch/um/Makefile:150: recipe for target 'arch/x86/um/user-offsets.s' failed make[1]: *** [arch/x86/um/user-offsets.s] Error 2 make[1]: Leaving directory '/home/kisskb/slave/build/linus_um-defconfig_um-x86_64' Makefile:150: recipe for target 'sub-make' failed make: *** [sub-make] Error 2 Command 'make -j 48 ARCH=um O=/home/kisskb/slave/build/linus_um-defconfig_um-x86_64 CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/um-x86_64-linux/bin/x86_64-linux- SUBARCH=x86_64 ' returned non-zero exit status 2 # rm -rf /home/kisskb/slave/build/linus_um-defconfig_um-x86_64 # Build took: 0:00:04.822617