From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 3952A3858CDA for ; Wed, 26 Apr 2023 07:57:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3952A3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682495830; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=xeMt4+qdQ92q7yhJjkj/bi8WfRDXzOLHJMQ5PRovxIY=; b=Jxy4YcZ6O+SicILl80DHlwCo2HsI70GadvGkJu2vskfo+dMs0kfYMw8twUbBxOuigsjmEf OmVQp3x/rxzkVf87BkzMYLtb8SO3+uryhVokGt+Cxhow/ItVLv2bhwgu1sUt7Bcx6AuGYS SzDvZxS/I0Gd4LWoyh+t8UwAyOuO+Q8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-318-Z5v_OsL1OiSl37hjdOkcug-1; Wed, 26 Apr 2023 03:57:09 -0400 X-MC-Unique: Z5v_OsL1OiSl37hjdOkcug-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 12DFA88B7B5 for ; Wed, 26 Apr 2023 07:57:09 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.194.190]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E4BD1C15BA0 for ; Wed, 26 Apr 2023 07:57:08 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 86021A80B9B; Wed, 26 Apr 2023 09:57:07 +0200 (CEST) Date: Wed, 26 Apr 2023 09:57:07 +0200 From: Corinna Vinschen To: newlib@sourceware.org Subject: Re: [PATCH] Fix _REENT_EMERGENCY() if TLS is enabled Message-ID: Reply-To: newlib@sourceware.org Mail-Followup-To: newlib@sourceware.org References: <20230426062602.121012-1-sebastian.huber@embedded-brains.de> MIME-Version: 1.0 In-Reply-To: <20230426062602.121012-1-sebastian.huber@embedded-brains.de> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Apr 26 08:26, Sebastian Huber wrote: > If the thread-local storage (TLS) support was enabled, the _REENT_EMERGENCY() > object had the wrong size. It must be a buffer of length _REENT_EMERGENCY_SIZE > and not just a single character. > --- > newlib/libc/include/sys/reent.h | 2 +- > newlib/libc/stdio/tmpnam.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h > index 6d8b005b2b..c71f75dbc2 100644 > --- a/newlib/libc/include/sys/reent.h > +++ b/newlib/libc/include/sys/reent.h > @@ -812,7 +812,7 @@ extern _Thread_local int _tls_cvtlen; > #define _REENT_CVTLEN(_ptr) (_tls_cvtlen) > extern _Thread_local void (*_tls_cleanup)(struct _reent *); > #define _REENT_CLEANUP(_ptr) (_tls_cleanup) > -extern _Thread_local char _tls_emergency; > +extern _Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE]; > #define _REENT_EMERGENCY(_ptr) (_tls_emergency) > extern _Thread_local int _tls_errno; > #define _REENT_ERRNO(_ptr) (_tls_errno) > diff --git a/newlib/libc/stdio/tmpnam.c b/newlib/libc/stdio/tmpnam.c > index 51dfd1cea6..dc04cf3f6c 100644 > --- a/newlib/libc/stdio/tmpnam.c > +++ b/newlib/libc/stdio/tmpnam.c > @@ -84,7 +84,7 @@ The global pointer <> is also required. > > #ifdef _REENT_THREAD_LOCAL > _Thread_local int _tls_inc; > -_Thread_local char _tls_emergency; > +_Thread_local char _tls_emergency[_REENT_EMERGENCY_SIZE]; > #endif > > /* Try to open the file specified, if it can't be opened then try > -- > 2.35.3 LGTM Thanks, Corinna