Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3427695pxb; Sun, 31 Jan 2021 15:58:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTjUssS6CcOfGEXqBjb30snbzOXHtZDVdPN/Lv9f42sjCP9ODX0gYuvKc4OD9wkgajPvoM X-Received: by 2002:a17:906:53d0:: with SMTP id p16mr14871736ejo.38.1612137486217; Sun, 31 Jan 2021 15:58:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612137486; cv=none; d=google.com; s=arc-20160816; b=dbq1GoW4o/GvtmfocFLpsLd6nHRb2my/hQV0oYwZa3EeMDMD5uvhiMO3rJ/+IbvBG4 rfNn/MeRfwwbN4KdfkB6wfMzXlJHILTO7WrRdaiiV3mMsggK2gt9tD7Gx6cFU5sKNMny MHzvLoCuL+G1eQIiKAFGN5x8X8k0zag5k4RgIieHOuQrWhvuim5vwJ/4B0O6qRp9dyvi 0b2WcM9OIegUaVFnRrXaWwjFCgvL0gSr/Us3CSOphFN9542a7L4Dh+I3Q6scdmWrg8Ua ALhu/qCi/n0uxDZg1XwSCzIrvxyxwtjq/hgr37hHnwNDCID+l4ux/LBP6VK8J/RZA7K7 CisA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=yRoG5qVuxYKudfRmW0vqrzuE2IgF/ZVOGkujh8O168s=; b=ZSIpaEHFZYFhaZcdlR7EMyMwd6+bRKPaOUyZ0J+DYcJX19y+KhBXKbnXyT2ucOohk2 vYO/yqR5bJbhoXqT87hK+Q9P/S2ZX4vZ002+6vMV3mvdQ8FGgKdy0O3Rny/ULjZtU9CK tDZDeS+LowzfGRZdhvQ/SC8Z+49pD21s7AuE8ruA30S0k86aRDEG3Xaalgo+4auOe+H9 JciTQTgXTC/KQe36hqC/aaAHacgmVbejCcZJ53xc3QM6v0SnAUmmc5Ynfx2Y4pfDuco5 V91DYNgRjKt5+6at/9pq7RkZlVtPHGZg4Zt/ijL/+PuBzXHTLvrWx9pP5ZsiiYaRv6GZ QpWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=Wb1bWoEB; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si3995968edb.204.2021.01.31.15.57.39; Sun, 31 Jan 2021 15:58:06 -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=@linux-foundation.org header.s=google header.b=Wb1bWoEB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229769AbhAaX5H (ORCPT + 99 others); Sun, 31 Jan 2021 18:57:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbhAaX44 (ORCPT ); Sun, 31 Jan 2021 18:56:56 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24BE3C061573 for ; Sun, 31 Jan 2021 15:56:14 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id a12so20378699lfb.1 for ; Sun, 31 Jan 2021 15:56:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yRoG5qVuxYKudfRmW0vqrzuE2IgF/ZVOGkujh8O168s=; b=Wb1bWoEBRs+EDZTJX4jLJucJ8zHUULtPY6M3Sr8oyEbYzHf8h5KMedkvxLdFh8SUzi J5CJO4RISE+uEPslRqXACZMIyp5D34On2lLMtRSk+ZuDHYNrMWjCpo1Uw96uIcNCS7xN PBIr3o5yQGrrSQBXmN5w30dHWXglXwecX8EqA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yRoG5qVuxYKudfRmW0vqrzuE2IgF/ZVOGkujh8O168s=; b=JxIeoO1fkyYfpuLcXgHMt+qBwJjDtIOu9xmOrbE013vkll1cV1FYJxGSWxLBag7S9F jI2xbeOPmIfP/E0lV5a+OoNP//kFjEl+Kftx5cqUe0JJeI72l8H/beFRHqaRaJYHikWe 9MG7u31dAW8BNfDWiVYRsIR9u8whUOnG3vg75PYvoTS8eSXwDqdknPZZ9rax4sF7ipcK 5QpQGDwlHNwlHE8J6k9YZkfJFd9DC+cxhiPrNQ9vSZEcMWaTiJVxufK+HwbqJlJ3CsD2 kEnz1NBibgPd2Qqen+kHRSzxNaMfoESCSxYHfPZdVVAEGElYESifZMnYdcdQZQVRCDtH hgAw== X-Gm-Message-State: AOAM5305AFBaES3Xl8jKjF/XLx9cp4Fo2NHiqMQr4eXSNILuAfvXcZNa vgaiGseiXqAPaXdP1PmSIktRfkLbfNCo9Q== X-Received: by 2002:a19:8983:: with SMTP id l125mr7013043lfd.182.1612137371928; Sun, 31 Jan 2021 15:56:11 -0800 (PST) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com. [209.85.208.175]) by smtp.gmail.com with ESMTPSA id a1sm661217lfi.202.2021.01.31.15.56.10 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 31 Jan 2021 15:56:11 -0800 (PST) Received: by mail-lj1-f175.google.com with SMTP id v15so14393027ljk.13 for ; Sun, 31 Jan 2021 15:56:10 -0800 (PST) X-Received: by 2002:a2e:8116:: with SMTP id d22mr8355574ljg.48.1612137370575; Sun, 31 Jan 2021 15:56:10 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Sun, 31 Jan 2021 15:55:54 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [REGRESSION] x86/entry: TIF_SINGLESTEP handling is still broken To: Kyle Huey Cc: Andy Lutomirski , Thomas Gleixner , Andy Lutomirski , Gabriel Krisman Bertazi , open list , "Robert O'Callahan" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 31, 2021 at 3:35 PM Linus Torvalds wrote: > > I wonder if the simple solution is to just > > (a) always set one of the SYSCALL_WORK_EXIT bits on the child in > ptrace (exactly to catch the child on system call exit) > > (b) basically revert 299155244770 ("entry: Drop usage of TIF flags in > the generic syscall code") and have the syscall exit code check the > TIF_SINGLESTEP flag Actually, (b) looks unnecessary - as long as we get to syscall_exit_work(), the current code will work fine. So maybe just add a dummy SYSCALL_WORK_SYSCALL_EXIT_TRAP, and set that flag whenever a singestep is requested for a process that is currently in a system call? IOW, make it a very explicit "do TF for system calls", rather than the old code that was doing so implicitly and not very obviously. Hmm? Linus