From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id AA51938515F1 for ; Tue, 20 Apr 2021 22:51:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AA51938515F1 Received: by mail-pf1-x433.google.com with SMTP id i190so26762455pfc.12 for ; Tue, 20 Apr 2021 15:51:53 -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:references:in-reply-to:from:date :message-id:subject:to:cc; bh=P2Je6YMWSDJbdzn72Mt1EfrrYxTpF3FWFA6Pj6BzBhM=; b=d5dF9I5MJTzYcaL+2FHN7zsiqd+Il9HYPIXDkvZdTBDlscae32yZ+MFUWVj+bZ0qW1 OuGPO9VsAhSVC/YgimZcbPDTc3Qc+3hdvGZRaPAnGw6f/d5jZFBecSDLfmI1bY62fZMP t7tw0gZ0WnB40dIN92nG3IppzWCu5df22C/jT1kDxw5ZabOm0Gv3atO/y9xDUWYWGG6a oDZKo8suoE6TKWdOJxhwvncYXxZWIDqjyP0KoV8yNBJdnwwyv1wWAZVmkOKXWMkn2hBQ bFJV5au5xWlpCbQrTLrIppAVtyHuh05n4AuN0wY5dY2+rtDdDXNhQk48YnwzEaVIwy0J CdvA== X-Gm-Message-State: AOAM530N1+lRuIXOWHI9rsMkn43rFDZSJwrF5HKukiFS3R5ZwEMZCKpc 75TmuSmZnWojrq0J9qLRJ45PDh9FbiXH9KpuEh9pOA== X-Google-Smtp-Source: ABdhPJxyhZbBSwQlPgD8vpOxUBoOiSAHQitlFK0Sdkfp8i+Lz4jRT1CcSor+gijYDtd6JaDGdlmBkYdBMm5kvXKtabU= X-Received: by 2002:a17:90a:a895:: with SMTP id h21mr7575749pjq.13.1618959112668; Tue, 20 Apr 2021 15:51:52 -0700 (PDT) MIME-Version: 1.0 References: <20210417172258.2788076-1-vitalybuka@google.com> In-Reply-To: From: Vitaly Buka Date: Tue, 20 Apr 2021 15:51:15 -0700 Message-ID: Subject: Re: [PATCH] stdlib: Fix data race in __run_exit_handlers To: Paul Pluzhnikov Cc: GLIBC Devel X-Spam-Status: No, score=-26.0 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Tue, 20 Apr 2021 22:51:55 -0000 I guess I forgot to reply to these comments. On Sat, 17 Apr 2021 at 11:02, Paul Pluzhnikov wrote: > On Sat, Apr 17, 2021 at 10:23 AM Vitaly Buka via Libc-alpha > wrote: > > > diff --git a/stdlib/test-cxa_atexit-race2.c > b/stdlib/test-cxa_atexit-race2.c > > > + This test spawns multiple threads, and check the same desctructor is > > Typo. Suggest: > > This test spawns multiple threads, and checks that the same destructor is > Done in the last patch. > > > + not called more then once. */ > > s/then/than/ > Done in the last patch. > > > +static void *cb_arg = NULL; > > +static void > > +add_handlers (void) > > +{ > > + int n = 10; > > + for (int i = 0; i < n; ++i) > > + __cxa_atexit (&atexit_cb, ++cb_arg, 0); > > add_handlers() is called from many threads. This code appears to race on > cb_arg. > We don't have a data race as add_handlers is called from a single background thread. Previous patches had more threads but they didn't help to reproduce the issues. > > > -- > Paul Pluzhnikov >