Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934192AbXHKDPp (ORCPT ); Fri, 10 Aug 2007 23:15:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1762168AbXHKDPh (ORCPT ); Fri, 10 Aug 2007 23:15:37 -0400 Received: from tomts22.bellnexxia.net ([209.226.175.184]:46424 "EHLO tomts22-srv.bellnexxia.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760742AbXHKDPg (ORCPT ); Fri, 10 Aug 2007 23:15:36 -0400 Date: Fri, 10 Aug 2007 23:15:34 -0400 From: Mathieu Desnoyers To: Christoph Hellwig , linux-kernel@vger.kernel.org Subject: [RFC] Adding a TIF_KERNEL_TRACE to thread_info.h, s390 and ia64 8 bit limit Message-ID: <20070811031533.GB15885@Krystal> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Editor: vi X-Info: http://krystal.dyndns.org:8080 X-Operating-System: Linux/2.6.21.3-grsec (i686) X-Uptime: 22:58:04 up 12 days, 3:16, 2 users, load average: 0.74, 0.74, 0.69 User-Agent: Mutt/1.5.13 (2006-08-11) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hi, I would like to add a TIF_KERNEL_TRACE that would have the same effect as TIF_SYSCALL_TRACE, which is to call into do_syscall_trace when enabled. It would be enabled by setting it in each thread info structure (and protected against racy thread creation with proper flag copy from the parent thread upon thread creation). The particularity of TIF_KERNEL_TRACE is that it would be enabled dynamically system-wide when kernel tracing is active. The current similar flags that exist are TIF_SYSCALL_TRACE (for ptrace) and TIF_SYSCALL_AUDIT (set by audit_alloc() at process creation if auditing is enabled). However, touching these flags system-wide would conflict with either syscall audit or ptrace, therefore the introduction of a new thread flag looks like a plausible solution. However, since the instructions used to test these flags are limited to 8 bits on some architectures, we run out of free flags at least on s390 and ia64. I would appreciate some comments about the idea in general, and how bitfield limitation should be overcomed for s390 and ia64. Some details about the problematic patches below. Thanks, Mathieu Desnoyers On s390: /home/compudj/git/linux-2.6-lttng/arch/s390/kernel/entry.S: Assembler messages: /home/compudj/git/linux-2.6-lttng/arch/s390/kernel/entry.S:252: Error: operand out of range (289 is not between 0 and 255) /home/compudj/git/linux-2.6-lttng/arch/s390/kernel/entry.S:362: Error: operand out of range (289 is not between 0 and 255) make[2]: *** [arch/s390/kernel/entry.o] Error 1 when adding: --- include/asm-s390/thread_info.h | 2 ++ 1 file changed, 2 insertions(+) Index: linux-2.6-lttng/include/asm-s390/thread_info.h =================================================================== --- linux-2.6-lttng.orig/include/asm-s390/thread_info.h 2007-07-30 18:53:20.000000000 -0400 +++ linux-2.6-lttng/include/asm-s390/thread_info.h 2007-07-30 18:53:24.000000000 -0400 @@ -96,6 +96,7 @@ static inline struct thread_info *curren #define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */ #define TIF_SINGLE_STEP 6 /* deliver sigtrap on return to user */ #define TIF_MCCK_PENDING 7 /* machine check handling is pending */ +#define TIF_KERNEL_TRACE 8 /* kernel trace active */ #define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ #define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ @@ -110,6 +111,7 @@ static inline struct thread_info *curren #define _TIF_SYSCALL_AUDIT (1<