Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1051820pxm; Wed, 23 Feb 2022 16:54:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtWoR6CQ9fipAVmxhGggrqlOOlEzrdNequD3Eo5ThB6AxK3aXVLc15b+ZZKDxOAAnU7NjU X-Received: by 2002:a17:902:bc82:b0:14f:2b9c:4aa with SMTP id bb2-20020a170902bc8200b0014f2b9c04aamr86526plb.145.1645664089720; Wed, 23 Feb 2022 16:54:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645664089; cv=none; d=google.com; s=arc-20160816; b=NpHd0JEKBDm9kBqavgVInUaVZIJ5YlGwYdaLPLELmrzgC4qFzpVM2YmPMTMl+lG40H ySeBxXWIOld1cL73bBogEyQjRFyLVApfD4NG4hkgO7YHbaKAsp1LLuB+N4kIhwKz5dWB TzP9EKPJgHNzFi1C48irMWz76hjn74XrXhkxeX+sCjzWYBc82eqYVIPXbHkOL+TIYytl ItZ5VR4qs04tWkHeGCXohucgRTVmg6jbUDd6yVf4gDK7IsM8XgqueiG8LrsiGTsCsLFH /FZDd+gizWLqdjFIQbk2L3sI0JRmkF/eZ2JP0pa6L3O7/jgBgidPWgQKqqH6pYnx+32M 3/lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=2ralZ1OrECpK+8DzUkgXxEZh88yKg5QEoZ6U5/mPsas=; b=ctIqXCTue1P4cQJfGYDtpFjoGa/taOg6kgfiFhuHi2HyqSJhcJZURq8aqZ0/Yw47Jd pO/rCJC1+OSA+68/jQVR9i7/UuVDW7ttAAkRnbNGc7NZpnVaT9b9P52tQZAmu9lYJHTL ugf1+aCI4JIZRsuaCe0w3ek17tIzliRzfp+R1Jp3mqGo580nv5magru6m3yqLLJAUtq1 p1tQYZK5h9SL20q5GO20oXiPLDGZWr9+oXqwGfCT11P+PI2ni2TQsVwSmVYNQGCF2BhK yPrBka/zuieohJ8qZTGZR2+IFwxl4mbuSkiq8Wg8XQ9RmdCOQeXa98oS+mAVDORdq7iz WWzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w6si985862ply.329.2022.02.23.16.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 16:54:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 525A1DEA08; Wed, 23 Feb 2022 16:48:09 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244829AbiBWXfb (ORCPT + 99 others); Wed, 23 Feb 2022 18:35:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244692AbiBWXf2 (ORCPT ); Wed, 23 Feb 2022 18:35:28 -0500 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3C20B59A6A for ; Wed, 23 Feb 2022 15:34:59 -0800 (PST) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 21NNReM1024539; Wed, 23 Feb 2022 17:27:40 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 21NNRd3Z024538; Wed, 23 Feb 2022 17:27:39 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 23 Feb 2022 17:27:39 -0600 From: Segher Boessenkool To: Gabriel Paubert Cc: Christophe Leroy , Kees Cook , linux-kernel@vger.kernel.org, Paul Mackerras , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH] powerpc/32: Clear volatile regs on syscall exit Message-ID: <20220223232739.GJ614@gate.crashing.org> References: <28b040bd2357a1879df0ca1b74094323f778a472.1645636285.git.christophe.leroy@csgroup.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 23, 2022 at 09:48:09PM +0100, Gabriel Paubert wrote: > On Wed, Feb 23, 2022 at 06:11:36PM +0100, Christophe Leroy wrote: > > + /* Zero volatile regs that may contain sensitive kernel data */ > > + li r0,0 > > + li r4,0 > > + li r5,0 > > + li r6,0 > > + li r7,0 > > + li r8,0 > > + li r9,0 > > + li r10,0 > > + li r11,0 > > + li r12,0 > > + mtctr r0 > > + mtxer r0 > > Here, I'm almost sure that on some processors, it would be better to > separate mtctr form mtxer. mtxer is typically very expensive (pipeline > flush) but I don't know what's the best ordering for the average core. mtxer is cheaper than mtctr on many cores :-) On p9 mtxer is cracked into two latency 3 ops (which run in parallel). While mtctr has latency 5. On p8 mtxer was horrible indeed (but nothing near as bad as a pipeline flush). Segher