Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp499717pxb; Wed, 3 Feb 2021 10:15:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+2HT5LaQ4Usq7kC8RuJl3sDYeqEZ4NyzSDzWmm6HU2dY8wLMmmEZg3inGc0t+ZjU1X+mA X-Received: by 2002:a05:6402:28e:: with SMTP id l14mr4542447edv.307.1612376129372; Wed, 03 Feb 2021 10:15:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612376129; cv=none; d=google.com; s=arc-20160816; b=AD4He05BaJW9/9q259XRVKeBfrZ0pWaF5GZ5/3ZcbmNw2yDBl6WwoIZjPpWZrhmnct vZCkt8KOdSF1r3qkxX1YdhjJ5z1ZGdgphqqN07xlnQGCD48vE6Eoq29RAM6/KocNxK/g Yk5HBzorycXlwAeC8qUXOJJqsoQQ+temLkqwuEmv9bPu51K2zXmgBl0n/94AF8iK71ri D1s6f6SRIkUTD4nG9AbqAvewQ2InLDlMVwAbv1PRON/B6J2r4SmCkPi0J86qmd5ahgWe p1NSQq++1jlGKf8o8rlXFAaj5T7jwFxrERe+Ey7p17Tuv7+IAVfh0Aic9FVaJzZriG1i t4wA== 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=BFXCAVCvdE4leeiqwZ8GWgSDSdNV/A3WBUdTkZX4UbY=; b=I8TC3kV/VF1B1uVJoSvs5uV27+wzjA3qNHT9ekl0KhyUEgvKNLCqDuOe8d1bV596g2 DaFK5ISwU6aR0rYe5KewHaOMZwRK644cy2dq0/dQqcb/9q7IW/UnXH3PrD8yn83P9iOJ bQwSksOgodUxYps6wIq6rcs1kE3n9C3l0RakcJhPcFkvb+ClmtdCrBhaXbqgx0biXmwB ocIqZiC8wH9c5zsnPwjvsUQXJMuzRURD9CdAab82yzBtuGr396m76Jjyb4N1wzmCOxKi mcnW3pxm7eNybsFR37I7+LUO0/mm714BtnCcuoQUVg4CCM2q3r7arT7qrz9P0KYSz5wq folg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=OrBhEbny; 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 kl24si1868277ejc.100.2021.02.03.10.14.53; Wed, 03 Feb 2021 10:15:29 -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=OrBhEbny; 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 S232107AbhBCSLh (ORCPT + 99 others); Wed, 3 Feb 2021 13:11:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbhBCSLg (ORCPT ); Wed, 3 Feb 2021 13:11:36 -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 1FAECC061573 for ; Wed, 3 Feb 2021 10:10:55 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id b2so561547lfq.0 for ; Wed, 03 Feb 2021 10:10:55 -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=BFXCAVCvdE4leeiqwZ8GWgSDSdNV/A3WBUdTkZX4UbY=; b=OrBhEbnyo/XZUMBBvytRNE26lRBineus1YdnTJHiM+Y67CNInq2iAOHp71uC9JNWSr g+mSObkseSofSfARkErTuSJENECRsrcfsJiaitkgVgJWMlVsUoi/DI07rzVk3KGXuQ18 Ww+tukeCLDnTK8i61qN955q2PduKmHgCKvPQU= 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=BFXCAVCvdE4leeiqwZ8GWgSDSdNV/A3WBUdTkZX4UbY=; b=suTum+EdUnbX5XRwD0ALH1QJRGt3/BLtcTRTfYyP8LhHmK7NYGT0BWxuHR67PGh1ME QEtowNWa09UrB1FcWUhpIl9ZTOiJoyqrefgr6e0yh0SC5GshrSw2/mJcW5QigEtrLBHJ vkNusnnrlrV06Hpx2ZdGmokTYnnuaY+z6jxD8luN4XGUzxDMrSYyQsiYw3nw94XaKocC SO6nGppZ4/eun0t6dchS23JEt4hBq3hb3ZqJqXiwczxfMlMAUtsza9e4Y6pUyaN25Meg zZ7Svkm/iqPi30zNIqKZRi3kyg3qW3rzD+wA5ML3F2Bt3aO5unu+6dHlRfrYtfXcN/kh zyBA== X-Gm-Message-State: AOAM5334F3JlEa+VoZW5ef+JFJkRUNn+zbK7z4yoXXtJSfLjP1FG6m1V Djn1iTTVuqnCvsuDt13RabAQoNO//p5tjQ== X-Received: by 2002:a19:5509:: with SMTP id n9mr2468732lfe.111.1612375853276; Wed, 03 Feb 2021 10:10:53 -0800 (PST) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com. [209.85.208.180]) by smtp.gmail.com with ESMTPSA id m16sm315643lfu.220.2021.02.03.10.10.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Feb 2021 10:10:52 -0800 (PST) Received: by mail-lj1-f180.google.com with SMTP id f2so100788ljp.11 for ; Wed, 03 Feb 2021 10:10:52 -0800 (PST) X-Received: by 2002:a2e:860f:: with SMTP id a15mr2399715lji.411.1612375851966; Wed, 03 Feb 2021 10:10:51 -0800 (PST) MIME-Version: 1.0 References: <87h7mtc9pr.fsf_-_@collabora.com> In-Reply-To: <87h7mtc9pr.fsf_-_@collabora.com> From: Linus Torvalds Date: Wed, 3 Feb 2021 10:10:35 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] entry: Fix missed trap after single-step on system call return To: Gabriel Krisman Bertazi Cc: Kyle Huey , Andy Lutomirski , Thomas Gleixner , Andy Lutomirski , 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 Wed, Feb 3, 2021 at 10:00 AM Gabriel Krisman Bertazi wrote: > > Does the patch below follows your suggestion? I'm setting the > SYSCALL_WORK shadowing TIF_SINGLESTEP every time, instead of only when > the child is inside a system call. Is this acceptable? Looks sane to me. My main worry would be about "what about the next system call"? It's not what Kyle's case cares about, but let me just give an example: - task A traces task B, and starts single-stepping. Task B was *not* in a system call at this point. - task B happily executes one instruction at a time, takes a TF fault, everything is good - task B now does a system call. That will disable single-stepping while in the kernel - task B returns from the system call. TF will be set in eflags, but the first instruction *after* the system call will execute unless we go through the system call exit path So I think the tracer basically misses one instruction when single-stepping. I think your patch works for this case (because the SYSCALL_EXIT_TRAP flag stays set until single-stepping is done), so I think it's all good. But can you verify, just to allay my worry? Linus