From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id 2BAC4385843D for ; Thu, 12 Jan 2023 15:05:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2BAC4385843D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30CE2AeU012769; Thu, 12 Jan 2023 15:05:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=references : from : to : cc : subject : in-reply-to : date : message-id : content-type : mime-version; s=corp-2022-7-12; bh=96bstqdUfK5d5QnW+Ngut6HhDEpGfXyXhJvgvfH0dM0=; b=2LynMRbyTZCGqhx7qEoPtl9T+ElZdNyp/TGZBFZTrYAJj1wmj4+X7JaxVZ9w0ip/ALH1 4w0ZILKth/TiEOfSuIdvrNdINRo2bnnXkHiplz4wr/VwILnnkd27F0W5Yxdxm/iuIiVB H6+W06RR+4JtPucPv3r3OWOdeHSxntkKq0xodc+sTbB/4iEPr4Y3v4qLZ7ZZsZBot+N4 lUddiF/Bm3FbhD6nS2bhubyZWNpBfj/1RT2w1JgQkJ011UhxBIcQbb9Exz5WNtEwjQfP POarp5UPAu2mBiY+akO/gWBEVdqMhPeEsihxsE7XcBooNEly6FW0RenuTTQWs82RS0Pg DQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n1y1njn3f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jan 2023 15:05:09 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30CDktvn007580; Thu, 12 Jan 2023 15:05:08 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2105.outbound.protection.outlook.com [104.47.58.105]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n1k4cak65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jan 2023 15:05:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NmKdhMbRWvBlJdhPSCqyp3bx6nytwNBfMXO3IhV2SHm50GZYYZyuKjwb6FYYy4u+CcJyST0M6F98PoINngE6iFf9OcIRVP4ktIptDe2RSuUJi9deM00MxSJdcJRxQWEjIAr8JAstuYgO9C2r1hUDYQZYpne8JcipwLJH5/K8Wd7W5fwDTl4K/UBS/R0dF93cL2EbQK7nCCIyYPvIrwcy+jkkYc2Y5nF+EHl1kSQI8z4oVGPhitL4SE3HDX2zTLhDlrWJRqIIjin+baZ/ziti8lXFw/wi74dftJPsJeBhP5c1Fo90pVvOmGJ/lKWxFNNRQQoZ3kwaUVv74nbnZOnoxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=96bstqdUfK5d5QnW+Ngut6HhDEpGfXyXhJvgvfH0dM0=; b=DdwqG0jqy5yY/QVjXSSOvcQAqzJTuQssuMq6AbcW3hboUVTwKcgBtdPaka0Ic/7iFdWTWWY/p7Vph/oruLEuFdAOIZFSvqY008472oWh4CoZhDmQ8B0QS/2WaRz6qF+Mki4HdXKIyK/kE7uX0ef0olw6BVDLPOxPc2ITzAoVmZ1Y6ChpPc/v42bHVsKSuIL7p/uQVBRuQwxZ4Iw2EShCegVDqIVnEZn9+n45S/Fc1dAgwCga6pRGzkljVtNZrY2NN5LYVfmGPkRo4dTjbdKnZfgY1J7qZ5NEO/IaTQ7AewUSGzL/ixoaTphBsRnwRta0xyYl6PjPPpIzX7pYNHMoIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=96bstqdUfK5d5QnW+Ngut6HhDEpGfXyXhJvgvfH0dM0=; b=KdkZO72pbBYCEkxjsApeHOyZMEdv9Iq/J8ZVubYkVnVDAFjZ37YE1yPycY/JD0dWP1jEHr9M1rKy4+Xf/H2UlIifRcX1czu9XRTE3/5WnN43HRQiCKuVFmtFsAVczlsDpL6bWd3MH98tnpy/ZDGnf/oudSBLiPrYMlbly8lYBUs= Received: from BN6PR1001MB2340.namprd10.prod.outlook.com (2603:10b6:405:30::36) by CY8PR10MB7172.namprd10.prod.outlook.com (2603:10b6:930:71::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Thu, 12 Jan 2023 15:05:01 +0000 Received: from BN6PR1001MB2340.namprd10.prod.outlook.com ([fe80::2b7a:b98b:e12:b750]) by BN6PR1001MB2340.namprd10.prod.outlook.com ([fe80::2b7a:b98b:e12:b750%7]) with mapi id 15.20.6002.012; Thu, 12 Jan 2023 15:05:00 +0000 References: <87ilhj3bsp.fsf@oracle.com> User-agent: mu4e 1.4.15; emacs 28.1 From: Cupertino Miranda To: Cupertino Miranda Cc: Carlos O'Donell , Florian Weimer , "Jose E. Marchesi" , Elena Zannoni , libc-alpha@sourceware.org Subject: Re: [PING] [PATCH v2] Resolve-flockfile-funlockfile-differences In-reply-to: <87ilhj3bsp.fsf@oracle.com> Date: Thu, 12 Jan 2023 15:04:55 +0000 Message-ID: <87a62n23qg.fsf@oracle.com> Content-Type: text/plain X-ClientProxiedBy: LO4P123CA0614.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:314::15) To BN6PR1001MB2340.namprd10.prod.outlook.com (2603:10b6:405:30::36) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN6PR1001MB2340:EE_|CY8PR10MB7172:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b5caf71-856a-4c4d-01b5-08daf4ae6028 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jD4nXAkDpm0aC+hkfZwzTWwadem/785sHG0wvk36t5p1+99G2ktfSI8TFREBT3MPbyLwIJy4xTNW9a+DNs7TTUchv60hGN5zciMvQ5vHUqh1i2dS+wRmFkVEdhkLWH+TDYkuSW2wl++En+szx9Hrf6OPT4qqatdjLPHUpnArRnRuPKKiH+Hq/KDgmRQ3nTYvPEmzQbwFSx9svMhVQVhRmzLwlEwSkE5sW/p8cUi5rJdS1dUvIrYtqE7gSGmXe7GjC8Su/7cX424yT1VGL6eEEwZ5+NlIY3DN/NjqXi0zWzi8tKiSxiimVoi/k1kiWo7Dc6E1kY7+aHKVPnZmuXmmHsJLFF821U8nl805ZYstzteOxdq/QnnYNtycR1mTrymj2J/P44ermd1qpejAXskfXs8TW0Tp7A3vx2jWFMWVaPC+StP6jrozhvhufsBI/ga1no8yZ2/4ybHJbmqVKJ7v2B4G2plB3/KPL4b6sEY1sz48C1/tgAyoV17fgY/B4Ag3zuTNg7PewsXYzkNNKcvcmoDZQ77LfFb0NpBeDz61zZWzlEXeInpE+z2FXACDBjMavow5G5HxUoEuljxEEpS/DXTMbAxI+cwq8AWFAH0wrj8HwHurMcifWanlhE+drItV+gShJBlKPaee8SoBdRY4g61m3nshZJLGcXotPnNAPe4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR1001MB2340.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(346002)(39860400002)(396003)(136003)(376002)(451199015)(54906003)(66556008)(41300700001)(66946007)(4326008)(66476007)(8676002)(316002)(37006003)(966005)(6486002)(478600001)(6862004)(8936002)(6666004)(6512007)(186003)(53546011)(6506007)(2616005)(83380400001)(5660300002)(36756003)(44832011)(38100700002)(6200100001)(86362001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?WNG34vYFaBJVz3TCgpWYpKnrjKf2f8wcMABDJ/YiIXAISaZMZCDVPEPmUT2m?= =?us-ascii?Q?+4/xFx3jAeYrIVlvJucyofPlqNmJGYYvRP6jpNyI5dcEt84a0GOsn9TBSZQg?= =?us-ascii?Q?fv6z5Mx81ZftpEnPoo/W/kZ0giS95zFgJwLBlUa/Z9oRqEj2c4XbC/K6YF3V?= =?us-ascii?Q?ZaBI4TQNl3MZbd01YIieYJcZitYnYtso8y8mpFzrGoF86AFCCKyHZFD+FBot?= =?us-ascii?Q?DSHOlVW3AhV3xMaJd+2AcxkZE3mGz7uJ5eZn2rdKlMgZj9HE77HtoDTddfYT?= =?us-ascii?Q?30qOQ6kP7PncFCnDwKXDnNiMCmUkj5RMqOKzDIRcMTTWZ3g/XTO7lJaL0/Y5?= =?us-ascii?Q?RAcjs0sOkNyeLL8FNW/cZTN+LpZNrHVi6bDTuttQLg0MiqAsIS3Kb/eRE98X?= =?us-ascii?Q?aenoNi3k5r3fL2dyVcJnBZ8iGX6d3S9URLymnq3tnR1K6hzkiVZZhyjIeK74?= =?us-ascii?Q?MudKBZH3RPdKI806ooHFXum7mi2kiGkV6LbRhWvjWF7up8s54WZkpDMDh8Bs?= =?us-ascii?Q?Mwjmow3S85X4LkD4SSHgxVngJdjJN2ChQl75inlDSla7VaSIcRy6ajuRRVvR?= =?us-ascii?Q?7lQxYlUpKA/KRTLHC3S3he9g0CO+Rnj4gth0mYKRF29E4afrWPQs/J3kHEML?= =?us-ascii?Q?jsMDWTkoBIt7rJCRESri6bW0RvbKEh7IOAgVbphBuVdN04HFV5IjWH3tvv1H?= =?us-ascii?Q?ivy4XDjJ2ekNCUt+POZIsYq8iZXBXitDIGTuq38eQIjOi9vX7RoYQHDB2k5P?= =?us-ascii?Q?gKVF6r8sgXWNzD1zNwqwNXn0WkQsrsxWWUx6Ek9ZR/B0jrsYrtGScRuQM4/p?= =?us-ascii?Q?lp7kl0RAd8/z3qv/QrXszu+yge570xVEn/tTHPUJvFTpJlmKrqf+pfuh5rnn?= =?us-ascii?Q?qwLv67Ta9A/oZBKLMGbgSdSgXf+pk+GWK6E5FabJbgCDlXp5+1vEQHcPThoV?= =?us-ascii?Q?xVqzaL4yclfO/N7k/a+CXy9X8c7G+Ip1UF+yZ5vbJj9ZfE4jjbgfhT2otEze?= =?us-ascii?Q?Roge7kZ6PtJqxJV8sJ6PxmQ8+WzgutUdmWzyt/qS+Lh8u3fDtOqMCdPA5Ewc?= =?us-ascii?Q?qNSiHknJeSNuYvIgm74ULJeSI/P0LHYXWzHeWiKKCOr059LFZGXReVnIYv4G?= =?us-ascii?Q?4dUNYWmMa/ILdwWFtf0ImZyTviinHNizTodWJRpJCPd7zQjuRaUV1Qc5g2Qu?= =?us-ascii?Q?oqmiNCiSa5g1VoNic6LGNQGx1Evac/CddexfxmGTMHaceunmEAmwZrak6OeU?= =?us-ascii?Q?ZqhUoWKUEuFmiY8Is98a9Wc4TzxSCw19/ZrEMqiQXwZHK+fxkJU5i3c9y6+5?= =?us-ascii?Q?d/h3SJimBo4Uzk75HVyyjE3TGcYVDrlipKfzr1T02T5oLWe1ovxkePGCw8Ls?= =?us-ascii?Q?ZIctKCb/70R+68jcWoJV0yXgSx0ijPror2M+C4TNt8Shzog7juZiXmm9IxQc?= =?us-ascii?Q?VpPyaUec5RgvXfxC3G5KoT2kNMYGNjVQ84lGdmDZ86VxGY27EoGc4n7ZVvxj?= =?us-ascii?Q?GOWECAcdXoAnutdHokqOUDFx4DlPPqNZT0Hs4t37xqiHjTPoL3aWpuLTm26w?= =?us-ascii?Q?nMV9AvjMCb5Fcy+GBzQdpmtLd6Np/8V47ybt8CcvzlmrqS4ZGYN8xXJU6f6k?= =?us-ascii?Q?AXypcvx96fL8nlfV7XT2yz+rP6sq2Q/jznt8M+kB5GQa?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: podtPdwf8WOl+dwR9VwlFGjgtck0chvQDgaOyYFGBF3qrGJAgTNVuSbtPLxOP2StqFMe06FApdxAwm3VolKHyCzKWmZ34m2iIjuxgYWhQJZpwZ5CcYzQPcP5uxmA5HmHw+r6BTb0x1M+Aw4lVsFipXDfEehFVKxZCvXTG2Shr6pYnhZrCMvkxo+A8q46A89FEnUdAjpbLxs7qTMY8KtVJCeysZyAzc84otPz0gDbXGiQZUBSXW3dFH1SpiJ1B3xAhGw961vWg8LVT/u4kZDczRq/NCPXg3mcUgHN8z53szwofCnOq6WTEWgsi88S5mzgcm9bamjRStAH9jRCBYEOzwycfvUgHj6YyPWgR9MavqpokAFjjGcYyW3/P2OzndfQVRx7InU6F5gNwaH811IEIfyn13KZ3oYieglm5kdZ+cyPY95wsAiiR66DkQ9cbWh+dd1GM30DmQeBTihchJZDBpte/yHR0fo9HMM+qs1ysL+8+eruYTJFGhPBuXu1q2HXGHu0eQD67ZPp9Pc9iIoQjex7P6MDPIuhxAc9sUAhnxRFf/C7c3WJWAHUkx9JyGblleAUo4dvDNgC/0P+Pbw+DcADXN9vofNFnjgmuZHozGWnJQThDEHVEahAcSo0zh9u5tsN8utY42C+GrNQzbf//QmvpE8dmndNhXAUEGvF7LrHJB5drHSZA/YPpSO0Nv8nCj4LfQeo4/VvOI9WpFqN+8YBIA+SfsWCj0vSzrUZDk/n5Y5RNxAFeq5SYyXBvV0mWusymWgLVnCE2NElvi6qm2jg2xFid4VFIkPAUtW/Fsk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b5caf71-856a-4c4d-01b5-08daf4ae6028 X-MS-Exchange-CrossTenant-AuthSource: BN6PR1001MB2340.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2023 15:05:00.3411 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TXB4cpHw97sr8TCwoZVTDpuM+2RVuDmETkRl/LM9kSqS+50MSVdtNIaQ+K7HbnCnYqvkET38HI/KskxlhvaLaFqd+hps1Pgu/PUz/1CEygM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR10MB7172 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-12_08,2023-01-12_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 spamscore=0 bulkscore=0 adultscore=0 suspectscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301120109 X-Proofpoint-GUID: gsSSeGTMMSzhK4tQRFiqgzxi5hNogybT X-Proofpoint-ORIG-GUID: gsSSeGTMMSzhK4tQRFiqgzxi5hNogybT X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP 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: Hi Carlos, Florian, Last patchwork review meeting you mentioned some improvement patches to (I think) __libc_cleanup_region_start/end mechanism. I tried to find the patches in the libc-alpha archives without any success. Only one I found was something from 2018 changing it for mach: https://ecos.sourceware.org/ml/libc-alpha/2018-03/msg00433.html In any case the solution would not address the problem. Can you possibly point me to the patches you refered to? My searching ability is limited to the archives / google. It might be simpler for you to find it. ;-) Regards, Cupertino Cupertino Miranda via Libc-alpha writes: > This is a request for review of the patch sent by Patrick McGehearty based on > an inconsistency in flockfile and funlockfile definitions (macro/function) when > used in glibc code. > At the same time this is a request for comments on the topic based on some > personal concerns on the patch. > > After reading the description of the problem as explained in our bug tracking I > decided to make a more targeted patch, which will also help to better explain > the problem. > > Unfortunately at this stage I cannot functionally verify this patch due to how > long it was identified and fixed at Oracle. > > The patch defines a local wrapper to flockfile and funlockfile such that both > the function pointer passed to libc_cleanup_region_start and the direct call > would point to the same definition. > > I have some concerns about the original presented patch as, IMO, it would allow > any user level application to bypass the lock/unlock by directly writing to > the file pointer flags, changing the original definition of f[unlock|lock]file > as described in the man pages. > > Should both the macro/function definitions be coherent such that they should be > used interchangeably in glibc code? > > Regards, > Cupertino > > --- MORE TARGETED PATCH --- > > diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c > index 2ad34050f3..5b55db962b 100644 > --- a/stdio-common/vfscanf-internal.c > +++ b/stdio-common/vfscanf-internal.c > @@ -177,11 +177,15 @@ > return EOF; \ > } \ > } while (0) > + > +static inline void checked_IO_funlockfile(FILE *s); > +static inline void checked_IO_flockfile(FILE *s); > + > #define LOCK_STREAM(S) \ > - __libc_cleanup_region_start (1, (void (*) (void *)) &_IO_funlockfile, (S)); \ > - _IO_flockfile (S) > + __libc_cleanup_region_start (1, (void (*) (void *)) &checked_IO_funlockfile, (S)); \ > + checked_IO_flockfile (S) > #define UNLOCK_STREAM(S) \ > - _IO_funlockfile (S); \ > + checked_IO_funlockfile (S); \ > __libc_cleanup_region_end (0) > > struct ptrs_to_free > @@ -197,6 +201,18 @@ struct char_buffer { > struct scratch_buffer scratch; > }; > > +static inline void > +checked_IO_funlockfile(FILE *s) > +{ > + _IO_funlockfile (s); > +} > + > +static inline void > +checked_IO_flockfile(FILE *s) > +{ > + _IO_flockfile (s); > +} > + > /* Returns a pointer to the first CHAR_T object in the buffer. Only > valid if char_buffer_add (BUFFER, CH) has been called and > char_buffer_error (BUFFER) is false. */ > >> From a0291671db0d92a8762de3a45fd322e471a19a24 Mon Sep 17 00:00:00 2001 >> From: Patrick McGehearty >> Date: Wed, 23 Nov 2022 21:02:02 +0000 >> Subject: [PATCH v2] Resolve flockfile/funlockfile differences >> >> - - - - - - >> Only difference from v1 is to correct indenting/tabs >> for the changes to match other .c files in stdio-common. >> - - - - - - >> This patch resolves differences between flockfile/funlockfile and >> LOCK_STREAM/UNLOCKSTREAM to avoid failure to unlock a stream mutex in >> a multi-threaded application context which allows entering using >> LOCK_STREAM but leaving using funlockfile or vice-versa. >> This issue was detected during stress tests of a large proprietary >> application. The cause and solution was identified by Gerd Rausch. >> >> The issue occurs because _IO_funlockfile has different definitions in >> different contexts: >> >> Comparing the inline version in libio/libio.h >> # define _IO_flockfile(_fp) \ >> if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_flockfile (_fp) >> >> And the non-inline version in stdio-common/flockfile.c >> __flockfile (FILE *stream) >> { >> _IO_lock_lock (*stream->_lock); >> } >> >> Note the lack of the _IO_USER_LOCK in the __flockfile version. This >> difference means it is possible to bypass the lock in some cases and >> not release the lock in other cases. Either way, it causes trouble. >> >> The proposed fix is to simple add the _IO_USER_LOCK guard to the >> non-line versions of flockfile and funlockfile. >> >> Modified files: >> stdio-common/flockfile.c >> stdio-common/funlockfile.c >> --- >> stdio-common/flockfile.c | 3 ++- >> stdio-common/funlockfile.c | 3 ++- >> 2 files changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/stdio-common/flockfile.c b/stdio-common/flockfile.c >> index 49f72c6..7c82847 100644 >> --- a/stdio-common/flockfile.c >> +++ b/stdio-common/flockfile.c >> @@ -22,7 +22,8 @@ >> void >> __flockfile (FILE *stream) >> { >> - _IO_lock_lock (*stream->_lock); >> + if ((stream->_flags & _IO_USER_LOCK) == 0) >> + _IO_lock_lock (*stream->_lock); >> } >> weak_alias (__flockfile, flockfile); >> weak_alias (__flockfile, _IO_flockfile) >> diff --git a/stdio-common/funlockfile.c b/stdio-common/funlockfile.c >> index bf44c99..b77b1b2 100644 >> --- a/stdio-common/funlockfile.c >> +++ b/stdio-common/funlockfile.c >> @@ -23,7 +23,8 @@ >> void >> __funlockfile (FILE *stream) >> { >> - _IO_lock_unlock (*stream->_lock); >> + if ((stream->_flags & _IO_USER_LOCK) == 0) >> + _IO_lock_unlock (*stream->_lock); >> } >> weak_alias (__funlockfile, _IO_funlockfile) >> weak_alias (__funlockfile, funlockfile); >> -- >> 1.8.3.1