Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2363046ioo; Sat, 28 May 2022 11:18:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlsVLCZQuFOlgPe1NBo9J96/JAbb/SJyFb241VccZentSrcEFjrO65J7CuNngfjlutQDSE X-Received: by 2002:a63:a23:0:b0:3f5:e1e4:ae3f with SMTP id 35-20020a630a23000000b003f5e1e4ae3fmr42716773pgk.110.1653761931821; Sat, 28 May 2022 11:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653761931; cv=none; d=google.com; s=arc-20160816; b=rICA3Tx8W1b/wTnRjJ1iVLlSP6mJkmEiE+36Noo63jLUthHwn0Xb2ccc81PcBEhYHT O3U+349rqF2RYQLSlLcSzM0UzUUf2PhGkunRuEYhgmlR32oBl+WuQ6bVF6srOMa3gRGg 4JnCSO9rKP7EleWDM4xKn/+C3G7YCubuhxJe0omZfZlbi2M2GxDdCTcYiI4t+EWzn208 4F8DrXcx/O50iWYrNAgKUZuUnjzcqEVW0ZY00FQYw52WVPMwvEUnDWWr0V6gFU/FbPKa PmxgP9vBgn0KufbTEeFm6yovDfptlXVbt4Ia9DqHBFKPUON4oiT3fl0ZKEbG/HuEVHiF fFZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:subject:to:from:date :dkim-signature; bh=YzwEZeogELvYznjmKjoEpg1kqpG0/ui/CTj1gU9uZFI=; b=pxhpKQ/Y0tcy5WIuOlHAzwgJXkEdjtbDX1pYqXkeRqNozRrb4wL6x1ROnogTYwZlJr MabFt3DLEr169JJhGJwHqTF7TIj+fniuVwZYWRaMrtK1BT4hq0u2/TWwYG5hRJwpj0KY gf2t+oK6C18UyrW0hQ/e24XbFxlLJ7AoHBQwWWeb1WxuYdBi1qCuBpEBdZfo7MsXhIex nGfmN88SjAuUHgiaVrbyf2AFVSOXSs+vrmO9EhHq/kUTgRytVh8Tm3GvWtZn5IpQtpH/ qxQst/Tk7L+wlG1mTJKK+wfXHipmqsFH5MR+3dzIt/W7OIJZ/UZJF8Lvzgp5MGKaThB6 AA/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@thatsmathematics.com header.s=condor header.b=CoK5wVph; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id ji10-20020a170903324a00b001635dd9f240si4663892plb.24.2022.05.28.11.18.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 11:18:51 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=fail header.i=@thatsmathematics.com header.s=condor header.b=CoK5wVph; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4356214080; Sat, 28 May 2022 11:18:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234750AbiE1GNO (ORCPT + 99 others); Sat, 28 May 2022 02:13:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229936AbiE1GNO (ORCPT ); Sat, 28 May 2022 02:13:14 -0400 X-Greylist: delayed 568 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 27 May 2022 23:13:12 PDT Received: from mellona.thatsmathematics.com (mellona.thatsmathematics.com [IPv6:2001:4801:7825:103:be76:4eff:fe10:2a2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7ECA2DD5F for ; Fri, 27 May 2022 23:13:12 -0700 (PDT) Received: from moneta.lan (unknown [76.130.20.142]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mellona.thatsmathematics.com (Postfix) with ESMTPSA id C1586FC282 for ; Sat, 28 May 2022 06:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=thatsmathematics.com; s=condor; t=1653717821; bh=9tm6ZEmqHdu2c38ZNE0Pzxj5I6pVrb0PO0DnQuFukaE=; h=Date:From:To:Subject:From; b=CoK5wVphOcLI6MPH0Re/mMKw8yYiGTbCK0GW2qoDalXyqQec8g4Y+9y7ioQzKTSxX 0AGKyFXxsCJsR9R4mZAhleG/4kqUz2ECP0BCvjGciv8m6PhVGVmOjLKeZLPuCe3XxY MNao+Rr2TN9wCDth4tv2eMrcQ7cjz5f5QFRdY+PQeRmXrGP3YZk+kyxnutQ7EGHAMb 56g3av6kGq1wne6fTBrh4jEO614spLEDZIxRbqjYhg045yZXT5415wYJyATZDUn4QA XdZH8O32exMEmWnV8yYbhmKV4ZRQC/EnoUo9m75V6xpQOCDxcM0Y1xzoTxtfIQuAit 2A8vxYdQ2npvg== Date: Sat, 28 May 2022 00:03:39 -0600 (MDT) From: Nate Eldredge To: linux-kernel@vger.kernel.org Subject: PTRACE_GET_SYSCALL_INFO requires PTRACE_O_TRACESYSGOOD but not documented Message-ID: MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It seems that the PTRACE_GET_SYSCALL_INFO function of ptrace(2) only works properly if the tracer has set the PTRACE_O_TRACESYSGOOD option. The man page doesn't mention this requirement. Is it intentional? The issue is that ptrace_get_syscall_info() in kernel/ptrace.c only calls the ptrace_get_syscall_info_{entry,exit} functions to fully populate the ptrace_syscall_info struct if child->last_siginfo->si_code == SIGTRAP | 0x80. And the 0x80 bit is only set when PTRACE_O_TRACESYSGOOD is in effect. Otherwise, the struct always comes back to userspace with op == PTRACE_SYSCALL_INFO_NONE and the entry (or exit) member is not filled in with the system call arguments (or return value). -- Nate Eldredge nate@thatsmathematics.com