[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#36321: marked as done (ix86 direction flag not preserved over strstr() call)



Your message dated Sun, 23 Apr 2000 08:52:45 -0700
with message-id <p04310108b528cc94aef1@[206.163.71.146]>
and subject line Bug#36321: ix86 direction flag not preserved over strstr()  call
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Darren Benham
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 19 Apr 1999 13:33:22 +0000
Received: (qmail 20192 invoked from network); 19 Apr 1999 13:33:22 -0000
Received: from heaton.cl.cam.ac.uk (exim@128.232.32.11)
  by master.debian.org with SMTP; 19 Apr 1999 13:33:22 -0000
Received: from bailey.cl.cam.ac.uk ([128.232.32.152] ident=and1000)
	by heaton.cl.cam.ac.uk with smtp (Exim 2.12 #1)
	id 10ZEAn-0001Ff-00
	for submit@bugs.debian.org; Mon, 19 Apr 1999 14:33:17 +0100
Received: from and1000 by bailey.cl.cam.ac.uk with local (Exim 1.70 #1)
	id 10ZEAj-0003lW-00; Mon, 19 Apr 1999 14:33:13 +0100
From: Austin Donnelly <and1000@cam.ac.uk>
To: submit@bugs.debian.org
Subject: ix86 direction flag not preserved over strstr() call
Message-Id: <E10ZEAj-0003lW-00@bailey.cl.cam.ac.uk>
Sender: Austin Donnelly <Austin.Donnelly@cl.cam.ac.uk>
Date: Mon, 19 Apr 1999 14:33:13 +0100

Package: libc6
Version: 2.1.1

The definition of strstr(3) in ./sysdeps/i386/i486/bits/string.h
includes a fragment of assembly:

__STRING_INLINE char *
__strstr_cg (__const char *__haystack, __const char __needle[],
             size_t __needle_len)
{
  register unsigned long int __d0, __d1, __d2;
  register char *__res;
  __asm__ __volatile__
    ("cld\n" \
     "1:\n\t"
     "movl      %6,%%edi\n\t"
     "movl      %5,%%eax\n\t"
     "movl      %4,%%ecx\n\t"
     "repe; cmpsb\n\t"
     "je        2f\n\t"
     "cmpb      $0,-1(%%esi)\n\t"
     "leal      1(%%eax),%5\n\t"
     "jne       1b\n\t"
     "xorl      %%eax,%%eax\n"
     "2:"
     : "=a" (__res), "=&S" (__d0), "=&D" (__d1), "=&c" (__d2)
     : "g" (__needle_len), "1" (__haystack), "d" (__needle)
     : "cc");
  return __res;
}

Note that it clears the direction flag (cld), but never restores it to
its previous value.  This could be a problem if someone sets the
direction bit in EFLAGS.  This same problem is present in quite a few
other functions in string.h

Austin
---------------------------------------
Received: (at 36321-done) by bugs.debian.org; 23 Apr 2000 15:53:30 +0000
Received: (qmail 2319 invoked from network); 23 Apr 2000 15:53:30 -0000
Received: from cerberus.espy.org (mail@206.163.71.145)
  by master.debian.org with SMTP; 23 Apr 2000 15:53:30 -0000
Received: from hercules.espy.org ([206.163.71.146]) [::ffff:206.163.71.146] 
	by cerberus.espy.org with esmtp (Exim 3.12 #1 (Debian GNU/Linux))
	id 12jOhE-0003EN-00; Sun, 23 Apr 2000 08:53:20 -0700
Mime-Version: 1.0
X-Sender: jk@mail.espy.org
Message-Id: <p04310108b528cc94aef1@[206.163.71.146]>
In-Reply-To: <87n1q7dodh.fsf@zip.com.au>
References: <E10ZEAj-0003lW-00@bailey.cl.cam.ac.uk>
 <87n1q7dodh.fsf@zip.com.au>
Date: Sun, 23 Apr 2000 08:52:45 -0700
To: Kevin Ryde <user42@zip.com.au>, 36321-done@bugs.debian.org
From: Joel Klecker <jk@espy.org>
Subject: Re: Bug#36321: ix86 direction flag not preserved over strstr()
 call
Content-Type: text/plain; charset="us-ascii"

At 07:19 +1000 2000-01-16, Kevin Ryde wrote:
>Austin Donnelly <and1000@cam.ac.uk> writes:
>>
>> Package: libc6
>> Version: 2.1.1
>>
>> The definition of strstr(3) in ./sysdeps/i386/i486/bits/string.h
>> includes a fragment of assembly:
>
>[snip]
>
>> Note that it clears the direction flag (cld), but never restores it to
>> its previous value.  This could be a problem if someone sets the
>> direction bit in EFLAGS.  This same problem is present in quite a few
>> other functions in string.h
>
>The calling conventions say the direction flag should be clear on
>function entry and exit, so glibc is correct.  (See chapter 3 of the
>iBCS2 book.)
>
>If anything, actually, the cld would be unnecessary, but I guess glibc
>doesn't want to rely on it.

In light of this, I am closing this bug.
-- 
Joel Klecker (aka Espy)                    Debian GNU/Linux Developer
<URL:mailto:jk@espy.org>                 <URL:mailto:espy@debian.org>
<URL:http://web.espy.org/>               <URL:http://www.debian.org/>


Reply to: