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

Bug#757835: nfs-kernel-server: after update 1.2.8-6->1.2.8-8 rpc.mountd starts crashing



Am 12.08.2014 um 18:05 schrieb Steve Langasek:
> Control: reassign -1 gcc-4.9,nfs-kernel-server
> Control: found -1 nfs-kernel-server/1.2.8-8
> Control: found -1 gcc-4.9/4.9.1
> 
> On Mon, Aug 11, 2014 at 12:54:00PM -0700, Petr Vandrovec wrote:
>> amd64.  I think it affects all architectures.  In case you want to
>> follow-up, attached is minimum testcase I could come up with.  It
>> crashes with gcc-4.9 and -O2.  No crash with gcc-4.8, or at -O1.
> 
>> $gcc-4.9 -W -Wall -O2 client.c && ./a.out
>> Segmentation fault
>> $gcc-4.8 -W -Wall -O2 client.c && ./a.out
>> $gcc-4.9 -W -Wall -O1 client.c && ./a.out
>> $
> 
> Thanks.
> 
> Matthias, could you please have a look at the below test case?  We have a
> regression in the latest nfs-kernel-server build, which appears to be caused
> by a gcc-4.9 bug.
> 
> Should I work around this in nfs-utils, or is a quick fix possible in
> gcc-4.9?
> 
>> char buf[100];
>>
>> void
>> add_name(char *old)
>> {
>> 	char *cp = old;
>>
>> 	while (cp && *cp) {
>> 		cp++;
>> 	}
	if (old)
>> 	__builtin_strncpy(buf, old, cp-old);
>> 	if (cp != old) {
>> 		buf[0] = 'Q';
>> 	}
>> 	if (cp && *cp) {
>> 		buf[0] = 'Q';
>> 	}
>> }
>>
>> int main(void) {
>>     add_name(0);
>>     return 0;
>> }

guard the strncpy. I did see a similar issue like this (can't find it anymore),
and the recommendation was to guard the strncpy.


Reply to: