From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 92842 invoked by alias); 27 Apr 2017 14:10:41 -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 92759 invoked by uid 89); 27 Apr 2017 14:10:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=D*it, hello.c, UD:hello.c, H*i:ncnY3rOPbirP X-HELO: mail-it0-f42.google.com Received: from mail-it0-f42.google.com (HELO mail-it0-f42.google.com) (209.85.214.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Apr 2017 14:10:37 +0000 Received: by mail-it0-f42.google.com with SMTP id 70so12290721ita.0 for ; Thu, 27 Apr 2017 07:10:39 -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=EnD4H5+SNi/HznymMgjUoOIetpdEvFsajYyRjHmyX6A=; b=qUHnAcpDTDRepsMoPHo6lB/Wn+GB5vJd+WwntzwFhFyw9p9/lVfh9ymm4bS1zp5ylF 4uZNve8TuNr80blypxe5fWYrRUmP9e4tA/kiTNHQWNhXWPKN4DdKwlwbtNLmd49oCfHH rTMIE0bsaO6d2r+1IZzqhOn4U4fK/jgJltokY4YqUUKkcaoJ+4zHMfZSGsFcYAh75FaD GaJIf1Y21keHCWJnEJURRM6T8JcevvAIWF6exYooxG0KbkrDJ/7Dqvmrk8osQ6cDNpeJ z2/3uC0lni/miaamM8cN5dE4nD35VoudlbJWSkf7M6sFdz1mBVLVs+/bb35sHKblkEvC B7hw== X-Gm-Message-State: AN3rC/4HMnmlh6ZxQasHBdOtnnanm7xPyavOOUaVvIEGAB2DFCxIyhQT oXBUWg1trm4tOIopUI0vRoUh280h2nC/ X-Received: by 10.36.212.7 with SMTP id x7mr3449016itg.20.1493302237623; Thu, 27 Apr 2017 07:10:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.178.76 with HTTP; Thu, 27 Apr 2017 07:10:36 -0700 (PDT) In-Reply-To: References: <20170426082427.GD12712@calimero.vinschen.de> From: Giacomo Tesio Date: Thu, 27 Apr 2017 14:10: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/msg00320.txt.bz2 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