Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84A93C64ED6 for ; Mon, 27 Feb 2023 17:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229659AbjB0Rbf (ORCPT ); Mon, 27 Feb 2023 12:31:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229799AbjB0Rba (ORCPT ); Mon, 27 Feb 2023 12:31:30 -0500 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C66D2387C for ; Mon, 27 Feb 2023 09:31:02 -0800 (PST) Received: by mail-ed1-x536.google.com with SMTP id eg37so28781562edb.12 for ; Mon, 27 Feb 2023 09:31:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:to:references :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=sfdOaCPfCziivM2Tv6IMdT3W1lqaL2IlqXt5JuNgXQs=; b=PlGSUtoahbX2111f3ZAQ7kIHk/6R8DWjYLkaOPUFYx7MPWYHkKWKjrMxKnW7j4QATW yTrfP9nppe0kG1bnqyyRGVfjzKIxZTLLjWGhJuD/mTaJEl+FOWXfBbruuR06b34wGzZl Johr8168ubTWeYMIH/csjkBMOzMt/MEIrnO/aEp09mv4USsKHTiyPPbgA5OaPputiTbU pdDaAQra0je0t6HrjRIMB9WaiDrcEB3t2pF1/mT5wWz7wlvImcI0g1UUoUveRbo69Hfb VRAYewQWwYQOfz9cXvqect+9DicxOnpQLEm4+XqVEghk+V33YsHE9Uczs+q/cqjV9jA2 ZzRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:to:references :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sfdOaCPfCziivM2Tv6IMdT3W1lqaL2IlqXt5JuNgXQs=; b=5aJvDfZ0zfCydI2kEZPo1S2pdp9DC8nU4DDNpT/czrlNu29At4AGaUX6i2lht2yh6X I0eB+Xao3e/qxD46yYmlUD2Vw/8vOZGt63O6VmzBvWuaROyl4oXHxGAtWIaGtpJeZYA6 r5rXWSAA0lpK+HPt8CrhnNVpwkOQKgKquDR6F2P64Ri53Fx7SNbIJemzOIyMGbpXevGH 7Tzb/vmw9VwbkszfVHmsw2sXPGYlsVkF/WLlJwEP2qKgJyA4qHGDpXU/ngQp2eGHbG1w Ido/FV8ek7UKWgXXV6JPoGcV/PQld7sufIowOeqR7drYgRjiFdyzJCEZY6gOdHvsiqbH IuOA== X-Gm-Message-State: AO0yUKVXzdPKyyCN/juYEC/dzVSd2tdwaRpbuGlmydQv9nr2sVmI36yZ YM66TpgI+33sguK0s15L1oXUrLfrD6s= X-Google-Smtp-Source: AK7set9orVb5cFRv9noXOBupqxQbzv2bq25+yDjhVZ5gXToV27CHqaSPu5eDC6usaqZZErn4PITVlQ== X-Received: by 2002:a17:906:c40d:b0:87b:d60a:fcbb with SMTP id u13-20020a170906c40d00b0087bd60afcbbmr32190772ejz.47.1677519056639; Mon, 27 Feb 2023 09:30:56 -0800 (PST) Received: from ?IPV6:2a02:587:6e15:d61a:5cc8:cceb:8cd5:6326? ([2a02:587:6e15:d61a:5cc8:cceb:8cd5:6326]) by smtp.gmail.com with ESMTPSA id gr16-20020a170906e2d000b008eb5b085075sm3413176ejb.122.2023.02.27.09.30.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Feb 2023 09:30:56 -0800 (PST) Message-ID: Date: Mon, 27 Feb 2023 19:30:55 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Fwd: [PATCH] ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO Content-Language: en-US References: To: linux-man@vger.kernel.org From: =?UTF-8?B?zqbPjs+EzrfPgiDOks6xzrvOsc+DzrnOrM60zrfPgg==?= In-Reply-To: X-Forwarded-Message-Id: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-man@vger.kernel.org Hi Alex, On 27/2/23 17:35, Alejandro Colomar wrote: > Hi Dmitry, > > On 2/27/23 16:33, Dmitry V. Levin wrote: >> Hi, >> >> On Mon, Feb 27, 2023 at 02:28:45PM +0100, Alejandro Colomar wrote: >> [...] >>> Ahh, sorry, I forgot about that. I reworded it to the following: >>> >>> ptrace.2: Add details about usage of PTRACE_GET_SYSCALL_INFO >>> >>> Document the role of PTRACE_O_TRACESYSGOOD option in connection with >>> PTRACE_GET_SYSCALL_INFO. >>> >>> Came upon this after writing a test program using PTRACE_O_TRACESYSGOOD. >> Just otherwise, PTRACE_O_TRACESYSGOOD was not used in that test, >> otherwise there wouldn't be any question in the first place. >> Did you mean PTRACE_GET_SYSCALL_INFO? >> >>> After failing to find what's wrong I posted a StackOverflow question >>> which you can find right here: >>> >>> >>> Nate Eldredge found out what happens by looking into the kernel's source >>> code, here is a link to the relevant part >>> >>> >>> In the code it can be seen that the union is filled if and only if the >>> signal matches "SIGTRAP | 0x80", a signal which is only sent if the >>> PTRACE_O_TRACESYSGOOD option is set. You can read about that in the >>> PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual. >> Once again, this "if and only if" is confusing, as PTRACE_EVENT_SECCOMP >> event that can happen when PTRACE_O_TRACESECCOMP option is enabled >> fills the union with the data of type PTRACE_SYSCALL_INFO_SECCOMP. >> >> PTRACE_EVENT_SECCOMP stop is similar to system call enter stop, but it's >> not exactly the same kind of stop. >> >> The note we're adding to the manual page is more correct in this regards. > Okay, I'll let Fotios write the commit message, and will take it whatever it is :) > > Cheers, > > Alex > So with Dmitry we agreed on: 1. Came upon this after writing a test program using PTRACE_GET_SYSCALL_INFO. 2. In the code it can be seen that in case of system call entry or exit stops, the union is filled if and only if the signal matches "SIGTRAP | 0x80", a signal which is sent if the PTRACE_O_TRACESYSGOOD option is set. You can read about that in the PTRACE_O_TRACESYSGOOD section of ptrace(2)'s manual. Replace these and we are set! -- fvalasiad --