Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZMkDG-0006cw-J9 for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Aug 2015 21:57:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZMkDF-0004Iz-PD for pgsql-hackers@arkaria.postgresql.org; Tue, 04 Aug 2015 21:57:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZMkBv-0002bJ-Cr for pgsql-hackers@postgresql.org; Tue, 04 Aug 2015 21:56:12 +0000 Received: from nm34-vm7.bullet.mail.ir2.yahoo.com ([212.82.97.121]) by makus.postgresql.org with esmtps (TLS1.0:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZMkBq-0004lq-0y for pgsql-hackers@postgresql.org; Tue, 04 Aug 2015 21:56:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1438725362; bh=uuDX6wo7JWiYN2de7S0ayArNkcoXavED0T19isEJojE=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:From:Subject; b=iI/SrQ/Em3cupr4IsfeOQPJfaYWfvh8tSxyoxWn6OUcOctHAA0ppNdl0kLHAaqNAoTWyuFVwtsQkUtMzFij9R6lSGMN+4lmd92OdJ0L+/V1EhK6iiZ6pGzUYUf3UV73IdUiGXkLFSVewF2CUrGkO2IroZP599wKbFaXJptUDEv4+ixGn29Qdj49tuwSRo6AuwM3DAmGZh7wlBlSsTKWu3nfQS3kt4ssKOin2gERD5Ur6w2pMXQtb7dBiBF/TA4vr45BHqTP7O0VCFEdRfmdlz2H3ZA/FLLN/xHcf5poRtFfBSq+EQ6F8/TuB2sh+CPZiIyn4hsr8Nx/VIiQPinm6Cg== Received: from [212.82.98.54] by nm34.bullet.mail.ir2.yahoo.com with NNFMP; 04 Aug 2015 21:56:02 -0000 Received: from [212.82.98.99] by tm7.bullet.mail.ir2.yahoo.com with NNFMP; 04 Aug 2015 21:56:02 -0000 Received: from [127.0.0.1] by omp1036.mail.ir2.yahoo.com with NNFMP; 04 Aug 2015 21:56:02 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 37089.36454.bm@omp1036.mail.ir2.yahoo.com X-YMail-OSG: nBs6CqMVM1mNxgrIFOUb_pQz9gjEJZKwI.iyHKk021rwO.m8IePZut3zDxhBtt9 pr41cDJ3F4TAHyTTYkInK4gYQnS2hJ479T26uSNhqK.I5mMH.OupCudYpk2gch6ILfY5JI5AFHat ExjqWfL.YUgp95htkblzFYLucS7sFC2C1rQj5zRCGCt7HAizNc7aX5mBNyxldYIwk_oWcZRq7lUQ KI6FbGq3T3.TTxvwvZgUhxE_XFtkuiqKsal8ikHq89h7.vhxrSsLgG6S1Csd_sPUEs3Dje57Pm.s Z8QL.QUJncsGGH8mMC7nCqyu3Hlb3M3R1Q1G1CQQ4C3vFtbo3GbBUpzijLop5izmfOdZ7M6NVxW2 i4fO01z_NlAmNVb8xZvLpULkftUfWzdmNv45nWTCGuy.RQaPEji4aY4PGxhcEit3_wo4SU9eA9nm e17D7dLqiRpN85DPfxkMvfRZkfDtwqb77HWCN8VTeXehGbrmLVhVT4ZR5xennoOX6KUXYqgEaH9R zWGBlmH0L7UjWAkE- Received: by 212.82.98.123; Tue, 04 Aug 2015 21:56:01 +0000 Date: Tue, 4 Aug 2015 21:55:53 +0000 (UTC) From: Ewan Higgs Reply-To: Ewan Higgs To: Peter Geoghegan , Andreas Seltenreich Cc: Pg Hackers Message-ID: <617500033.704417.1438725353464.JavaMail.yahoo@mail.yahoo.com> In-Reply-To: References: Subject: Re: [sqlsmith] Failed assertion in joinrels.c MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_704416_208085335.1438725353455" Content-Length: 12985 X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org ------=_Part_704416_208085335.1438725353455 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi there,I've been following the sqlsmith work and wanted to jump in and tr= y it out. I took Peter's idea and tried building postgres with the flags su= ggested but it was hard to get anything working.=20 I'm on commit 85e5e222b1dd02f135a8c3bf387d0d6d88e669bd (Tue Aug 4 14:55:32 = 2015 -0400) Configure arguments:./configure --prefix=3D$HOME/pkg CC=3Dclang CFLAGS=3D'-= O1 -g -fsanitize=3Daddress -fno-omit-frame-pointer -fno-optimize-sibling-ca= lls' --enable-cassert I had to make a simple leak suppression file: $ cat leak.supp leak:save_ps_display_args leak:__GI___strdup $ export LSAN_OPTIONS=3Dsuppressions=3Dleak.supp And then I could run postgres. After 50,000 queries, I'm left with the foll= owing report: queries: 50514 AST stats (avg): height =3D 7.29877 nodes =3D 37.8156 296=C2=A0=C2=A0=C2=A0 ERROR:=C2=A0 canceling statement due to statement tim= eout 166=C2=A0=C2=A0=C2=A0 ERROR:=C2=A0 invalid regular expression: quantifier o= perand invalid 26 =C2=A0 =C2=A0 ERROR:=C2=A0 could not determine which collation to use fo= r string comparison 23=C2=A0 =C2=A0=C2=A0 ERROR:=C2=A0 cannot compare arrays of different eleme= nt types 12=C2=A0 =C2=A0=C2=A0 ERROR:=C2=A0 invalid regular expression: brackets [] = not balanced 5=C2=A0=C2=A0 =C2=A0=C2=A0 ERROR:=C2=A0 cache lookup failed for index 2619 2=C2=A0=C2=A0 =C2=A0=C2=A0 ERROR:=C2=A0 invalid regular expression: parenth= eses () not balanced error rate: 0.0104921 AddressSanitizer didn't fire except for the suppressed leaks. The suppresse= d leaks were only hit at the beginning: ----------------------------------------------------- Suppressions used: =C2=A0 count=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bytes template =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 = 520 save_ps_display_args =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 10 __GI___strdup ----------------------------------------------------- sqlsmith is a cool little piece of kit and I see a lot of room for on going= work (performance bumps for more queries per second; more db back ends; di= fferent fuzzers).=20 Yours,Ewan Higgs =20 From: Peter Geoghegan To: Andreas Seltenreich =20 Cc: Pg Hackers =20 Sent: Sunday, 2 August 2015, 10:39 Subject: Re: [HACKERS] [sqlsmith] Failed assertion in joinrels.c =20 On Fri, Jul 31, 2015 at 5:56 PM, Andreas Seltenreich w= rote: > sqlsmith triggered the following assertion in master (c188204). Thanks for writing sqlsmith. It seems like a great tool. I wonder, are you just running the tool with assertions enabled when PostgreSQL is built? If so, it might make sense to make various problems more readily detected. As you may know, Clang has a pretty decent option called AddressSanitizer that can detect memory errors as they occur with an overhead that is not excessive. One might use the following configure arguments when building PostgreSQL to use AddressSanitizer: ./configure CC=3Dclang CFLAGS=3D'-O1 -g -fsanitize=3Daddress -fno-omit-frame-pointer -fno-optimize-sibling-calls' --enable-cassert Of course, it remains to be seen if this pays for itself. Apparently the tool has about a 2x overhead [1]. I'm really not sure that you'll find any more bugs this way, but it's certainly possible that you'll find a lot more. Given your success in finding bugs without using AddressSanitizer, introducing it may be premature. [1] http://clang.llvm.org/docs/AddressSanitizer.html#introduction --=20 Peter Geoghegan --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers ------=_Part_704416_208085335.1438725353455 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi there,<= /div>
= I've been following the sqlsmith work and wanted to jump in and try it out.= I took Peter's idea and tried building postgres with the flags suggested b= ut it was hard to get anything working.

I'm on commit 85e5e222b1= dd02f135a8c3bf387d0d6d88e669bd (Tue Aug 4 14:55:32 2015 -0400)
<= div dir=3D"ltr" id=3D"yiv5293678681yui_3_16_0_1_1438677018568_81979">

Configure arguments:
./configure --prefix=3D$HOME/pkg CC=3Dclang CFLA= GS=3D'-O1 -g -fsanitize=3Daddress -fno-omit-frame-pointer -fno-optimize-sib= ling-calls' --enable-cassert

I had to make a simple leak suppression file:
<= div id=3D"yui_3_16_0_1_1438677018568_90246">
$ cat leak.supp
leak:save= _ps_display_args
leak:__GI___strdup
$ export LS= AN_OPTIONS=3Dsuppressions=3Dleak.supp

And then I could run postgres. After 50,000 queries, I'm l= eft with the following report:

queries: 50514
AST stats (avg= ): height =3D 7.29877 nodes =3D 37.8156
296   = ERROR:  canceling statement due to statement timeout
16= 6    ERROR:  invalid regular expression: quantifier ope= rand invalid
26     ERROR:  could not determin= e which collation to use for string comparison
23   = ;  ERROR:  cannot compare arrays of different element types
12     ERROR:  invalid regular expression: bra= ckets [] not balanced
5      ERROR: = cache lookup failed for index 2619
2     = ; ERROR:  invalid regular expression: parentheses () not balanced
error rate: 0.0104921

AddressSanitiz= er didn't fire except for the suppressed leaks. The suppressed leaks were o= nly hit at the beginning:

-----------------------------------------------------
Su= ppressions used:
  count      b= ytes template
      1  &nb= sp;     520 save_ps_display_args
 &n= bsp;    1         10= __GI___strdup
----------------------------------------------= -------


sqlsmi= th is a cool little piece of kit and I see a lot of room for on going work = (performance bumps for more queries per second; more db back ends; differen= t fuzzers).

Your= s,
Ewan Higgs=

=



From: Peter Geoghegan <pg@heroku.com&g= t;
To: A= ndreas Seltenreich <seltenreich@gmx.de>
Cc: Pg Hackers <pgsql-hackers@post= gresql.org>
Sen= t: Sunday, 2 August 2015, 10:39
Subject: Re: [HACKERS] [sqlsmith] Failed= assertion in joinrels.c

On Fri, Jul 31, 2015 at 5:56 PM, Andreas Seltenrei= ch <seltenreich@gmx.d= e> wrote:
> sqlsmith triggered the following as= sertion in master (c188204).

Thanks fo= r writing sqlsmith. It seems like a great tool.

I wonder, are you just running the tool with assertions enabled w= hen
PostgreSQL is built? If so, it might make sense to ma= ke various
problems more readily detected. As you may kno= w, Clang has a pretty
decent option called AddressSanitiz= er that can detect memory errors as
they occur with an ov= erhead that is not excessive. One might use the
following= configure arguments when building PostgreSQL to use
Addr= essSanitizer:

./configure CC=3Dclang C= FLAGS=3D'-O1 -g -fsanitize=3Daddress
-fno-omit-frame-poin= ter -fno-optimize-sibling-calls' --enable-cassert

Of course, it remains to be seen if this pays for itself. Appar= ently
the tool has about a 2x overhead [1]. I'm really no= t sure that you'll
find any more bugs this way, but it's = certainly possible that you'll
find a lot more. Given you= r success in finding bugs without using
AddressSanitizer,= introducing it may be premature.

[1] = http://clang.llvm.org/docs= /AddressSanitizer.html#introduction
--
Peter Geoghegan





--
Se= nt via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://w= ww.postgresql.org/mailpref/pgsql-hackers


------=_Part_704416_208085335.1438725353455--