From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A171C433EF for ; Sun, 3 Apr 2022 17:14:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359626AbiDCRQd (ORCPT ); Sun, 3 Apr 2022 13:16:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359604AbiDCRQb (ORCPT ); Sun, 3 Apr 2022 13:16:31 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4470713DD7; Sun, 3 Apr 2022 10:14:36 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1649006074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qeX5ZeUnYTOArgEzqA+VxeAnatsMOvwz4R2yQNo81VE=; b=zrAVVRGgr3aLJGVv3hyhk7jnTYXWEIm5dkZ1fNM/Bl0C5OsG7ffPPegKCPzQIIZvCWz7Kd yjpFVF6N02aEtM3sE0c2vEVQrYRQCW8xt2d4DHW11kJx2Hjoc6RIYk1zasv1JD3iTjpQhQ my7nUQz9l3iRI0fcio+vWu6jBcj9QwgnNIemcV0flUUBNbK6FWYXjaJgobwKbquOTrFSIf 2Y9TdDwmaYLvZfYYXqRhl6WMeqpYYdeZr4rDsqi7FgpHWaO8TbKjxFF4wcxqKYH9K+p7x4 sRRBRIkiVAKQH8rkYw2fafSDCdMvXaBKGBVQMU3Jz3p1TM1TQj2jEv+UXJI18Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1649006074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qeX5ZeUnYTOArgEzqA+VxeAnatsMOvwz4R2yQNo81VE=; b=OHeTqdUkuo3lHP2BLD7waUl18HFf0uDFgPug2zkqP+lUEQiUeA60vBhtipqIHO+7vOONC3 ofaPs7DvC1IHkbBg== To: Ammar Faizi , Borislav Petkov Cc: Ammar Faizi , Alviro Iskandar Setiawan , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , Tony Luck , Yazen Ghannam , Linux Edac Mailing List , Linux Kernel Mailing List , Stable Kernel , GNU/Weeb Mailing List , x86 Mailing List , David Laight , Jiri Hladky Subject: Re: [PATCH v6 1/2] x86/delay: Fix the wrong asm constraint in `delay_loop()` In-Reply-To: <87zgl2ksu3.ffs@tglx> References: <20220329104705.65256-1-ammarfaizi2@gnuweeb.org> <20220329104705.65256-2-ammarfaizi2@gnuweeb.org> <87zgl2ksu3.ffs@tglx> Date: Sun, 03 Apr 2022 19:14:34 +0200 Message-ID: <87tubaks1x.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 03 2022 at 18:57, Thomas Gleixner wrote: > On Tue, Mar 29 2022 at 17:47, Ammar Faizi wrote: >> The asm constraint does not reflect that the asm statement can modify >> the value of @loops. But the asm statement in delay_loop() does modify >> the @loops. >> >> Specifiying the wrong constraint may lead to undefined behavior, it may >> clobber random stuff (e.g. local variable, important temporary value in >> regs, etc.). This is especially dangerous when the compiler decides to >> inline the function and since it doesn't know that the value gets >> modified, it might decide to use it from a register directly without >> reloading it. Ignore me, I misread this part of the explanation. Thanks, tglx