From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by sourceware.org (Postfix) with ESMTPS id 6814B3858D37 for ; Wed, 19 Jan 2022 13:57:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6814B3858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=opensuse.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cristianrodriguez.net Received: by mail-ed1-f42.google.com with SMTP id cx27so12243083edb.1 for ; Wed, 19 Jan 2022 05:57:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dEDmN4u2k2CYG+TWyQJ1qN+o8CgdXATBRPnwzBN/WgM=; b=XMUxury7ZcrIDD/Jd91jjLFpJZSZ8lFVKvpXjnq+ShITZhHvSiTQzY2RfwAIX/J8qy 6I59YoWxov7IUmrOVzyAcI7iiM3/9LDavfvYIRiCWDrhAfROXLvE2B0Zq6uUo4sRw+Hm mYYAfcZTJWykBviWbF2CbTzhDOStmhqRO0pxD9pjoxxsDrMBNwp0cIKVailXN159Zrjh wx03YQc5HaanA6L+fyxrqGqOqhbpEfhLFy99zMhJqTjqoZ8ATJ9PfV6gmlTrS0nKP79j vNuzhrw0eP5ITtsDHRP9SPLckTRW8KMxdwHfRt+w5FcGix3VaJK1HQSBMlTBEDGADApy r+rA== X-Gm-Message-State: AOAM5320RyP0EKQ5L8JFPhTngs57upbPL2OYrd119Ku9RKvEbF+gMz9+ jmQ54B2czsWRotIrYJ3EHLFEeAs7zfWwa1cygByxbQ== X-Google-Smtp-Source: ABdhPJyoNW4HWJlYUVZlN+d3NYtjef/N9aYCsbZaR26yJDheUUW379fr8cUWyjeFJGd/Qp1c/GPvvAfg8mtPFnIyva4= X-Received: by 2002:a7b:cd19:: with SMTP id f25mr3712133wmj.72.1642600673952; Wed, 19 Jan 2022 05:57:53 -0800 (PST) MIME-Version: 1.0 References: <1642405014-3287-1-git-send-email-xuyang2018.jy@fujitsu.com> <61E6298D.80006@fujitsu.com> <61E64FED.2010906@fujitsu.com> <87r195i1lq.fsf@oldenburg.str.redhat.com> <61E7AC82.8080801@fujitsu.com> <61E7BBD6.3010706@fujitsu.com> In-Reply-To: <61E7BBD6.3010706@fujitsu.com> From: =?UTF-8?Q?Cristian_Rodr=C3=ADguez?= Date: Wed, 19 Jan 2022 10:57:42 -0300 Message-ID: Subject: Re: [PATCH] src/ext4_resize.c: set errno to 0 before the strtoull call To: "xuyang2018.jy@fujitsu.com" Cc: "morgan@kernel.org" , Florian Weimer , "Theodore Ts'o" , "libc-alpha@sourceware.org" , "fstests@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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, 19 Jan 2022 13:57:57 -0000 On Wed, Jan 19, 2022 at 4:20 AM xuyang2018.jy--- via Libc-alpha wrote: > > Hi Andrew > > errno doesn't be initialized to 0 when c program link with lcap since > libcap-2.30 (commit f1f62a748d7c Refactor the way we do the psx linkage > in libcap introduced this bug.) > > The c example code as below: > ------------------------------------------- > #include > #include > > int main(int argc, char **argv) > { > printf("errno %d\n", errno); > return 0; > } > --------------------------------------- > > #gcc test.c -lcap -o test > #./test > errno 1 > Yes, that reproduces the problem, quite well. (link with -Wl,--no-as-needed if it does not trigger the bug for you) This is not a glibc problem though, looks like lcap is clobbering errno. I'd bet good CLP on the code called in __attribute__((constructor (300))) static void _initialize_libcap(void) . I strongly suggest not to use constructors on shared libraries unless all the components using the library are in your control and you are sure constructors will not ruin some other application's day.