Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3682908yba; Tue, 9 Apr 2019 02:31:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzah0fW2R4fnCS9QUIR2kIR0Fq0OMGfaoBvXIeib0wZbSnucVaP0ZTa+s3AS3myW1zy+j8 X-Received: by 2002:a63:2b4c:: with SMTP id r73mr34191421pgr.181.1554802271485; Tue, 09 Apr 2019 02:31:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554802271; cv=none; d=google.com; s=arc-20160816; b=s4Nh2nxuNATX+sYd7hdGZo/ZaXUw2KvUMVlFqChk/VEF6rzktjFWwQbowgsPDOTczm TZDRmE68pz8YApSkKtcifmbNwm47Yvq5ii6tLUQCcOSJD2IcBpIMYXLrzV+xHNGFMred TLYxSv+78ZoADKENo6+p34EniMcen2UZnIhKeO5qZdZRNOuWge150gfAg5zRPBit0d/v Lse9kdMd+L9Vz29uJ3Zzlv4KNkRCJ/QgITx+7o4I+HgJxneqRB/p9zrgVFuPBt4XAuoE G2zcVtgW4ImSUq4J6Hew2O8hiRUHZp9rB9KUv+Ht3AuDixuXBtDhe1LPUAeCtzodcnHJ Di0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uz/VlezM1F/whqslASz2+vc6bdT5jIpSqLI+shePWjE=; b=oAH7vq/9ENPjUEprmvxz5ekjq9dYd7Aalx986UNM6P1FDehG8zC/Nei8ystbCG6pTm Ck2JLTyReLmAi2Oj9EOBHYYFp/I6B8Zxw8sNohx3MG104q1FySWkSJj4+sdbafH5B2XT 6X9UZUTAa/t1CLiRvCS0GXdMnQJUNwE/IVjtCFfA22oOyxh5EJ5yjep2h+OGqVJPPemJ zkVnpvo7mtT3UV2Mk29aBtPoDNBnDP/8g6Ec/GOuCRd7l4fZW5h8iiobt5nLJPs+3QiE I70zIwgT4Rr2q0zgeXceYnqIueo15pi+IeAjJmfscSFXQxVkZV+F5cJ95Tfg3/6XSB34 +rQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lGzeATXU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i7si29969624plb.410.2019.04.09.02.30.55; Tue, 09 Apr 2019 02:31:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lGzeATXU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726992AbfDIJ3y (ORCPT + 99 others); Tue, 9 Apr 2019 05:29:54 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:35260 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726091AbfDIJ3y (ORCPT ); Tue, 9 Apr 2019 05:29:54 -0400 Received: by mail-pl1-f195.google.com with SMTP id w24so9067767plp.2; Tue, 09 Apr 2019 02:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uz/VlezM1F/whqslASz2+vc6bdT5jIpSqLI+shePWjE=; b=lGzeATXUcuz1REth//QzC6QQK7gnTIqEElIOzpj0qPWpDIHjLJ4nHnj9y8BbHJkeiW fshhy2gk/nw0yP/HOt3YfE+iPr6LhQADXbj0HJj+PSzpdxXZ746VKFoU+dlPmZQsE7kQ UipwR9qDkHlFQvASWgyhEwV3MgakU+4cEyp7OI3ChSlSZbxHQHVXe7zR7mIARm4Tpr6X 8qt89GOdp4jGitM1h5EGupWjUkrd9aWBr8qhLyLoJLn0PcJwKaONoK0WbcV67l8Ri7Js XbILueCyfJRQMbvDe2xmuEPc6e0SNYkGbXYznPQLnxq79x3Odp8thOKPtZAZsf8HC5AE Ns7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=uz/VlezM1F/whqslASz2+vc6bdT5jIpSqLI+shePWjE=; b=YmuK6Wwo3lLMgAm5suve0Os11V3vPF5N+y9lMrtPDQmiRsifLvEsTj47+0e8CW7Esq ZJnlhzoY+iQovS5uFTb5Wr1vDSj5xD7ygB6s/8SXah7w+6OSF1hGRqAJjoJslIWHvLuz Kv/fVd1XC0Oik7FjH2NKCn7R7cFoaggpPDyFL39A8+W2wydrK99ZRt6sed13csz4nimE LEEp/MbMImt/PUt6kb3U1Krx+K4dXahy6lnZ8UOT4PJ9D6Ij8R9Yi5D0GKS9hZ7HBc/j pR0EMskD0BYDo+joXAr97SV9q5c2Zq0x1xvUQxL6x8E/G4aj1KpXmXZx8kYbp0WEwf29 KhNw== X-Gm-Message-State: APjAAAUgipibidMjKgrz2zjNwrdtlvYVmyEBNXV3vohH70Gik3PVdZfq FSATysrVh7pOh0KpwD0SO6o= X-Received: by 2002:a17:902:b210:: with SMTP id t16mr30888324plr.84.1554802193226; Tue, 09 Apr 2019 02:29:53 -0700 (PDT) Received: from bubble.grove.modra.org (15.193.233.220.static.exetel.com.au. [220.233.193.15]) by smtp.gmail.com with ESMTPSA id f7sm59853420pga.56.2019.04.09.02.29.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 02:29:52 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 940A580586; Tue, 9 Apr 2019 18:59:48 +0930 (ACST) Date: Tue, 9 Apr 2019 18:59:48 +0930 From: Alan Modra To: Michael Ellerman Cc: Carlos O'Donell , Tulio Magno Quites Machado Filho , Florian Weimer , Michael Meissner , Peter Bergner , Mathieu Desnoyers , Paul Burton , Will Deacon , Boqun Feng , Heiko Carstens , Vasily Gorbik , Martin Schwidefsky , Russell King , Benjamin Herrenschmidt , Paul Mackerras , carlos , Joseph Myers , Szabolcs Nagy , libc-alpha , Thomas Gleixner , Ben Maurer , Peter Zijlstra , "Paul E. McKenney" , Dave Watson , Paul Turner , Rich Felker , linux-kernel , linux-api Subject: Re: [PATCH 1/4] glibc: Perform rseq(2) registration at C startup and thread creation (v7) Message-ID: <20190409092948.GA14424@bubble.grove.modra.org> References: <5166fbe9-cfe0-8554-abc7-4fc844cf2765@redhat.com> <1965431879.7576.1553529272844.JavaMail.zimbra@efficios.com> <87lg0tosfz.fsf@concordia.ellerman.id.au> <87pnq4zxyj.fsf@oldenburg2.str.redhat.com> <87y34o4xt3.fsf@oldenburg2.str.redhat.com> <43f97ddb-c8df-27ea-9517-63252ebd3183@redhat.com> <877ec4pam2.fsf@linux.ibm.com> <877ec3yffq.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877ec3yffq.fsf@concordia.ellerman.id.au> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 09, 2019 at 02:23:53PM +1000, Michael Ellerman wrote: > I'd much rather we use a trap with a specific immediate value. Otherwise > someone's going to waste time one day puzzling over why userspace is > doing mtmsr. It's data. We have other data in executable sections. Anyone who wonders about odd disassembly just hasn't realized they are disassembling data. > It would also complicate things if we ever wanted to emulate mtmsr. No, because it won't be executed. If I understand correctly, the only reason to choose an illegal, trap or privileged insn is to halt execution earlier rather than later when a program goes off in the weeds. > If we want something that is a trap rather than a nop then use 0x0fe50553. > > That's "compare the value in r5 with 0x553 and then trap unconditionally". > > It shows up in objdump as: > > 10000000: 53 05 e5 0f twui r5,1363 > > > The immediate can be anything, I chose that value to mimic the x86 value > Mathieu mentioned. > > There's no reason that instruction would ever be generated because the > immediate value serves no purpose. So it satisfies the "very unlikely > to appear" criteria AFAICS. Yes, looks fine to me, except that in VLE mode (do we care?) ".long 0x0fe50553" disassembles as 0: 0f e5 se_cmphl r5,r30 2: 05 53 se_mullw r3,r5 No illegal/trap/privileged insn there. ".long 0x0fe5000b" might be better to cover VLE. -- Alan Modra Australia Development Lab, IBM