From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 532 invoked by alias); 1 Feb 2013 10:11:39 -0000 Received: (qmail 523 invoked by uid 22791); 1 Feb 2013 10:11:38 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Feb 2013 10:11:34 +0000 Received: by mail.ecoscentric.com (Postfix, from userid 48) id 216504680007; Fri, 1 Feb 2013 10:11:33 +0000 (GMT) From: bugzilla-daemon@bugs.ecos.sourceware.org To: unassigned@bugs.ecos.sourceware.org Subject: [Bug 1001743] New: pthread name not NULL terminated. Date: Fri, 01 Feb 2013 10:11:00 -0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: eCos X-Bugzilla-Component: POSIX X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: ecos@astekk.se X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: low X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc cf_class classification Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.ecos.sourceware.org/ Auto-Submitted: auto-generated MIME-Version: 1.0 Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-bugs-owner@sourceware.org X-SW-Source: 2013/txt/msg00051.txt.bz2 Please do not reply to this email, use the link below. http://bugs.ecos.sourceware.org/show_bug.cgi?id=3D1001743 Bug ID: 1001743 Summary: pthread name not NULL terminated. Product: eCos Version: CVS Hardware: All Architecture/Host All OS: Status: UNCONFIRMED Severity: minor Priority: low Component: POSIX Assignee: unassigned@bugs.ecos.sourceware.org Reporter: ecos@astekk.se CC: ecos-bugs@ecos.sourceware.org Class: Advice Request Classification: Unclassified The nthread->name is not NULL terminated when generating the pthread name o= n a stack that is not initialized to all zeroes. In pthread.cxx:592 ( http://ecos.sourceware.org/cgi-bin/cvsweb.cgi/ecos/packages/compat/posix/cu= rrent/src/pthread.cxx?rev=3D1.16&content-type=3Dtext/x-cvsweb-markup&cvsroo= t=3Decos ): #ifdef CYGVAR_KERNEL_THREADS_NAME=20=20=20=20 // generate a name for this thread char *name =3D nthread->name; static char *name_template =3D "pthread.00000000"; pthread_t id =3D nthread->id; for( int i =3D 0; name_template[i]; i++ ) name[i] =3D name_template[i]; // dump the id, in hex into the name. for( int i =3D 15; i >=3D 8; i-- ) { name[i] =3D "0123456789ABCDEF"[id&0xF]; id >>=3D 4; } #endif In the for-loop copying the template into name, the terminating NULL from template is not copied over, which may leave name unterminated. Example output from a dump: Threads: Idle Thread pri =3D 31 state =3D R id =3D 1 stack base =3D 00007258 ptr =3D 00000000 size =3D 0000= 0800 sleep reason NONE wake reason NONE queue =3D 00000000 wait info =3D 00000000 pthread.00000800 pri =3D 15 state =3D S id =3D 2 stack base =3D 00008a98 ptr =3D 00000000 size =3D 0000= 1ef4 sleep reason WAIT wake reason NONE queue =3D 00002b88 wait info =3D 00000000 ext_events pri =3D 10 state =3D S id =3D 3 stack base =3D 00004a30 ptr =3D 00000000 size =3D 0000= 0960 sleep reason WAIT wake reason NONE queue =3D 0000544c wait info =3D 00005310 pri =3D 15 state =3D R id = =3D 4 stack base =3D 0000ae74 ptr =3D 00000000 size =3D 0000= 1ef4 sleep reason NONE wake reason DONE queue =3D 00000000 wait info =3D 00000000 And, sample output from custom routine listing all threads, without rigorous thread name tests: ID Prio State Stack usage Name 1 31 r 524/2048 Idle Thread 2 15 S 1728/7924 pthread.00000800 3 10 S 316/2400 ext_events 4 15 R 2324/7924 pthread.00000C010=E2=96=92h=E2=96=92 The fix is easy enough, simply rewrite the for-loop into a do while-loop so= the terminating char is copied over as well. --=20 You are receiving this mail because: You are the assignee for the bug. >>From ecos-bugs-return-10018-listarch-ecos-bugs=sources.redhat.com@sourceware.org Fri Feb 01 10:11:47 2013 Return-Path: Delivered-To: listarch-ecos-bugs@sources.redhat.com Received: (qmail 661 invoked by alias); 1 Feb 2013 10:11:45 -0000 Received: (qmail 650 invoked by uid 22791); 1 Feb 2013 10:11:45 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Feb 2013 10:11:35 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id DFCCF4680011 for ; Fri, 1 Feb 2013 10:11:33 +0000 (GMT) Received: from mail.ecoscentric.com ([127.0.0.1]) by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0VMMDAE+jHWI; Fri, 1 Feb 2013 10:11:29 +0000 (GMT) From: bugzilla-daemon@bugs.ecos.sourceware.org To: ecos-bugs@ecos.sourceware.org Subject: [Bug 1001743] New: pthread name not NULL terminated. Date: Fri, 01 Feb 2013 10:11:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: eCos X-Bugzilla-Component: POSIX X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: ecos@astekk.se X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: low X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc cf_class classification Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.ecos.sourceware.org/ Auto-Submitted: auto-generated MIME-Version: 1.0 Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-bugs-owner@sourceware.org Delivered-To: mailing list ecos-bugs@sourceware.org X-SW-Source: 2013/txt/msg00052.txt.bz2 Content-length: 3244 Please do not reply to this email, use the link below. http://bugs.ecos.sourceware.org/show_bug.cgi?id=3D1001743 Bug ID: 1001743 Summary: pthread name not NULL terminated. Product: eCos Version: CVS Hardware: All Architecture/Host All OS: Status: UNCONFIRMED Severity: minor Priority: low Component: POSIX Assignee: unassigned@bugs.ecos.sourceware.org Reporter: ecos@astekk.se CC: ecos-bugs@ecos.sourceware.org Class: Advice Request Classification: Unclassified The nthread->name is not NULL terminated when generating the pthread name o= n a stack that is not initialized to all zeroes. In pthread.cxx:592 ( http://ecos.sourceware.org/cgi-bin/cvsweb.cgi/ecos/packages/compat/posix/cu= rrent/src/pthread.cxx?rev=3D1.16&content-type=3Dtext/x-cvsweb-markup&cvsroo= t=3Decos ): #ifdef CYGVAR_KERNEL_THREADS_NAME=20=20=20=20 // generate a name for this thread char *name =3D nthread->name; static char *name_template =3D "pthread.00000000"; pthread_t id =3D nthread->id; for( int i =3D 0; name_template[i]; i++ ) name[i] =3D name_template[i]; // dump the id, in hex into the name. for( int i =3D 15; i >=3D 8; i-- ) { name[i] =3D "0123456789ABCDEF"[id&0xF]; id >>=3D 4; } #endif In the for-loop copying the template into name, the terminating NULL from template is not copied over, which may leave name unterminated. Example output from a dump: Threads: Idle Thread pri =3D 31 state =3D R id =3D 1 stack base =3D 00007258 ptr =3D 00000000 size =3D 0000= 0800 sleep reason NONE wake reason NONE queue =3D 00000000 wait info =3D 00000000 pthread.00000800 pri =3D 15 state =3D S id =3D 2 stack base =3D 00008a98 ptr =3D 00000000 size =3D 0000= 1ef4 sleep reason WAIT wake reason NONE queue =3D 00002b88 wait info =3D 00000000 ext_events pri =3D 10 state =3D S id =3D 3 stack base =3D 00004a30 ptr =3D 00000000 size =3D 0000= 0960 sleep reason WAIT wake reason NONE queue =3D 0000544c wait info =3D 00005310 pri =3D 15 state =3D R id = =3D 4 stack base =3D 0000ae74 ptr =3D 00000000 size =3D 0000= 1ef4 sleep reason NONE wake reason DONE queue =3D 00000000 wait info =3D 00000000 And, sample output from custom routine listing all threads, without rigorous thread name tests: ID Prio State Stack usage Name 1 31 r 524/2048 Idle Thread 2 15 S 1728/7924 pthread.00000800 3 10 S 316/2400 ext_events 4 15 R 2324/7924 pthread.00000C010=E2=96=92h=E2=96=92 The fix is easy enough, simply rewrite the for-loop into a do while-loop so= the terminating char is copied over as well. --=20 You are receiving this mail because: You are on the CC list for the bug. >>From ecos-bugs-return-10019-listarch-ecos-bugs=sources.redhat.com@sourceware.org Fri Feb 01 10:50:53 2013 Return-Path: Delivered-To: listarch-ecos-bugs@sources.redhat.com Received: (qmail 25696 invoked by alias); 1 Feb 2013 10:50:52 -0000 Received: (qmail 25686 invoked by uid 22791); 1 Feb 2013 10:50:48 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Feb 2013 10:50:43 +0000 Received: from localhost (hagrid.ecoscentric.com [127.0.0.1]) by mail.ecoscentric.com (Postfix) with ESMTP id 243D64680011 for ; Fri, 1 Feb 2013 10:50:40 +0000 (GMT) Received: from mail.ecoscentric.com ([127.0.0.1]) by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qT-+l0A1GVcd; Fri, 1 Feb 2013 10:50:39 +0000 (GMT) From: bugzilla-daemon@bugs.ecos.sourceware.org To: ecos-bugs@ecos.sourceware.org Subject: [Bug 1001743] pthread name not NULL terminated. Date: Fri, 01 Feb 2013 10:50:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: eCos X-Bugzilla-Component: POSIX X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: ecos@astekk.se X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: low X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://bugs.ecos.sourceware.org/ Auto-Submitted: auto-generated MIME-Version: 1.0 Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-bugs-owner@sourceware.org Delivered-To: mailing list ecos-bugs@sourceware.org X-SW-Source: 2013/txt/msg00053.txt.bz2 Content-length: 310 Please do not reply to this email, use the link below. http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001743 --- Comment #1 from Andreas Stenius --- Or, knowing the template is 16 chars, add a name[16] = '\0'; -- You are receiving this mail because: You are on the CC list for the bug.