From owner-freebsd-current@FreeBSD.ORG Wed Apr 25 19:40:37 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0C407106566C; Wed, 25 Apr 2012 19:40:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id BC23A8FC14; Wed, 25 Apr 2012 19:40:36 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:91a4:9332:24dd:72e6] (unknown [IPv6:2001:7b8:3a7:0:91a4:9332:24dd:72e6]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 0D2875C59; Wed, 25 Apr 2012 21:40:36 +0200 (CEST) Message-ID: <4F985334.8030109@FreeBSD.org> Date: Wed, 25 Apr 2012 21:40:36 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120410 Thunderbird/12.0 MIME-Version: 1.0 To: Boris Samorodov References: <4F9703C9.8080503@FreeBSD.org> <4F98492D.8070006@FreeBSD.org> <4F984CC2.5080404@passap.ru> In-Reply-To: <4F984CC2.5080404@passap.ru> X-Enigmail-Version: 1.4.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org, =?UTF-8?B?SmVhbi1Tw6liYXN0aWVuIFDDqWRyb24=?= Subject: Re: segfault in vfscanf(3): clang and __restrict usage X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2012 19:40:37 -0000 On 2012-04-25 21:13, Boris Samorodov wrote: > 25.04.2012 22:57, Dimitry Andric =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >> On 2012-04-24 21:49, Jean-S=C3=A9bastien P=C3=A9dron wrote: >>> Hi everyone, >>> >>> vfscanf(3) in HEAD (r234606) segfaults when compiled with clang. For >>> instance, here is a call made in cmake which crashes: >>> fscanf(f, "%*[^\n]\n"); >> >> Using r234549 here, everything compiled with clang, but I cannot make >> that statement crash, whatever I do. Do you have a specific input fil= e >> which crashes it? >=20 > ----- > % uname -a > FreeBSD bsam.wart.ru 10.0-CURRENT FreeBSD 10.0-CURRENT #0 r234635: Tue > Apr 24 11:41:32 SAMT 2012 bsam@bsam.wart.ru:/usr/obj/usr/src/sys/BB= X > i386 > % sudo gdb smartd smartd.core > GNU gdb 6.1.1 [FreeBSD] > [...] > #0 0x33ebdc2e in vfscanf () from /lib/libc.so.7 > (gdb) > ----- >=20 > I think that cupsd also suffer from the bug. >=20 > BTW, I have the system and almost all ports compiled (tomorrow > and today) with clang. Looks like the __restricted keywords were introduced just two days ago, in r234585, which may be why I didn't see any crashes yet. I think the easiest solution for now is to #undef __restrict at the top of both lib/libc/stdio/vfscanf.c and lib/libc/stdio/vfwscanf.c, then recompile and reinstall libc.