From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.163.158.5 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796188882; b=EctQwoVgDB5FPrDu5Eb7nTjRZosbLLCo2Mh90d1gSWGvBZXtypoTKOGZXSEbT886996W DS1GyVcJKWQ8E19eT4QG/pemZJYGX7grcrCP+dUAHctc+uHiBDC0SJe1wXMeqdU5ocgAH PMESmxJBX3GrdTVdUMQvTjS/Rr60kh2YUhi+16KFCtIyKnDEbVzxgQ1CgRYEvoyIUGcI1 gorK8yPJusvvkIC5VhwZduNohVNlOQZeiFXKQb4sR8Hf4AkhZdP8PS/VmVWTJ8O3pSEB4 L2D/aEr65zWwjvduFudqD26zVNZIiXY/gWaU5W2SYiPpX/fOFuzDBCdG3FeeUsKn5/Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796188882; h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Received: Received:Received:Received:Received:Content-Type:Mime-Version:Subject: From:In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id: References:To:X-Mailer:X-TM-AS-GCONF:X-Proofpoint-Reinject: X-Proofpoint-Spam-Info:X-Authority-Analysis: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-GUID: X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=S6xSq6von/Uhi0LuwSZ30qrs9zmKyuLMQ2AbKVdlQJE=; b=xixBCT5OTc7VFnMS38AV4820n/8eKD2GqWEhWzrRBYDdDrhm92GXtFRI1x8RnIrRM5Zy I4N20DNjBRf453tEo2snxlBCiO92KhMGepsiZ/+xVB6910AyZMujNewy2ONu7jCBVowtD Ta3j03Jul1u1OlEx83lf9w2H+m4nc4qxKAI6UHE0sLWZ5fOLgV+gbsPVhwR4yFbsKR+n+ ROcq/5lU+hEu0CiRmPUMZtk3qWA0SD5CQ80HOn1sIrntoNEnsA/9q9CIpvZqtrom5Va0C kmaP3Ea42Q0FdwCn6oveDTg0rTz1l6p6t3mNb4PqUifGBxtrdWn5U0lYsoQvAxoYssQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=Rv3rwUCu; arc=none smtp.remote-ip=148.163.158.5 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4A4C606A31A for ; Wed, 2 Dec 2026 05:21:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D4A4C606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256 header.s=pp1 header.b=Rv3rwUCu Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B234vtl3520092; Wed, 2 Dec 2026 05:20:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=S6xSq6 von/Uhi0LuwSZ30qrs9zmKyuLMQ2AbKVdlQJE=; b=Rv3rwUCu03bBkzdVOTuZN9 3S0VUkdglt9yg4ruyE/TghL9rWAr6fXkia4FQRdDMNG0kL4sdlPa/T7dn1kugqZZ KI3lXRzLbb+9uKgSVZpmaxic7KOfLPKSyNFjjGPeycIgMf2cmN1Pw1KP06iS7Xmf VPpdTTyCIA299bErtP6XJxnPkGmcTPSrW4XQHHx7JOkGG8+Lyc7/A7c7wYLqQm69 6OIELhuq8NjPw8CZQcexvBAeA3E/EbQFgA9zdb9qTWvZyfS7J6hIeFKT3AyJW4r/ fUTwAB4P/gJw2CRPtzevpukHsm5uSlUr6jVlM2xNPB/aUy4YEquOFGVXjKiJD9mA == Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7mckgdh9-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 05:20:46 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B234EfC2559003; Wed, 2 Dec 2026 05:20:45 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4j9v5w3n5u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 05:20:45 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B25KfXA47186220 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Dec 2026 05:20:41 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 552DA20049; Wed, 2 Dec 2026 05:20:41 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B6B9C20040; Wed, 2 Dec 2026 05:20:37 +0000 (GMT) Received: from smtpclient.apple (unknown [9.124.211.94]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTPS; Wed, 2 Dec 2026 05:20:37 +0000 (GMT) Content-Type: text/plain; charset=utf-8 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.300.41.1.7\)) Subject: Re: [PATCH v3 0/2] powerpc/syscall: Fix the return value of skipped syscalls From: Athira Rajeev In-Reply-To: <20261030084926.1068384-1-renzo@cs.unibo.it> Date: Wed, 2 Dec 2026 10:50:24 +0530 Cc: Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Ritesh Harjani , =?utf-8?Q?Michal_Such=C3=A1nek?= , Mukesh Kumar Chaurasiya , Shrikanth Hegde , Thomas Gleixner , Oleg Nesterov , "Dmitry V . Levin" , Thomas Bogendoerfer , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <4982526C-FC5B-444D-A472-41F5A5FE39CC@linux.ibm.com> References: <20261030084926.1068384-1-renzo@cs.unibo.it> To: Renzo Davoli X-Mailer: Apple Mail (2.3864.300.41.1.7) X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDAyMCBTYWx0ZWRfX4BlTgf7u64bK eQlW8Ne96lZ6LwXvLvbinzjFljsnfAqgrnCV6pOcwmrk+pn7FtnkO68MmZRqKKVaCxtEW/IY6k7 Bqc6gpkdPmY5J1Sx4UkrNoC0kgSkqtY= X-Authority-Analysis: v=2.4 cv=MtfHeGae c=1 sm=1 tr=0 ts=6b0faaae cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=zJAM_cfXHns3sh6e8yoA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDAyMCBTYWx0ZWRfX2PYNDUT6+Jqw Ax2Tjho7htjK31EXMjO/0Wy9VJ0ldCaDot3F8Rj4MwpHiyJm6UCt/MS8bMMJNuD7gGVa5e8mJqd EIw00MCzSRIDmClC0v4icifWa3qPS1jALFLwH67wHqpifHlgxXAlJa3ky4iH4LFslcSs39jaUWQ R1ATzyJafry4dCi9Jj9p2syeQHZpxxVr0ITKi9CXtRjtXLPNDOkAQBLpG2yEwGnqoUvp/u8lILa +Nwijm6FkoDNC8mKyTXBIIrhkM/kyPsYraLW00hXBBqy+XSeJVnqXSQb0hm+QnJmVoL+F903Nmz lhSiNsAes2Qh2fM9C84aG+TpUkGKNkmCEtnnnUwb+AZmksrxmuRCmc2FwKP392l+6pp7kTsuqgw VXKVPhOZ+2j4q6mMHVyPRFhYrjYA9y4g/Z2tGwPJaaVR258o6MNNskw+HfdXp1EtvJ7qfmTETMz Xzd2MI2V21yDLLiITgw== X-Proofpoint-GUID: qosGF_vJN79LgvRxKNCKRSNHc_v-LmL2 X-Proofpoint-ORIG-GUID: ksyUUbNaEoAple_-bMSBKKG99pFkLp8g X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_01,2026-12-01_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 clxscore=1011 priorityscore=1501 lowpriorityscore=0 suspectscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020020 > On 30 Oct 2026, at 2:19=E2=80=AFPM, Renzo Davoli = wrote: >=20 > When ptrace or seccomp skip a system call on powerpc, the return value > they set is lost or the tracer is affected: >=20 > - syscall_set_return_value() sets TIF_SYSCALL_RET on current, which is > the tracer when called through PTRACE_SET_SYSCALL_INFO, so the next > system call of the tracer is silently skipped (1/2); >=20 > - system_call_exception() returns syscall_get_error() for a skipped > system call, which is 0 for any non-error value, so a success value > set by a tracer or by a SECCOMP_RET_USER_NOTIF listener is replaced > with 0 (2/2). >=20 Hi Renzo, Tested this series on powerpc (ppc64le, Power10). Without these patches, 'perf bench sched seccomp-notify=E2=80=99 hung indefinitely because the notification return value was clobbered to = 0, ausing the child process to exit on the first iteration and the parent = to block forever in SECCOMP_IOCTL_NOTIF_RECV. With this series applied: - "perf bench sched seccomp-notify=E2=80=9D completes successfully. ./perf bench sched seccomp-notify=20 # Running 'sched/seccomp-notify' benchmark: # Executed 1000000 system calls Total time: 8.960 [sec] 8.960045 usecs/op 111606 ops/sec Tested-by: Athira Rajeev Reviewed-by: Athira Rajeev Thanks Athira =20 > Both problems are in v7.3. 1/2 does not apply as is to v7.3, which > still has the two separate TIF_SYSCALL_RET checks from before commit > 66236558dfac ("powerpc/syscall: Avoid atomic = test_and_clear_thread_flag > on fast path"); the code it leaves behind is the same, and 2/2 then > applies on top. >=20 > Tested on QEMU pseries (TCG, -cpu power9), ppc64le guest config, on > mainline 734bef548a96, with ppc_skip_repro.c [1] (a tracer sets the > return value with PTRACE_SET_SYSCALL_INFO and then makes a system = call; > a tracer skips a system call at a PTRACE_EVENT_SECCOMP stop with > PTRACE_POKEUSER, with both "sc" and "scv 0") and with the ptrace and > seccomp selftests: >=20 > mainline + 1/2 + = 2/2 > tracer syscall after SET_SYSCALL_INFO not run correct = correct > skipped syscall, success value, sc/scv returns 0 returns 0 = correct > skipped syscall, error value, sc/scv correct correct = correct > selftests/ptrace set_syscall_info FAIL pass pass > selftests/seccomp/seccomp_bpf (*) 14 FAIL 14 FAIL all = pass >=20 > failing in mainline and with 1/2 only: > = user_notification_{basic,child_pid_ns,sibling_pid_ns,fault_recv,addfd, > addfd_opath,addfd_rlimit,addfd_send_interrupted,sync,fifo, > wait_killable}, TRACE_syscall.seccomp.syscall_faked, > notification_restart.{killable,both}.after_receive >=20 > (*) not counting user_notification_wait_killable_after_reply (100000 > notifications with a 1 ms itimer), which hits the 30 s harness > timeout under emulation on all three kernels. >=20 > Build-tested with W=3D1: ppc64le guest config, ppc64_defconfig (BE), > pmac32_defconfig. >=20 > Changes in v3: > - Split in two patches, one per Fixes: tag: 1/2 removes = TIF_SYSCALL_RET > (suggested by Michal), 2/2 fixes the return value. > - 2/2 returns syscall_get_error() ?: regs->gpr[3] instead of > regs->gpr[3], so the error path is unchanged (suggested by Mukesh). > - Applies unchanged to current mainline (d89e1d186ec9). > - Link to v2: > = https://lore.kernel.org/lkml/20261023180735.853655-1-renzo@cs.unibo.it/ >=20 > Changes in v2: > - Rebased on mainline 734bef548a96, after commit 66236558dfac. > - Link to v1: > = https://lore.kernel.org/lkml/20261018151539.440213-1-renzo@cs.unibo.it/ >=20 > [1] https://lore.kernel.org/lkml/ato6Tq0aKdqqdqyJ@cs.unibo.it/ >=20 > Renzo Davoli (2): > powerpc/syscall: Remove TIF_SYSCALL_RET > powerpc/syscall: Return the preset value of skipped syscalls >=20 > arch/powerpc/include/asm/syscall.h | 6 ------ > arch/powerpc/include/asm/thread_info.h | 1 - > arch/powerpc/kernel/syscall.c | 13 +++++++++---- > 3 files changed, 9 insertions(+), 11 deletions(-) >=20 >=20 > base-commit: d89e1d186ec9271bf78e62771779e9fc03bf0fc3 > --=20 > 2.55.0 >=20 >=20 >=20