From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by sourceware.org (Postfix) with ESMTPS id ED434385842B for ; Wed, 27 Apr 2022 18:40:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ED434385842B Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-d39f741ba0so2860795fac.13 for ; Wed, 27 Apr 2022 11:40:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=9atzN4WX+4lNz9/75z5Auum4QzCYggzVFNTzXAj7byQ=; b=HddjohvbgtQfNIQ2ISKekn04QPZI0NtNTvNvi8bd+tjpV5d5XLFNgv1CgNjyNHsvQR 6EHMe3khUGgOmN9Y25V5OnEFAUpBFewnBugpAHX1oVxERFHsTfb3CjQbauMNBdSFgbbu oXVgZ1TaMn4GpZpiPpicoF4BtSkcMW9mb1GETXTpxO+SA6DdP0+Bgfjw8CdbS2Eh7XUL 4lnAWTtZWFALUqojFbNmUgFtys1tx71hgmaHOESA9w1jWlosD/Yxere6QC89GbGv4hCy ghVbKPyFb64EJ0wgy9Z9joWNeNdxMw56YCdUX4mPkwN//K7tFx2icMtT4CCa4N+OgcVd 5Vig== X-Gm-Message-State: AOAM5336hxmUXQGXy+y5yg1g/yDcHS+yunxuR/O8CuHJSV51e+HyVdAn aHXmZsvadIrU3hUuLdWHmwrRJw== X-Google-Smtp-Source: ABdhPJzvI5CFquDSIbpj09FVSYq5LZO7zGiRgV4PhEzYjEu0zrvuAVRbqww1uKYgrTqE+d2u9IdQ+w== X-Received: by 2002:a05:6870:63a6:b0:e9:12fb:6188 with SMTP id t38-20020a05687063a600b000e912fb6188mr9900971oap.205.1651084804215; Wed, 27 Apr 2022 11:40:04 -0700 (PDT) Received: from ?IPV6:2804:431:c7ca:4214:b613:182d:cdde:5f86? ([2804:431:c7ca:4214:b613:182d:cdde:5f86]) by smtp.gmail.com with ESMTPSA id w6-20020a056870e2c600b000e686d13874sm976297oad.14.2022.04.27.11.40.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Apr 2022 11:40:03 -0700 (PDT) Message-ID: <56a48e5d-60e3-fa95-1fef-e2a74bb76752@linaro.org> Date: Wed, 27 Apr 2022 15:40:01 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v2 1/4] libio: Assume _IO_MTSAFE_IO Content-Language: en-US To: Florian Weimer , Adhemerval Zanella via Libc-alpha References: <20220426191523.833171-1-adhemerval.zanella@linaro.org> <20220426191523.833171-2-adhemerval.zanella@linaro.org> <87wnfahfhb.fsf@oldenburg.str.redhat.com> From: Adhemerval Zanella In-Reply-To: <87wnfahfhb.fsf@oldenburg.str.redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2022 18:40:06 -0000 On 27/04/2022 09:34, Florian Weimer wrote: > * Adhemerval Zanella via Libc-alpha: > >> It is already set by default on all supported architectures and it is >> an expectation that stdio works on multi-threaded environments. > > So … this cleanup has got stuck in the past because it's actually more > than just a cleanup. We actually build most of glibc without libio > locking. Looks like misc/ nss/ posix/ have not been covered before. > > Maybe we should just file a bug for the missing locking and fix this > with this commit? It seems a better approach, I will check which files as missing support and open a bug report. > >> index 5af476c48b..c186375c31 100644 >> --- a/sysdeps/nptl/libc-lock.h >> +++ b/sysdeps/nptl/libc-lock.h >> @@ -25,7 +25,7 @@ >> >> >> /* Mutex type. */ >> -#if defined _LIBC || defined _IO_MTSAFE_IO >> +#if defined _LIBC >> # if (!IS_IN (libc) && !IS_IN (libpthread)) || !defined _LIBC >> typedef struct { pthread_mutex_t mutex; } __libc_lock_recursive_t; >> # else > > This doesn't look quite right. Would we want to compile this > unconditionally now? Afaiu using __libc_lock_recursive without _IO_MTSAFE_IO will resulting in using __libc_lock_recursive_opaque__, which will result in a undefined type. Also, I really think we should not tie stdio code with general lock primitives (as _IO_MTSAFE_IO is doing here). > > There's also some weirdness I can't explain. I get strange before/after > symbol differences: > > DIFF eu-readelf -s after strip: nptl/pthread_rwlock_unlock.os > --- /tmp/Left-ltjeu50v.o 2022-04-27 14:29:39.070599437 +0200 > +++ /tmp/Right-jee20kfm.o 2022-04-27 14:29:39.074599395 +0200 > @@ -1,5 +1,5 @@ > > -Symbol table [11] '.symtab' contains 14 entries: > +Symbol table [11] '.symtab' contains 13 entries: > 4 local symbols String table: [12] '.strtab' > Num: Value Size Type Bind Vis Ndx Name > 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UNDEF > @@ -12,7 +12,6 @@ > 7: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 ___pthread_rwlock_unlo> > 8: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UNDEF __GI___libc_fatal > 9: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 __GI___pthread_rwlock_> > - 10: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 __pthread_rwlock_unlock > - 11: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 __pthread_rwlock_unloc> > - 12: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 pthread_rwlock_unlock@> > - 13: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 pthread_rwlock_unlock@> > + 10: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 __pthread_rwlock_unloc> > + 11: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 pthread_rwlock_unlock@> > + 12: 0000000000000000 463 FUNC GLOBAL DEFAULT 1 pthread_rwlock_unlock@> > > Can you reproduce this? I didn't check the symbol generation, I will take a look.