From owner-svn-src-all@freebsd.org Sun Nov 24 17:25:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3603D1B4F70; Sun, 24 Nov 2019 17:25:22 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-yw1-xc43.google.com (mail-yw1-xc43.google.com [IPv6:2607:f8b0:4864:20::c43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47LcW45vvGz4FK4; Sun, 24 Nov 2019 17:25:20 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-yw1-xc43.google.com with SMTP id n82so4571185ywc.7; Sun, 24 Nov 2019 09:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=o4oZoTId+LFPIMEl/whzWmKgUBF4jLs/3v8427wVJSo=; b=Thtk0KihwpAcWSKatFBrPKZVGC83HTXHZzURko49gDaU7Kq2luJmnmda3fVjKYa9IE n6d1vUWv9xVxoo6fHtseQ6f1hTi+ssJFb2wOmeERMndYZO7sya2GRjbl2AXvEZK8iIcn xxWabcR7359RisFI+qDKdbnxXomW/GkpnDmf3ULNeb0WZ4jo+rJViZvlYlR8QVYEfG1u ZP7dqEtPZGU7JfCmlzq4Pa/lqLm5W0rxPb/pK2nXADveMlgpweOu6BoxLOP5gTW7ROMg uamn8lkr0+1mHJsaDKmsjjGIXGJOvx1ILVESMIeFtRy10xSGG0XNI7acrjBFbYgTqf+W i8+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :in-reply-to:references:organization:mime-version :content-transfer-encoding; bh=o4oZoTId+LFPIMEl/whzWmKgUBF4jLs/3v8427wVJSo=; b=mMT2iP71lvUrxnx7xxf+EiYZuTPE635C4cghGMpN8zQtWS04NY2SZ7BGLmPwqjTJKU 6GO1OsWTfrWK+UOEwyIpeMMRUTC4ArpbXZJtsinbq62fHgi34fvviGUX4gpWw9vhK9mC 3R6cRQC7Extyu9MU3azSWayIHinVfC3y10jpXvJV7mM20CO2kXTRb/o8p8tAcCrVZW+2 QLcS14hp6C7blxf/fL3Ywrvb8ekZn7ZG5hcaQUG7A5+1+GbyuUt3GwRDBDujOyXUQcYV fXRiY87mqLB6M9SaZw+nhDzyhirRA3hoX4jUsgSrciX3r92P/GIgjTMhWOM6eSGy0HRe EUdA== X-Gm-Message-State: APjAAAXfcy664zJv/rETus7xXF+jKQK1KTZL138tJsMgetejzGs5d6wv 50xHFLXJkhGNuPI30UCFx1M= X-Google-Smtp-Source: APXvYqze6gn0b1/VOLPNLG/TaRMXUQm4+BJkH059ijnTs6Iyp2vdwTr1cCrFaio9em2KMH1G4cXO/Q== X-Received: by 2002:a81:6c4c:: with SMTP id h73mr5633079ywc.489.1574616319379; Sun, 24 Nov 2019 09:25:19 -0800 (PST) Received: from titan.knownspace (173-19-125-130.client.mchsi.com. [173.19.125.130]) by smtp.gmail.com with ESMTPSA id 23sm2310056ywf.91.2019.11.24.09.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2019 09:25:19 -0800 (PST) Sender: Justin Hibbits Date: Sun, 24 Nov 2019 11:25:15 -0600 From: Justin Hibbits To: Konstantin Belousov Cc: Brandon Bergren , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355045 - head/libexec/rtld-elf/powerpc Message-ID: <20191124112515.4a3e69f4@titan.knownspace> In-Reply-To: <20191124164714.GD2707@kib.kiev.ua> References: <201911240435.xAO4ZTgw070233@repo.freebsd.org> <20191124130441.GA2707@kib.kiev.ua> <849a4306-1cf7-4296-b594-236caa1572a0@www.fastmail.com> <20191124164714.GD2707@kib.kiev.ua> Organization: FreeBSD X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47LcW45vvGz4FK4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Thtk0Kih; dmarc=none; spf=pass (mx1.freebsd.org: domain of chmeeedalf@gmail.com designates 2607:f8b0:4864:20::c43 as permitted sender) smtp.mailfrom=chmeeedalf@gmail.com X-Spamd-Result: default: False [-2.66 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; RCPT_COUNT_FIVE(0.00)[5]; HAS_ORG_HEADER(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[3.4.c.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-0.46)[ip: (1.97), ipnet: 2607:f8b0::/32(-2.28), asn: 15169(-1.96), country: US(-0.05)]; FORGED_SENDER(0.30)[jhibbits@FreeBSD.org,chmeeedalf@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[130.125.19.173.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[jhibbits@FreeBSD.org,chmeeedalf@gmail.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Nov 2019 17:25:22 -0000 On Sun, 24 Nov 2019 18:47:14 +0200 Konstantin Belousov wrote: > On Sun, Nov 24, 2019 at 10:32:23AM -0600, Brandon Bergren wrote: > > On Sun, Nov 24, 2019, at 7:04 AM, Konstantin Belousov wrote: > > > On Sun, Nov 24, 2019 at 04:35:29AM +0000, Justin Hibbits wrote: > > > > Author: jhibbits > > > > Date: Sun Nov 24 04:35:29 2019 > > > > New Revision: 355045 > > > > URL: https://svnweb.freebsd.org/changeset/base/355045 > > > > > > > > Log: > > > > rtld/powerpc: Fix _rtld_bind_start for powerpcspe > > > > > > > > Summary: > > > > We need to save off the full 64-bit register, not just the > > > > low 32 bits, of all registers getting saved off in > > > > _rtld_bind_start. Additionally, we need to save off the other > > > > SPE registers (SPEFSCR and accumulator), so that their program > > > > state is not affected by the PLT resolver. > > > Why do you need to save these registers ? Why would rtld touch > > > them ? > > Out of a need to make the binder as invisible as possible when > > interacting with code that may or may not be following the normal > > ABI rules regarding who is responsible for saving stuff. > > > > It's not just C code using it. > This was not the question. If a register is saved at the bind entry, > it means that it is used by rtld itself. I am surprised that rtld > needs anything from SPE. This puzzled us to no end when debugging. Brandon found that changes to SPEFSCR got stomped if done before a PLT resolution, which doesn't happen when LD_BIND_NOW=1 is used. Also, I found that sshd, when built with clang, would have a weird hang, which was also 'fixed' with LD_BIND_NOW=1. Tracing through the sshd problem, the values in question were stored in the nonvolatile registers, which shouldn't be clobbered by rtld. The SPEFSCR problem looks like the SPEFSCR was being reverted to a 'last known state in kernel', which I couldn't find a reason for. The swtch32.S code looks correct, as does save_vec() and enable_vec(). Unless I'm missing something there. I've gone over it at least a dozen times in the last week. The ACC register probably doesn't need to be touched, though. - Justin