Bug 240958

Summary: utrace: PTRACE_SYSCALL cannot modify syscall parameters
Product: [Fedora] Fedora Reporter: Jan Kratochvil <jan.kratochvil>
Component: kernelAssignee: Roland McGrath <roland>
Status: CLOSED INSUFFICIENT_DATA QA Contact: Brian Brock <bbrock>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: triage
Target Milestone: ---   
Target Release: ---   
Hardware: ia64   
OS: Linux   
Whiteboard: bzcl34nup
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-07 01:47:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 237749    
Attachments:
Description Flags
Minimal real code reproducer `fork.c': fork() && wait()
none
Testcase workarounding the CLONE_PTRACE kernel bug. none

Description Jan Kratochvil 2007-05-23 13:53:01 UTC
Description of problem:
strace hangs when -f option is specified

Version-Release number of selected component (if applicable):
FAIL: kernel-2.6.18-8.el5.ia64
FAIL: kernel-2.6.18-20.el5.ia64
FAIL: kernel-utrace-2.6.21-2.6.22.rc2.986.1.3190.fc7.ia64
but
PASS: kernel-upstream-2.6.21-2.6.22.rc2.137.1.3190.fc7.ia64
PASS: kernel-vanilla-2.6.21-1.3190.fc7.ia64.rpm

How reproducible:
Always.

Steps to Reproduce:
1. gcc -o fork fork.c -Wall -ggdb2
2. strace -f ./fork
  
Actual results:
clone2(Process 5514 attached
child_stack=0, stack_size=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCH
LD, child_tidptr=0x2000000000318090) = 5514
[pid  5513] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
[pid  5513] rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
[pid  5513] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
[pid  5513] rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
[pid  5513] rt_sigaction(SIGINT, {0x400000000015c560, [], 0}, {SIG_DFL}, 8) = 0
[pid  5513] wait4(-1, Process 5513 suspended

Expected results:
clone2(Process 4323 attached
child_stack=0, stack_size=0,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x200000000004ecd0) = 4323
[pid  4322] wait4(-1, Process 4322 suspended
 <unfinished ...>
[pid  4323] exit_group(0)               = ?
Process 4322 resumed
Process 4323 detached
<... wait4 resumed> NULL, 0, NULL)      = 4323
--- SIGCHLD (Child exited) @ a000000000010621 (10e3) ---
exit_group(0)                           = ?
Process 4322 detached

Additional info:
Problem is that strace patches the FLAGS parameter of __clone2 () by:
  flags |= CLONE_PTRACE;

but this parameter change gets ignored by the kernel.  The testcase submits
there the CLONE_PTRACE on its own and so works:
  strace -f ./clone

The parameter is found from BSP+CFM by PTRACE_PEEKUSER and retrieved/patched by
PTRACE_PEEKDATA/PTRACE_POKEDATA.

This Bug is ia64 specific and the utrace.ia64 author is listed as:
Anil S Keshavamurthy <anil.s.keshavamurthy>

Comment 1 Jan Kratochvil 2007-05-23 13:53:01 UTC
Created attachment 155237 [details]
Minimal real code reproducer `fork.c': fork() && wait()

Comment 2 Jan Kratochvil 2007-05-23 13:53:57 UTC
Created attachment 155238 [details]
Testcase workarounding the CLONE_PTRACE kernel bug.

Comment 3 Bug Zapper 2008-04-04 00:51:07 UTC
Based on the date this bug was created, it appears to have been reported
against rawhide during the development of a Fedora release that is no
longer maintained. In order to refocus our efforts as a project we are
flagging all of the open bugs for releases which are no longer
maintained. If this bug remains in NEEDINFO thirty (30) days from now,
we will automatically close it.

If you can reproduce this bug in a maintained Fedora version (7, 8, or
rawhide), please change this bug to the respective version and change
the status to ASSIGNED. (If you're unable to change the bug's version
or status, add a comment to the bug and someone will change it for you.)

Thanks for your help, and we apologize again that we haven't handled
these issues to this point.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp

We will be following the process here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping to ensure this
doesn't happen again.

Comment 4 Bug Zapper 2008-05-07 01:47:20 UTC
This bug has been in NEEDINFO for more than 30 days since feedback was
first requested. As a result we are closing it.

If you can reproduce this bug in the future against a maintained Fedora
version please feel free to reopen it against that version.

The process we're following is outlined here:
http://fedoraproject.org/wiki/BugZappers/F9CleanUp