Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Feb 2018 12:10:11 -0500
From:      Pedro Giffuni <pfg@FreeBSD.org>
To:        Justin Hibbits <jrh29@alumni.cwru.edu>, Ed Maste <emaste@freebsd.org>
Cc:        Conrad Meyer <cem@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r329077 - head/usr.bin/tftp
Message-ID:  <e0ded532-bd6b-648a-82c4-7734c56ba73b@FreeBSD.org>
In-Reply-To: <CAHSQbTAfDo6dwPGrNfS9r_f07Z=SCWU9fJJc4PV9S9GEi_PMPg@mail.gmail.com>
References:  <201802091946.w19Jkqb3038864@repo.freebsd.org> <CAPyFy2A5zF5D7vDsnoYweh2DUNsO3i1mMJgCCj7uf4vZp=_qeA@mail.gmail.com> <CAHSQbTAfDo6dwPGrNfS9r_f07Z=SCWU9fJJc4PV9S9GEi_PMPg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------C66CCBE0737B54B1E4A9245D
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit



On 02/10/18 11:13, Justin Hibbits wrote:
> On Fri, Feb 9, 2018 at 7:22 PM, Ed Maste <emaste@freebsd.org> wrote:
>> On 9 February 2018 at 14:46, Conrad Meyer <cem@freebsd.org> wrote:
>>> Author: cem
>>> Date: Fri Feb  9 19:46:51 2018
>>> New Revision: 329077
>>> URL: https://svnweb.freebsd.org/changeset/base/329077
>>>
>>> Log:
>>>    tftp(1): Fix libedit state corruption involving signals
>>  From https://ci.freebsd.org/job/FreeBSD-head-mips-build/391/console:
>>
>> 01:15:24 --- all_subdir_usr.bin/tftp ---
>> 01:15:24 --- main.o ---
>> 01:15:24 cc1: warnings being treated as errors
>> 01:15:24 /usr/src/usr.bin/tftp/main.c: In function 'main':
>> 01:15:24 /usr/src/usr.bin/tftp/main.c:182: warning: 'hist' may be used
>> uninitialized in this function
>> 01:15:24 /usr/src/usr.bin/tftp/main.c:181: warning: 'el' may be used
>> uninitialized in this function
>>
> After initializing these, I see the following interesting error:
>
> /home/chmeee/freebsd/head/usr.bin/tftp/main.c:181: warning: variable
> 'el' might be clobbered by 'longjmp' or 'vfork'
> /home/chmeee/freebsd/head/usr.bin/tftp/main.c:182: warning: variable
> 'hist' might be clobbered by 'longjmp' or 'vfork'
>
> This appears to be a known bug in gcc, at
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24239 so I don't know
> what the best way to fix it is.

Independent of the compiler bug, it does seem like 'el' and 'hist' can 
be used uninitialized for the non-interactive case.

Untested, but perhaps an only-when-needed initialization like this may 
workaround the compiler bug.

Cheers,

Pedro.

--------------C66CCBE0737B54B1E4A9245D
Content-Type: text/x-patch;
 name="tftp-gcc.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="tftp-gcc.diff"

Index: usr.bin/tftp/main.c
===================================================================
--- usr.bin/tftp/main.c	(revision 329104)
+++ usr.bin/tftp/main.c	(working copy)
@@ -197,6 +197,9 @@
 		el_set(el, EL_PROMPT, command_prompt);
 		el_set(el, EL_SIGNAL, 1);
 		el_source(el, NULL);
+	} else {	/* Quell GCC */
+	el = NULL;
+	hist = NULL;
 	}
 
 	if (argc > 1) {

--------------C66CCBE0737B54B1E4A9245D--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e0ded532-bd6b-648a-82c4-7734c56ba73b>