From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F33A1D5CF8 for ; Thu, 16 Jan 2025 21:08:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737061684; cv=none; b=o1Ydmz7QVPeSLSYeWHTSJdC3XCcuH+EV49Vcm/CJV5JgnmtHB8K5zd37AoR6TedNrFLkX1WRMZANPUgz1F5oAGOmkG3klkjwOHNl0D+TmGLB5HBJPjHMaiF1AXQ78GvozNJxHAeo5vA4tGyeJC4HF4Behy1yFvsbHHpvbCRc8Zw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737061684; c=relaxed/simple; bh=cFCXo5aRHUNgTON+50o3HQPg1dnwOvOkVIemCmVQ8f8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cRCm0dB//io1r9lcJeraNYbm1JKIj73ZIbQiK25RcQmC4GZzJLy+qpSK/M/6L9jKSdFgPQbNCVAbmxbNk027p8+3XYyWO2PxG4SAqr8eMfm2rqmqtJ/3/eN2oXgxSOvCMMEAZ4nA1KQpt44DywgO7AMNsRgkXnktKSrED8XEvJ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=ujuGrXhr; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="ujuGrXhr" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2166f1e589cso33916855ad.3 for ; Thu, 16 Jan 2025 13:08:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1737061682; x=1737666482; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QYbPqa4RiaKO/hTBkhTc15dnfxRHVJkFjnysbuWDQxU=; b=ujuGrXhrCbldyc+pwnJd1IceuKeEfNnhBo8Kogcksn5aE8OBesjRSATTV2bUKQnzdm dk9XyFKdkqbQ+Qf4alKvbyY8OXb/CzeaUeTCN0eTBZXUydCj8KQgYUjabZxb+O/UPSdm B5mqU+UVGcjfff5RPzl2nvjBaVKMp4yApeXNwvceRIJtSjEeY2E4RDZVf9yFqSeaOUHL 2XjdoxVjXBeb9NlYwjEpcjCsxwR3UFRryyc2PuSq/MZc3pIWtwgwhpUJ7THLz0N9Mjwk 7RpY9+MeGvg7k24daMGRAaxbB0dgi2H/OjIBaBn8rL5oNhdJlboVl8TKpgcqbyaRwH0Y b3uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737061682; x=1737666482; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QYbPqa4RiaKO/hTBkhTc15dnfxRHVJkFjnysbuWDQxU=; b=HZd7rIQAEM7mLWjzMeduxRGpN0TIMZU30bwDBOGSDT1wN07ywoxb3q8bqTTfzEMDO5 ZqbUxIUpIIKlC5Gug2GQVmPNH8ZtJxZ3MtXPPnhqH/S4n5pgv1d7h9+t2aJiCyAQrm3D WkO6wzmkgWYAWZ/oyrlAAtUoZhoK3gioRcZIvb8nkV12nKnW6BSp4d322ROLjgx0C7v5 sQ+O9u6fDIpuJJwnEGr6CWdg5MUOh43toV3U3kPxHUml/BGTVUq9jq5gCLSC2zWeKELW RCFQn4VjZTIfcamLbfD6f93cFUqn/TA9fg4ER+P42cLHu3wHVgnastgDhPyjWbI3xGcv HImw== X-Forwarded-Encrypted: i=1; AJvYcCW0Ecq5bG7AfVnG/JSjTLYQXE2E6dMauxO9hzVobwC/6rFGuN8ZBqYCSjv/pFV3k8uS4aMQt2/xDd0tmVQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyXOwzrxQyppx0bXao9Q8Y5R4vUV/N2hnyZrpgxhi2fH23ARnmz 0yDdJ++0OsihuHnJndtwesKtp1l6TkIDB7OeSq62K/4K/djV1Hqy7b51dJ5oXPw= X-Gm-Gg: ASbGncuwEj3J0IQAnyQfPpi8gPQ6uV+pbOR4b9WEM4celba6nh2nOkSARq4Bmiokw6j GRHEyO2RwWYOKzqXG8o/ZtB8Ox/PiZj1ZaV+AbjIkFRFHnWkvQm3DUO8IYDr2pGwaXsvIt9LV7O KPt80FQU+dLiEP6FrXLedt2O2UAbuJ93vMeGvTiC4QJOz5MS43ATyw0a4UqghGuu1glFnn4utQe FW4uuN7SOjUcn/f8CMpPbWOD5posaLlr/usjSRciU1JKCo= X-Google-Smtp-Source: AGHT+IFjDytlvcL7R5uQyvD6/d+hRUPwU3v5GzGwrdH86L/g1oC0ZqcMzxtSZiqKwpSVhCo7eZNW3Q== X-Received: by 2002:a17:902:e74c:b0:215:7719:24f6 with SMTP id d9443c01a7336-21c355cac95mr2790395ad.23.1737061682064; Thu, 16 Jan 2025 13:08:02 -0800 (PST) Received: from ghost ([50.145.13.30]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21c2ceb8358sm4331645ad.71.2025.01.16.13.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2025 13:08:01 -0800 (PST) Date: Thu, 16 Jan 2025 13:07:59 -0800 From: Charlie Jenkins To: "Dmitry V. Levin" Cc: Oleg Nesterov , Eugene Syromyatnikov , Mike Frysinger , Renzo Davoli , Davide Berardi , strace-devel@lists.strace.io, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH v2 6/7] ptrace: introduce PTRACE_SET_SYSCALL_INFO request Message-ID: References: <20250113170925.GA392@strace.io> <20250113171208.GF589@strace.io> <20250116083328.GA32173@strace.io> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250116083328.GA32173@strace.io> On Thu, Jan 16, 2025 at 10:33:28AM +0200, Dmitry V. Levin wrote: > On Wed, Jan 15, 2025 at 05:55:31PM -0800, Charlie Jenkins wrote: > > On Mon, Jan 13, 2025 at 07:12:08PM +0200, Dmitry V. Levin wrote: > [...] > > > + /* Changing the type of the system call stop is not supported. */ > > > + if (ptrace_get_syscall_info_op(child) != info.op) > > > > Since this isn't supported anyway, would it make sense to set the > > info.op to ptrace_get_syscall_info_op(child) like is done for > > get_syscall_info? The usecase I see for this is simplifying when the > > user doesn't call PTRACE_GET_SYSCALL_INFO before calling > > PTRACE_SET_SYSCALL_INFO. > > struct ptrace_syscall_info.op is a field that specifies how to interpret > the union fields of the structure, so if "op" is ignored, then the > kernel would infer the meaning of the structure specified by the userspace > tracer from the kernel state of the tracee. This looks a bit too > error-prone to allow. For example, nothing good is expected to happen > if syscall entry information is applied in a syscall exit stop. Yes that's a good point. > > The tracer is not obliged to call PTRACE_GET_SYSCALL_INFO to set > struct ptrace_syscall_info.op. If the tracer keeps track of ptrace stops > by other means, it can assign the right value by itself. > > And, btw, the comment should say "is not currently supported", > I'll update it in the next iteration. > > An idea mentioned in prior discussions was that it would make sense to > specify syscall return value along with skipping the syscall in seccomp stop, > and this would require a different value for "op" field, but > I decided not to introduce this extra complexity yet. Makes sense, thank you! - Charlie > > > -- > ldv