Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3421867pxb; Sun, 31 Jan 2021 15:44:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzc2frRLPhPcsmDQ3+FYwf1Q7jFRmeP53VanYMljfIbCj3N94TJuMzxnzh9PNdGdzNs4ahY X-Received: by 2002:a17:906:398c:: with SMTP id h12mr15126418eje.469.1612136692600; Sun, 31 Jan 2021 15:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612136692; cv=none; d=google.com; s=arc-20160816; b=jURzdeO/NCJ4H6+eGh5B8Q0QArqIZJrsUjaTfwCqy9wVYPv+ZW4lxkxUXm0gQ3V1Vt NlV2Zkv2ceeUcVeMnj961tBeQiBlk9QqW5AUbn23jagNPajTSxJhy8DYc7sCl9hqYHe6 YKKz57izXUg5vXGfpg0mD5VU727vL5W0mNy6vGb3k8FVYSnDkfTnCDRG4k0GpY/VRyvn 7QyR6NefEtirJRzLoNfnIa4MwC/jAqPEyY6layDCxkKQEBbW/UlN1zRPam/KO6DEL0VF Q4E2ypyge1vA6RWpSP+QC/J4V+b9GLyZocnd6SM++f2iqauAxooGyqGqy2GyVCZbJvkn isgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=XbzouG8PydFCDTlas8eNfcrwuHLUjTspuJx0Lwu9f2s=; b=Hqk1GjSW8Kf5eHXlvS/XKA3sT5eHe+9I8fNEOL++gk2i6Y0hwdZyxDnsgDuvJ6leSj FFkDWtnVUGHaL8rJ9ae3qMMMk79Tv7+BMytSs8KqoxDAVljc8wRRlFOPf5XH4Oa1Ld9O QQtO8FoSzV95QOYPhfP/g08sCfPCxLEkytd0/SZvvdKekMFN9d4OAFTizSfQPyKhTW4o MGkjZPkrif0hHVZduD5RyjJgmdwAilnsDP6Egd8wJd2egjWaE8f/ywx2yj7aceVf58gL KwZP6kVAHdAhK2uWPLb2gs1SYdT4K58EsPFbNPYhy/x3S9AF/k0tuwXHuxsEoWHMjhQ9 h5Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qMP4MnEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb21si3592028ejb.278.2021.01.31.15.44.27; Sun, 31 Jan 2021 15:44:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qMP4MnEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229506AbhAaXlp (ORCPT + 99 others); Sun, 31 Jan 2021 18:41:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:45802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbhAaXlg (ORCPT ); Sun, 31 Jan 2021 18:41:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2D34164E2F for ; Sun, 31 Jan 2021 23:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612136454; bh=XbzouG8PydFCDTlas8eNfcrwuHLUjTspuJx0Lwu9f2s=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=qMP4MnEQD5ElKte9/fC/X+aYzmUlWwi1djfofXeFU1pTMcZBpAjJZn7U2m/MX9x2Q 6TF0B+5NKkZZHGo8wtXvxcHJ6lw3+LDC7R0ezosqziLNfBIXPjyb/K6Zmk3IPTQSzF 7OSxLO6cRdRpXiDkfh0At+IUEhnI2aOEhQL1zXBvFh+ZPYY58RSN0J49iQe/AWAPK1 9HmUxD+WBun2dd1HFhUAlxjHYqqgAjt0wqI9tJpvpEv5OR4u8BfUoqW/7E30MWtD22 Au+Yn7kftelRTM+tyj4+7VwCenR3N7ur9FYvxfiGrJbm8XxHmR3sAmEXYo3fG6Csbp SQfZsLMNcmiFg== Received: by mail-ej1-f41.google.com with SMTP id kg20so21540503ejc.4 for ; Sun, 31 Jan 2021 15:40:54 -0800 (PST) X-Gm-Message-State: AOAM532sNpS9ufCDr0AAepZXK0kBFEa/spdjlLabT+HoZNJ6e7A4xEKZ A0puw6v5Gx1dBXEKwrgFBf4FkXKrMFgIg4GpOymrew== X-Received: by 2002:a17:907:104c:: with SMTP id oy12mr15001661ejb.503.1612136452670; Sun, 31 Jan 2021 15:40:52 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andy Lutomirski Date: Sun, 31 Jan 2021 15:40:41 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [REGRESSION] x86/entry: TIF_SINGLESTEP handling is still broken To: Kyle Huey Cc: Linus Torvalds , Thomas Gleixner , Andy Lutomirski , Gabriel Krisman Bertazi , open list , "Robert O'Callahan" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 31, 2021 at 3:39 PM Kyle Huey wrote: > > On Sun, Jan 31, 2021 at 3:36 PM Andy Lutomirski wro= te: > > > The odd system call tracing part I have no idea who depends on it > > > (apparently "rr", which I assume is some replay thing), and I suspect > > > our semantics for it has been basically random historical one, and > > > it's apparently what changed. > > > > > > That's the one that we _really_ should have a test-case for, along > > > with some documentation and code comment what the actual semantics > > > need to be so that we don't break it again. > > > > This rr thing may be tangled up with the nonsense semantics of SYSRET. = I=E2=80=99ll muck around with Kyle=E2=80=99s test and try to figure out wh= at broke. > > > > I=E2=80=99m guessing the issue is that we are correctly setting TF in t= he EFLAGS image, but IRET helpfully only traps after the first user insn ex= ecutes, which isn=E2=80=99t what the tracer is expects. > > The state of TF shouldn't really matter here. There should be no user > space code execution in the example I gave. This behavior all happens > in the kernel and not on the silicon. > I admit that PTRACE_SINGLESTEP seems like an odd way to spell "advance to the end of the syscall", but you're right, it should work.