From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: [PATCH] powerpc: vdso 64bits gettimeofday bug From: Benjamin Herrenschmidt To: Andrew Morton , Linus Torvalds Content-Type: text/plain Date: Sun, 26 Feb 2006 08:09:00 +1100 Message-Id: <1140901740.24957.29.camel@localhost.localdomain> Mime-Version: 1.0 Cc: Greg KH , linuxppc-dev list , Olaf Hering , linuxppc64-dev , David Woodhouse List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , A bug in the assembly code of the vdso can cause gettimeofday() to hang or to return incorrect results. The wrong register was used to test for pending updates of the calibration variables and to create a dependency for subsequent loads. This fixes it. Signed-off-by: Benjamin Herrenschmidt --- Might be worth applying to the stable series too and/or distro kernels 2.6.15 and later --- linux-work.orig/arch/powerpc/kernel/vdso64/gettimeofday.S 2006-02-26 08:02:57.000000000 +1100 +++ linux-work/arch/powerpc/kernel/vdso64/gettimeofday.S 2006-02-26 08:04:23.000000000 +1100 @@ -225,9 +225,9 @@ .cfi_startproc /* check for update count & load values */ 1: ld r8,CFG_TB_UPDATE_COUNT(r3) - andi. r0,r4,1 /* pending update ? loop */ + andi. r0,r8,1 /* pending update ? loop */ bne- 1b - xor r0,r4,r4 /* create dependency */ + xor r0,r8,r8 /* create dependency */ add r3,r3,r0 /* Get TB & offset it */