Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751803AbbKIVMW (ORCPT ); Mon, 9 Nov 2015 16:12:22 -0500 Received: from smtprelay0189.hostedemail.com ([216.40.44.189]:46464 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751664AbbKIVMU (ORCPT ); Mon, 9 Nov 2015 16:12:20 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2692:2693:3138:3139:3140:3141:3142:3355:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:4470:5007:6261:7875:7903:8660:10004:10400:10848:10967:11026:11232:11473:11658:11914:12296:12517:12519:12740:13148:13161:13229:13230:14096:14097:14659:21080:21212:30012:30034:30045:30054:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: star50_4e37a0143f54f X-Filterd-Recvd-Size: 3549 Date: Mon, 9 Nov 2015 16:12:16 -0500 From: Steven Rostedt To: Andy Lutomirski Cc: Andy Lutomirski , Mathieu Desnoyers , Thomas Gleixner , "Anvin, H. Peter" , lttng-dev , LKML Subject: Re: Compat syscall instrumentation and return from execve issue Message-ID: <20151109161216.2af12ffd@gandalf.local.home> In-Reply-To: References: <2095400880.57684.1447011457513.JavaMail.zimbra@efficios.com> <20151109110536.7bce67e8@gandalf.local.home> <5640F406.3020207@kernel.org> <20151109144309.361ab4e5@gandalf.local.home> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2498 Lines: 57 On Mon, 9 Nov 2015 12:57:06 -0800 Andy Lutomirski wrote: > > The solution I suggested wouldn't touch any asm code. The only change > > would be to reserve the TS_EXECVE flag. Actually, come to think of it, > > we could have Mathieu's TS_ORIG_COMPAT flag, and still only have the > > tracepoint syscall set it, such that the matching tracepoint syscall > > exit would know that the initial call was COMPAT or not. > > Someone needs to clear TS_EXECVE, though. Well, it gets set and cleared by the syscall enter (same for TS_ORIG_COMPAT), and exit for that matter. It's trivial to have a tracepoint hook added when either system call enter or exit tracepoints are enabled. Thus, the setting and clearing of the flag can be done by another callback at those tracepoints. > > > > > The goal is only to make sure that the system call exit tracepoint > > matches the system call enter tracepoint. > > > > The system call enter would set or clear the TS_ORIG_COMPAT if the > > TS_COMPAT is set when entering the system call, and it would check that > > flag when exiting the system call. > > This seems a bit odd, though, since we aren't very good about > preserving the syscall nr or the args through syscall processing. In > any event, in the new improved x86 syscall code, we know what arch we > are just by following the control flow, so no flags should be needed. > Hence my suggestion of just adding an "unsigned int arch" to the > return slowpath. I guess I don't understand this "unsigned int arch". When the execve system call is called, it's running in x86_64 mode, and then the execve changes the state to ia32 bit mode. Then on return, the tracepoint system call exit, has the x86_64 system call number, but if it checks to see what state the task is in, it will see ia32 state, and then report the number for ia32 instead. For example, in x86_64, execve is 59, and that number is passed to the system call enter tracepoint. Now on return of the system call, the system call exit tracepoint gets called with 59 as the system call as well, but if that tracepoint checks the state, it will think its returning the "olduname" system call (that's 59 for ia32). What change are you making to solve this? -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/