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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B20B5C2D0A3 for ; Wed, 4 Nov 2020 11:06:39 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ABE4220867 for ; Wed, 4 Nov 2020 11:06:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="P120VnX3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABE4220867 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4CR3kK6HHmzDqZP for ; Wed, 4 Nov 2020 22:06:33 +1100 (AEDT) Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4CR3gs3HTyzDqRC for ; Wed, 4 Nov 2020 22:04:25 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=P120VnX3; dkim-atps=neutral Received: by ozlabs.org (Postfix) id 4CR3gr4vkTz9sTL; Wed, 4 Nov 2020 22:04:24 +1100 (AEDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4CR3gr39kVz9sTK; Wed, 4 Nov 2020 22:04:24 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1604487864; bh=phfnyClVnFM/Mn8K1hyCeEY+8JtX8MY3JTdk7X3KCLw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=P120VnX3osPQxkjNVADsew6SzuCrgPLJB8YiOXaXOHF7uHqcBw72zDvJNRoA+W4Hl RpEj15tDcE8dcF7DEk+LXhFjQ0ogakddloBxGD5WPMQO3TwBKuN56hJyEI3p+wXU58 +a0OeSaYreTs8JRKMYV1SKN7HybDm371pSggva57bNgtqTZmgZo5DRcZmvhPNpA1Nr hFb5BIsExXQIVyRt9+E5wrikMnD5VniP87pxo08R+zyqbozVyVhWeoceNidPzN/L9V dKTn5u+8CDHPP4os99tIxvyRf2O9T3WLWSnkcDKRESLvUrk25Zv2lqCsQn9p3Y8euQ qrKKG51RujKBA== From: Michael Ellerman To: Christophe Leroy , linuxppc-dev@ozlabs.org Subject: Re: [PATCH] powerpc: Don't use asm goto for put_user() with GCC 4.9 In-Reply-To: <4fe837f8-ecae-f009-c193-8da386a70705@csgroup.eu> References: <20201103132915.529337-1-mpe@ellerman.id.au> <4fe837f8-ecae-f009-c193-8da386a70705@csgroup.eu> Date: Wed, 04 Nov 2020 22:04:23 +1100 Message-ID: <87tuu5tmbs.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: schwab@linux-m68k.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Christophe Leroy writes: > Le 03/11/2020 =C3=A0 14:29, Michael Ellerman a =C3=A9crit=C2=A0: >> Andreas reported that commit ee0a49a6870e ("powerpc/uaccess: Switch >> __put_user_size_allowed() to __put_user_asm_goto()") broke >> CLONE_CHILD_SETTID. >>=20 >> Further inspection showed that the put_user() in schedule_tail() was >> missing entirely, the store not emitted by the compiler. >>=20 >> Notice there are no stores other than to the stack. There should be a >> stw in there for the store to current->set_child_tid. >>=20 >> This is only seen with GCC 4.9 era compilers (tested with 4.9.3 and >> 4.9.4), and only when CONFIG_PPC_KUAP is disabled. >>=20 >> When CONFIG_PPC_KUAP=3Dy, the memory clobber that's part of the isync() >> and mtspr() inlined via allow_user_access() seems to be enough to >> avoid the bug. >>=20 >> For now though let's just not use asm goto with GCC 4.9, to avoid this >> bug and any other issues we haven't noticed yet. Possibly in future we >> can find a smaller workaround. > > Is that https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D58670 ? > > Should we use asm_volatile_goto() defined in include/linux/compiler-gcc.h= ? Ugh. I knew of that work around, but thought we'd dropped it when we moved up to GCC 4.9. I should have looked more closely. I'll send a patch to switch to it. cheers