From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-5.cisco.com (rcdn-iport-5.cisco.com [173.37.86.76]) by sourceware.org (Postfix) with ESMTPS id A2215384841C for ; Fri, 3 Sep 2021 19:26:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A2215384841C IronPort-PHdr: =?us-ascii?q?A9a23=3AO2qRrBbWWVb+Zgw/NG/59Ej/LTAxhN3EVzX9o?= =?us-ascii?q?rI/jLZfd7inuZ/rbwTT5vRo2VnOW4iTq/dJkPHfvK2oX2scqY2Av3YPfN0pN?= =?us-ascii?q?VcFhMwakhZmDJuDDkv2f+btaz0/AMAEX1Y2t32+OFJeTcD5YVCaq3au7DkUT?= =?us-ascii?q?xP4Mwc9Jun8FoPIycqt0OXn8JzIaAIOjz24MttP?= IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A8LAo7K+D0a3lGzzg1eFuk+Fzdb1zdoMgy1?= =?us-ascii?q?knxilNoENuE/BwxvrBoB1E73DJYW4qKQ0dcKO7Sda9qBLnhNBICOwqXYtKMz?= =?us-ascii?q?OWwFdAQLsSiLcKhgeQZhEWldQtlJuIEZIOc+EYZGIS5a2RjWXIcKdD/DDEyt?= =?us-ascii?q?HTuQ609QYLcegeUdAY0+4PMHf8LqQZfngjObMJUL6nouZXrTupfnoaKu6hAG?= =?us-ascii?q?MeYuTFr9rX0Lr7fB8vHXccmUmzpALtzIS/PwmT3x8YXT8K66wl63L5nwvw4b?= =?us-ascii?q?jmm+2nyyXby3TY4/1t6ZjcI5p4dY6xY/ouW3HRYzWTFcNcsnq5zXYISdSUmR?= =?us-ascii?q?MXeR/30k4d1opImivslyqO0GXQMkHboUcTAjnZuASlab+Jm72leNr8YPAx37?= =?us-ascii?q?6xOyGpm3YIrZVy1rlG0HmesIcSBRTcnD7l79yNTB1ykFGoyEBS29L7okYvGb?= =?us-ascii?q?f2UoUh5rD3PXklZKsoDWb/8sQqAeNuBMbT6LJfdk6bdWnQui1qzMa3Vno+Ex?= =?us-ascii?q?+aSgxa0/blnwR+jTR81Q8V1cYflnAP+NY0TIRF/f3NNuBtmKtVRsEbYKphDK?= =?us-ascii?q?MKQNexCGbKXRXQWVjibGjPBeUCITbAupT36LI66KWjf4EJ1oI7nNDbXFZRpQ?= =?us-ascii?q?cJCgvT4A21ret2GzX2MSqAtBjWu7NjDqlCy8rBreDQQF6+oXgV4r6dn8k=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DrCADKdTJh/49dJa1aHgEBCxIMQIF?= =?us-ascii?q?OC4FTUQd3Wjcxhg6CAQOFOZ1bhQOBLoElA1QLAQEBDQEBLRQEAQGEbgKCPQI?= =?us-ascii?q?lNQgOAQIEAQEBEgEBBQEBAQIBBgSBEROFaA2GQwIBAxIuAQE4DwIBCEYyJQI?= =?us-ascii?q?EARIIGoJQgX5XAy8BoA4BgToCih94gTOBAYIIAQEGBASCEYJ5GII0CYE6gn+?= =?us-ascii?q?ED4ZsJxyBSUSBWIJmPoRGg0uCDCKIHzsBgTw8nxafZAqDK4pAlDwUhS6CA59?= =?us-ascii?q?UlhylLwIEAgQFAg4BAQaBYgE5gVlwFYMkCUcZD44gDBaDUIUUgV2DbXQ4AgY?= =?us-ascii?q?LAQEDCZILAQE?= X-IronPort-AV: E=Sophos;i="5.85,266,1624320000"; d="scan'208,217";a="659635413" Received: from rcdn-core-7.cisco.com ([173.37.93.143]) by rcdn-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 03 Sep 2021 19:26:14 +0000 Received: from mail.cisco.com (xbe-aln-007.cisco.com [173.36.7.22]) by rcdn-core-7.cisco.com (8.15.2/8.15.2) with ESMTPS id 183JQEkJ017836 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=OK); Fri, 3 Sep 2021 19:26:14 GMT Received: from xfe-aln-005.cisco.com (173.37.135.125) by xbe-aln-007.cisco.com (173.36.7.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 3 Sep 2021 14:26:14 -0500 Received: from xfe-rcd-004.cisco.com (173.37.227.252) by xfe-aln-005.cisco.com (173.37.135.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 3 Sep 2021 14:26:14 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (72.163.14.9) by xfe-rcd-004.cisco.com (173.37.227.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15 via Frontend Transport; Fri, 3 Sep 2021 14:26:13 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZJpGPCmDLEzKFefqC1TDbaMPWPGCu1KWmGpM3gamOcOvYljpZgF0fAeEIQecv8WGN8cyIninYD6T1/gMVkYSsijpA7b4YVTgARjQJ1twByMtRuHXz/79rXoHE8WmAujpUoAORPmOM+7zRWPzgX9RaKwGTWWEHvtjx6lpY/a0lcCeLut1bp0GUPPW8GpyQjtl+cKE48o74f8oB11TN3uRM3kK7DHGGuW/XbMgmQJI3flAuxrdP0UU5uZ3OC8bN/MV1Xg/aELwQD/vbaXzs1iBkseAK1H68KdPUqoYbwABhzDun/yNfYbGRNl5JztGlKLy6sefthtS2/dGnFsCVd9Lwg== 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-SenderADCheck; bh=T8M73cutzS6NM8CpfmBt+n4lfNfXowNAbgt5TkbvT7k=; b=SnPItkrAFfyeUUstxyLaJWkgpfgUexmiqdiA1ELWbABoLp+YyBRxshYGbOyGiaub7OGO1qjabF69q57Az9WCij8RChtmku3ApsUK27sgT/+Hc9hmJT1PWOegQw+8wuUKNZeNI94vfh92LBJMTk4fbnkDkZ6gjkZtiNfPt+A7AEnUPcssS2JY3ONc11vD7criqStoY0VYYYrTPD+ikcyFzgMv8xroRwQrrBMKY/6wj4j/t+EnfZj2t+ZWiNswdK02By4J2f8O3mYd8/NkKPT3i4fCB63FyVoEtd80vtKGDUE6xCVaBLssEGXxRS3k3chMa2hAEnaxPZvPtaxuJkYJtw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cisco.com; dmarc=pass action=none header.from=cisco.com; dkim=pass header.d=cisco.com; arc=none Received: from BY5PR11MB4418.namprd11.prod.outlook.com (2603:10b6:a03:1cc::15) by BY5PR11MB3973.namprd11.prod.outlook.com (2603:10b6:a03:185::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.24; Fri, 3 Sep 2021 19:26:12 +0000 Received: from BY5PR11MB4418.namprd11.prod.outlook.com ([fe80::409f:b1ee:af4:8b84]) by BY5PR11MB4418.namprd11.prod.outlook.com ([fe80::409f:b1ee:af4:8b84%6]) with mapi id 15.20.4478.020; Fri, 3 Sep 2021 19:26:12 +0000 From: "Ananthakrishna Sowda (asowda)" To: Simon Marchi , "gdb@sourceware.org" Subject: Re: GDB abort on glibc detected file descriptor overflow Thread-Topic: GDB abort on glibc detected file descriptor overflow Thread-Index: AQHXnqJg2d0G1/9CcUy8ZzdO1vcamquP8AEAgALFhf0= Date: Fri, 3 Sep 2021 19:26:12 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f8744e8b-d405-4a48-545f-08d96f10b0cd x-ms-traffictypediagnostic: BY5PR11MB3973: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: OykGvwKS7F3GWHUNRZUd0TvOLVM4f7dmDWXtyP/k9tiblcQsCMik5u6uegkdwRPGnUJcxbkY7sQTfv0SCbTWv5kQd14DUksyL7i5ajNTM5XhU4iycmsARxyTMhCB9SVy7WSdaoxBIEop5+RHOekNE+7zzYaYWwIegHhr0jDQREGnRBuoOZq2Bl+EbJ6AqA+8sdll5DS4G/rouvK1CxMeIpaovgYHqBC0VNgsdZmhqsSLo6E/Ad6ajkZe/X0CltafoZn29IT6i7PYKmyeI76IBogG4fW8Ap1tCqj4faCfU+3EMxDhz87ZtSwQYNQWdpH1daU1ZFUTCrUNaHBTLUWLD/8Kv7/ILqpvJVtAqIOUuggXFmD6VEpnxeBFXN5j3DSaIRKBtZodK21JEFkHkij1QuLaMzMPKw+Bkn+D8+dGu96CKXQLR5S/03HEsxMJFMFylvlxSphYzJXrWVdLl/kbJwUjKtKFVti5sw8+S7w8xAPIfLS6VhdGKZDCEnSW51RBgCv5xU8JV9/sSoL/ppbSJdmssaSM3QXdf3o6/Pp779MCANd+GuIauC7GJjNYvy2JbNVW4Z8DAstr/NO+kY0w4sN8B5CiPhTgoy3BCVLivx2fAyPj2FbgfphO1oH33mmDRcHiSnFIf6p2n7eiDJ+0Qf5WGazWKBFYm+UxTrA1ACSJMzWZ9GzmX5C9uRd2Ihw5kZOsdlF+W+XlVo862ejArQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR11MB4418.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(376002)(396003)(346002)(366004)(136003)(66556008)(66476007)(86362001)(478600001)(66946007)(7696005)(8936002)(76116006)(6506007)(64756008)(66446008)(8676002)(71200400001)(38100700002)(122000001)(110136005)(53546011)(9686003)(316002)(52536014)(55016002)(38070700005)(186003)(83380400001)(33656002)(2906002)(5660300002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?J421nQW+IDRhxkVrx+qxIkkyziHcUd22FNsLrjSZrD8bNgaTSg4qRd12?= =?Windows-1252?Q?ezZe6cueNvB9l9DcM5SdEFwDh7L9nsmG57pagdFSJB5dLg4b9kSBn3qG?= =?Windows-1252?Q?IB/80JWHdv8OureZ8RLbKgUPC/RNl/MI1nrkvuV6hqvfJgmKEGlbKczz?= =?Windows-1252?Q?84ecAOhk3RoPhDNkoruHqq26lBCQ476GfszIVzROdKN6ArU7TyGhOvSh?= =?Windows-1252?Q?RDLrDr9ymRJQHdMNNFpZe4aIxs9Tsi0c61mm9KS1hgKO16AWKu67Thic?= =?Windows-1252?Q?jIJO3eUtNx6cx3kz8XAKWifSJ5ZE4lQUIxOwn+5l9mFsr9MMwKbmP/fp?= =?Windows-1252?Q?IkdvbVPA/y81Leiw+FHjzu+xNC7NIkRa6NEPoYSFXFuaJXTB2ynCDKqy?= =?Windows-1252?Q?zhsGhaxR/UjNUym+Jb2nZUdSUJxcNo3Lh3VMsg4vZqAuELlZoJ0UoRhE?= =?Windows-1252?Q?00WIaxmeCinMgQFWfHVB4WZbzBepBHc4xqM6J4lpc+CUNtUzxUZ1+uVw?= =?Windows-1252?Q?01sllpL+0cA0hlf26RUe0wq66Fj6EUMAto/UMkn3YLl8UxwtiJASVPC2?= =?Windows-1252?Q?vh5jTDzXeO0RGK6eqq693fUyURMGALeV/86Mm1gFmNU/HEIIAHmLh9x8?= =?Windows-1252?Q?cDsMKC7jTKe6LJPNrbKfGrog6aJYCfvQuU8lCpFLSUcR5RG+XnElp35s?= =?Windows-1252?Q?HryJUCi8YPQKK+udacYO2d1lMz6rdKQwFH+08ltq4H9fJkSUTcMxJ/zO?= =?Windows-1252?Q?Mu1U5xn5VK55uib0TjoeuSzoR7uduciRtpsJRLM2i2NfcXSXtFple1eM?= =?Windows-1252?Q?vtWzuExYh8rcJCT2+9NeaL/FkI3MI6yyyDm2Jv7fsEWhURzIH47b+X3K?= =?Windows-1252?Q?vThj7nXO1Q2SyGdDU8kK/7jAD/94bn/hDlfinXe7v5rYRBi+3Gl7yZsD?= =?Windows-1252?Q?fN1DA9smsWibHDuojrV1UZJJcQtQd4Es9V64H70RWuRkO7InNy6Vh8Sn?= =?Windows-1252?Q?XfAyafEPkIuCFsryiPKSSy0MvvuDrb9zTuNPL8+j3jHc/aB3aGo0e1cd?= =?Windows-1252?Q?I0MakMIDi5OxiLAv5pJB1aLHx7Q0N7UeaEcjtpRQvCNyDAW9JEdPc9B3?= =?Windows-1252?Q?W9aq+cz38pFZoJsr4u98WtO/pvH9nvD3YrifTbBypHJ9/Mvjs0q8kkEj?= =?Windows-1252?Q?iX2HJDsCyCbBy1vXmNkMp4Lh3b5WHpmkwp9NOZ/RDHQ207f2e9Geb/YQ?= =?Windows-1252?Q?ScU6x4YrAVkTPe0vszwl93ys039UDmAe+9PEQLOZNMkE0eo1OsBt6akK?= =?Windows-1252?Q?X+4GttWQltmaUeR2K+uyPRIaJm7i/sG94kZC2GQjVEaW8A6Ze1uQ4ygU?= =?Windows-1252?Q?gFyvX/kTdPj/D9pt6Y9fRJ3133KV+cVPdpQhKhnic+E4CGqeI21XNqCM?= =?Windows-1252?Q?+nIEJ3+X7vbT7XeNWE7t2VNnt0WFWoZ3qCKWpGCjEt/JpZ++vcaTJCgl?= =?Windows-1252?Q?UCSov/w+admBCCpTorxBxDVfEXY4uA=3D=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB4418.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f8744e8b-d405-4a48-545f-08d96f10b0cd X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Sep 2021 19:26:12.4503 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5ae1af62-9505-4097-a69a-c1553ef7840e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Jkad78McpNX+KSL/uUnhI27QoseHvXISnyg8OfwgaZuXNWusWk8JSerE7+MYx6vg+EJP73LyNjCPazGdrv605Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB3973 X-OriginatorOrg: cisco.com X-Outbound-SMTP-Client: 173.36.7.22, xbe-aln-007.cisco.com X-Outbound-Node: rcdn-core-7.cisco.com X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, TXREP, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Sep 2021 19:26:17 -0000 I looked in /proc//fd for Gdb process and I see 1535 files open. Most = of them are pointing to libfoo.so and libfoo.so.debug , where libfoo.so is = a library loaded by the process which crashed and generated a core-file. No= rmally, these file descriptors are re-used and maximum number of open file = descriptors stays around 150, even for a process which could load several h= undreds of .so libraries. From: Simon Marchi Date: Wednesday, September 1, 2021 at 6:05 PM To: Ananthakrishna Sowda (asowda) , gdb@sourceware.org Subject: Re: GDB abort on glibc detected file descriptor overflow On 2021-09-01 6:37 p.m., Ananthakrishna Sowda (asowda) via Gdb wrote: > I=92m observing abort in GDB 9.2.1 version, and same issue is present in = git://sourceware.org/git/binutils-gdb.git tip. > > The full call trace is shown at the end of this message. > In frame 7, call to FD_SET is causing buffer overflow when commands from= a GDB macro file are processed. > > (gdb) frame 7 > #7 0x000000000076978b in gdb_readline_no_editing (prompt=3D) at /auto/swtools/prod-builds/src/gdb-9.2.1/gdb/gdb/top.c:850 > 850 FD_SET (fd, &readfds); > (gdb) p fd > $1 =3D 1533 > > GDB is processing split dwarf =93.dwp=94 file for the main executable an= d processing some =93.dwo=94 files in the workspace, which may have somethi= ng to do with it. GDB is opening a bunch of .debug files , one each for ev= ery library and the open file descriptors go past 1024. This results i= n buffer overflow when gdb.macros file is opened and processed in frame 7 (= file descriptor 1533). > > The bfd file descriptor caching code which tries to limit no of open desc= riptors is not effective in this case. > Does this explanation make sense? Any ideas to fix this issue are greatl= y appreciated. It won't fix the problem, but I think we could start by adding an assertion before calling FD_SET (everywhere where we do call it): gdb_assert (fd < FD_SETSIZE); Your build happened to catch it, but other builds could just fail silently or crash in less clear ways. As for the solution, maybe this code should be converted to use poll or other more modern APIs to avoid this limit? It would be interesting if you could show what are the open file descriptors at this point (list /proc//fd), just to see what uses the most fds. Simon