Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4140466imu; Mon, 10 Dec 2018 13:53:21 -0800 (PST) X-Google-Smtp-Source: AFSGD/WespLtBTuokbwPwobReJby+KEfO1GTbnuIXlzBKxlbEp+EPw6w5ZCbX9ixedZH2/m+SxX7 X-Received: by 2002:a63:484c:: with SMTP id x12mr12184891pgk.375.1544478801750; Mon, 10 Dec 2018 13:53:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544478801; cv=none; d=google.com; s=arc-20160816; b=PdMWn+8jlVg11/ZnOs9+ScR05fheJzD+NQ+vDIQSkmCQUc3id1YFMZWZQnaI6BPGSJ QBtP72Q0RLl/nExugflnL0LqP6XoZvAPjBNbak5gu15MzbADN1KoUQJYydOkdxeDG+v2 OPcvCsNw2tqmuArt9WmaF9GSQm4Plhc1eAOa0DSJ40rxjh5hBjfiOaIXkzDgeL6O3SNf 4nvrNJNj7Ek2M8kXRy1U1P71b5FdfarcDcS+kWO2lgqXssV59JlVbmg1ujVwv/cxorlG Bc/KkCMc9aDosyy4OvCqPAVrRfO+AQF3Cdovh8jpWA2wPNdB4vKQAJXjClhcPlaZhjDS ohhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=gZlkw5nTHOnCTz+mG0sFvAxoSn9cEC79ZLW/77t2A78=; b=XP1S3YoedIakgil8yhdw/OR4SDRaFwa8tmkiKoVGwNsffHiLEFpk1yBqfV7Ncw0XMB Aywl+pbgfHR7NM3VuInCMlfMT4V8em1ET3TLxTQl/4SfT6eA5qUfGhxrMuKqpY5b1JYE Ac+Lybya3v2uTqx7G9Sr2VcRh+PhePVJs8QRa9oWSHpBxPxzbxY6PRVYft2i93QRlwHu cAXThETNc8INccgofOUAZlPeHjdRfeHJy0c/swS3cOaJ+TvoI8Cxma004q2jhxucic+M PKkv2UbzzrPjMoi+egpPEVU29kB7a9thjxld8zCK0IQlnDLE9auVItPMP6nt3zTBVWrr /dVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=csQdxTI9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l124si889501pfl.284.2018.12.10.13.53.06; Mon, 10 Dec 2018 13:53:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=csQdxTI9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730091AbeLJVEb (ORCPT + 99 others); Mon, 10 Dec 2018 16:04:31 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:34158 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729441AbeLJVE1 (ORCPT ); Mon, 10 Dec 2018 16:04:27 -0500 Received: by mail-pl1-f194.google.com with SMTP id w4so5830025plz.1 for ; Mon, 10 Dec 2018 13:04:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=gZlkw5nTHOnCTz+mG0sFvAxoSn9cEC79ZLW/77t2A78=; b=csQdxTI93bknbWpra3S3cRG9gO8dC4EnrAvWN/2sBCad2b4jg9o8ZTpEc7/1YMpDTS kFG5kSIQVRMCTB8F0ted3Cw0ZDlyv/eG3tn/kmgBQAkUhE+xpVrEy4Scxh7bAZMFxsNl Ea4pUMIPgVCajTISAkz9wj/2zCiRu0tM7/5wJMBtglJ0jXAq9eV6204YLDnhv8pVDSyj otM+VsJjYLMBMwEDhWkcYkDOfgymtdcQIH/LyYSVs+5blaE8ttqeUDq4Q5/TVPAG8PuY Z8+GhNOezfxF3IeHFvNm8iop2y+1ZnQv6Dvv0lgTwv6Tvgkgpip0Cf9R3RkQAGYG1jo1 S0rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=gZlkw5nTHOnCTz+mG0sFvAxoSn9cEC79ZLW/77t2A78=; b=PDLe+TmZRhVTONUXLcXF2LMA1/sRsdkgdxjca1yStmw6++OjGAjLmeu5F4eEulJrBr youBmpYlw+g6LixXWDooKn82xa3DAsD413HcvJQ2tQpVFDVkuHTIKm9RfqsThM2sfJWo xhxp/acyxCdZpWBEpL+nlE7r31sFdktgY1L8VUY16ljPTgdfPkgGiqLpYftc8d+liZNP u3bck/ldQxsUnMiojpKZQCYmmuFOx+XPrRGfEqreKnrP/wBRNerai4yUS34T3hsp00TT ve3Jw+Txe4cp5OHC1p2iTpGkhgVHrBzbZj0XJGSXXqFAcS0P4GA2E5YTlYlxOq1oE4I8 lLdg== X-Gm-Message-State: AA+aEWawpe8pvjYU13vG4zR2mpNY8xuPjFyEBSqYuLml1QNwfWkBp/ME /2+YBT0NvvFtmRL8LJewMs9grw== X-Received: by 2002:a17:902:b118:: with SMTP id q24mr13718623plr.209.1544475866627; Mon, 10 Dec 2018 13:04:26 -0800 (PST) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id b2sm17315351pgg.87.2018.12.10.13.04.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 13:04:25 -0800 (PST) Date: Mon, 10 Dec 2018 13:04:25 -0800 (PST) X-Google-Original-Date: Mon, 10 Dec 2018 11:14:25 PST (-0800) Subject: Re: [PATCH v5 24/25] ptrace: add PTRACE_GET_SYSCALL_INFO request In-Reply-To: <20181210180421.wq3ruldbpvu2jpfm@pburton-laptop> CC: ldv@altlinux.org, ralf@linux-mips.org, jhogan@kernel.org, oleg@redhat.com, luto@kernel.org, lineprinter@altlinux.org, esyr@redhat.com, keescook@chromium.org, jannh@google.com, linux-api@vger.kernel.org, strace-devel@lists.strace.io, linux-kernel@vger.kernel.org From: Palmer Dabbelt To: paul.burton@mips.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Dec 2018 10:04:22 PST (-0800), paul.burton@mips.com wrote: > Hi Dmitry, > > On Mon, Dec 10, 2018 at 07:09:40PM +0300, Dmitry V. Levin wrote: >> We decided to add .frame_pointer to struct ptrace_syscall_info just for >> consistency with .instruction_pointer and .stack_pointer; I must have been >> misled by comments in asm-generic/ptrace.h into thinking that >> frame_pointer() is universally available across architectures. > > Is it correct to say that you're using frame_pointer() purely on user > register state, not kernel? > > If so then one option would be to define it for MIPS as something like: > > static inline unsigned long frame_pointer(struct pt_regs *regs) > { > return regs->regs[30]; > } > > My concern with that though would be that providing frame_pointer() > unconditionally might mislead people into thinking that the kernel > always has frame pointers, when in reality current MIPS kernels never > do. In fact a comment in MIPS' asm/ptrace.h seems to suggest the lack of > frame_pointer() is intentional for exactly that reason: > >> Don't use asm-generic/ptrace.h it defines FP accessors that don't make >> sense on MIPS. We rather want an error if they get invoked. > > Looking across architectures though MIPS isn't going to be the only one > missing frame_pointer(). With a little grepping it appears that these > architectures provide frame_pointer(): > > arm > arm64 > hexagon > nds32 > powerpc > riscv > sparc > um > x86 > > That leaves a whole bunch of other architectures (16) which don't have > frame_pointer(), or at least not in a way that I could see at a glance. We (RISC-V) default to compiling without frame pointers. I'm not sure if it even makes sense have frame_pointer() on RISC-V, as it'll usually return garbage. >> Unlike .instruction_pointer and .stack_pointer that are actually needed >> in strace, .frame_pointer is not used, so from strace PoV we don't really >> need it. >> >> So the question is, does anybody need a >> struct ptrace_syscall_info.frame_pointer? >> >> If yes, how can frame_pointer() be defined on MIPS? >> Or should we just forget about making sense of frame_pointer() and remove >> struct ptrace_syscall_info.frame_pointer from the proposed API? > > So, along these lines my suggestion would be to avoid it if you don't > really need it anyway. > > Thanks, > Paul