[ovs-dev] [PATCH] acinclude: Always assume buggy strtok_r() for glibc < 2.8.

Ben Pfaff blp at nicira.com
Sat Apr 4 00:20:17 UTC 2015


Thanks, applied to master and branch-2.3.

On Fri, Apr 03, 2015 at 04:15:01PM -0700, Alex Wang wrote:
> Thx for fixing this !!!~
> 
> Acked-by: Alex Wang <alexw at nicira.com>
> 
> On Fri, Apr 3, 2015 at 3:11 PM, Ben Pfaff <blp at nicira.com> wrote:
> 
> > Lately our internal build system has been seeing intermittent failures that
> > I can't explain.  With old glibc versions, the "configure" time check will
> > pass, but the equivalent (almost identical) "make check" test will fail.
> > One possibility, I guess, is that occasionally address space randomization
> > will put valid data at the 0xc0ffee address that the test assumes will
> > segfault, and another is that some change in compiler optimization flags
> > is making a difference.  At any rate, I think it's safe to just always
> > assume that this strtok_r() bug is present whenever glibc before 2.8 is
> > in use.
> >
> > Specifically we've seen this happen intermittently when building against
> > the XenServer DDK 5.6.100 build 39265, which uses glibc 2.5.
> >
> > Reported-by: Alex Wang <alexw at nicira.com>
> > Signed-off-by: Ben Pfaff <blp at nicira.com>
> > ---
> >  acinclude.m4 |   11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/acinclude.m4 b/acinclude.m4
> > index 479da2e..b09f2f2 100644
> > --- a/acinclude.m4
> > +++ b/acinclude.m4
> > @@ -1,6 +1,6 @@
> >  # -*- autoconf -*-
> >
> > -# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
> > +# Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira,
> > Inc.
> >  #
> >  # Licensed under the Apache License, Version 2.0 (the "License");
> >  # you may not use this file except in compliance with the License.
> > @@ -494,7 +494,13 @@ AC_DEFUN([OVS_CHECK_STRTOK_R],
> >          [AC_LANG_PROGRAM([#include <stdio.h>
> >                            #include <string.h>
> >                           ],
> > -                         [[char string[] = ":::";
> > +                         [[#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8
> > +                           /* Assume bug is present, because relatively
> > minor
> > +                              changes in compiler settings (e.g.
> > optimization
> > +                              level) can make it crop up. */
> > +                           return 1;
> > +                           #else
> > +                           char string[] = ":::";
> >                             char *save_ptr = (char *) 0xc0ffee;
> >                             char *token1, *token2;
> >                             token1 = strtok_r(string, ":", &save_ptr);
> > @@ -502,6 +508,7 @@ AC_DEFUN([OVS_CHECK_STRTOK_R],
> >                             freopen ("/dev/null", "w", stdout);
> >                             printf ("%s %s\n", token1, token2);
> >                             return 0;
> > +                           #endif
> >                            ]])],
> >          [ovs_cv_strtok_r_bug=no],
> >          [ovs_cv_strtok_r_bug=yes],
> > --
> > 1.7.10.4
> >
> >



More information about the dev mailing list