From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106047 invoked by alias); 27 Apr 2017 14:56:06 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 105965 invoked by uid 89); 27 Apr 2017 14:56:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy= X-HELO: mail-io0-f173.google.com Received: from mail-io0-f173.google.com (HELO mail-io0-f173.google.com) (209.85.223.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Apr 2017 14:56:03 +0000 Received: by mail-io0-f173.google.com with SMTP id p80so24286895iop.3 for ; Thu, 27 Apr 2017 07:56:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=bJ3n2L4KvE9MQjxbGbFxRTiGx0EhKERuWE3Qw0s0WSE=; b=P1JJ/rJ4S3fsynK1qfN8KUNltEoszM6iHxii1uhprcof5RpPiENglCulDnAUXnj0XH 3g02Dvam9VAyHD6sXMZSChcMb/THKYphr4akeofhb+BRlb5exibr8NLZPlaFVCBcyE8B VXHKYGo8ZH9AN4t8eZ5DUgGidmOmjsy+AK5qYU8xJpQpsVaKf6IFY4yJVET8TXgjEHVW 9lATBx4nUFTvtTW+ticCgNH7KtxO5rFa/W27kfXwY3fP82cDwgmZyggN7xvF+UHkw2Aq lshatGbvHQ7yYpChxc+JIZhFCZ9F3YEwok93QULPqxfJYnEkZGoHjOplSHJpZyJuclEF WaZA== X-Gm-Message-State: AN3rC/5Q4awA5Xl5PNSLrLRy7GjhWDFHaYtzmBMlNsZ9mLG2ZqgezjKs soItEiIy+pgJM1LpnrPm9nA19AQu9UM4 X-Received: by 10.107.173.14 with SMTP id w14mr5239762ioe.232.1493304963943; Thu, 27 Apr 2017 07:56:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.178.76 with HTTP; Thu, 27 Apr 2017 07:56:03 -0700 (PDT) In-Reply-To: References: <20170426082427.GD12712@calimero.vinschen.de> From: Giacomo Tesio Date: Thu, 27 Apr 2017 14:56:00 -0000 Message-ID: Subject: Re: Uninitialized structure in printing functions To: newlib@sourceware.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00321.txt.bz2 Sorry, I've just noticed that -O0 was not enough: I also configured newlib with --disable-newlib-fwrite-in-streamio actually removing the uio structures altogether. Neither -O0 nor --disable-newlib-fwrite-in-streamio were enough alone. They are needed together to make the hello world test pass. Giacomo 2017-04-27 16:10 GMT+02:00 Giacomo Tesio : > Hi, I've just found that with -O0 both my tests and the newlib's > testsuite work as expected, even removing the uio initialization > provided in the patch. > > This is a bit weird. My cross compiler is GCC 4.9.4: is it possible > that newlib is not actually tested with this version? > > > Giacomo > > 2017-04-26 11:35 GMT+02:00 Giacomo Tesio : >> Hi Corinna, >> >> I was trying to fix a simple "hello, world" test: >> https://github.com/JehanneOS/jehanne/blob/c2982db8a2c57a3250c129c28bb395715521ec4e/qa/lib/newlib/hello.c. >> >> During debug one of the issue I've noticed was a fault related to uio >> in vfprintf.c:348: apparently uio->uio_resid was uninitialized and >> actually the patch I provided fixed the test. >> However with a different test I'm working on now, I've found that >> zeroing the structures is not enough. >> Somehow uio->uio_resid overflows there, but I wasn't able yet to >> identify why or where. >> >> Any suggestion is welcome. I supposed I've just hit an untested >> combination of configure options, but actually --enable-newlib-mb is >> the only configure option I'm using (except for prefix and target, >> obviously). >> >> >> >> Giacomo >> >> >> 2017-04-26 10:24 GMT+02:00 Corinna Vinschen : >>> On Apr 21 19:03, Giacomo Tesio wrote: >>>> Hi, during the port to Jehanne, I had issues with the uninitialized >>>> uio structure in several printing functions. >>>> >>>> The attached patch fixes them. >>> >>> I'm puzzled what problem you're solving. >>> >>> I inspected the code in question and the uio structure is always filled >>> with values for all three members before using it. Setting uio to 0 >>> in all these places looks gratuitous. >>> >>> Can you please explain what exactly you're observing and how setting >>> uio to all 0 solved this problem? >>> >>> >>> Corinna >>> >>> -- >>> Corinna Vinschen >>> Cygwin Maintainer >>> Red Hat