From patchwork Wed Nov 30 11:44:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 85007 Delivered-To: patch@linaro.org Received: by 10.182.112.6 with SMTP id im6csp240297obb; Wed, 30 Nov 2016 03:44:58 -0800 (PST) X-Received: by 10.98.68.140 with SMTP id m12mr33234310pfi.19.1480506298743; Wed, 30 Nov 2016 03:44:58 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id h75si64081817pfk.290.2016.11.30.03.44.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Nov 2016 03:44:58 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-75339-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-75339-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-75339-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:content-type; q=dns; s=default; b=vtdJRiDK9spUDWT3m9EEB lCHvjQO9CEhuAW/fdGn5Dap+xbZ0WiwuJNdcw+N8iwjAA4OUOCiePBDISb//OGMK aWzI4COSIicdyUK/o7HdLfFfKCfhXpGpKkMBQNfR+xZnzDk5m9FZBaLB0SeXSb8L XtbOOU1lQ8loKmkSYpSKL4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:content-type; s=default; bh=wwJUkhPbR4mdOQIYyCjQPLg6ClA =; b=kJtxYpqy0nuN7vRXPPaHlX5LcsqJiV+iJHtPZEYaAZ3fqx2ztOUbiUUaQbn kGwO67bOzm0P+/t3yrMvVKMqgRJ7z2TgEWbwWaXkTRmne0PnoHw1qDFkOkiYIZr+ 8THC8lVvZu50AyVmCDlxGLdv3e+FzcZhWY+20kMyQdddTZFc= Received: (qmail 40400 invoked by alias); 30 Nov 2016 11:44:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 40381 invoked by uid 89); 30 Nov 2016 11:44:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Exchange-Antispam-Report-Test:180628864354917, 20161130 X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs.Nagy@arm.com; Message-ID: <583EBB99.8040101@arm.com> Date: Wed, 30 Nov 2016 11:44:25 +0000 From: Szabolcs Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: GNU C Library CC: , Torvald Riegel Subject: [RFC PATCH 1/2][BZ 19329] remove broken code path for easier code review X-ClientProxiedBy: DB6PR0202CA0036.eurprd02.prod.outlook.com (10.171.70.22) To HE1PR0802MB2155.eurprd08.prod.outlook.com (10.172.126.15) X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2155; 2:F1WHplJBbyrmbeO8pnJ/AOdp9178/styS0sSjfYv45E1wEjWH8XZ5RJ6MvUz+qq8Ss8hLZCg+CBnMo8kXahepDbmvxoE42gpG8LcbnsbLz74qBkAO0CKWHnjwNd2Gby9Ta9gHyDTa0ScmGJiLNlhDQi7OL9jL/qhphOyhFiht9w=; 3:5I0rkKzBx7V8HJbqkkDd8Y5kPIEmbLoomaTLaN1bqvt99dRoYbSl014GW9vn0ubuzLGZClcZpENxhlae98qpyUZM/PXkVQ6qxcnR++REUUaB8sGmezRxcF1qoU7KT3LtDzuCFb8vNboEJrcHFXPNvwvEpN0dXmocN/pwxFSPs/s= X-MS-Office365-Filtering-Correlation-Id: 090dbecc-3ec4-4d1e-e098-08d419163ef1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:HE1PR0802MB2155; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2155; 25:CWFMQMktdkZXAXlfpHoNo5uN7JucDJIXP4UDs8zH29OdEjM1QGRse5Z+Fkwu4cVOv0BCL1bGJVj2hizP6uy2Y/R7h92tmK5ZCs7DfpCLZMd1ahUbUiQAbbUHBZCssVbktV1tv08DwNc58dYoW6XENF7LLS4tcZW4+ZLAg603W5RdYQJe0aLUUVNaGOi/C2Z+nhQnSeBY4WU/pJOpS/6TiSbn3kWsH9tt9tNNQgJEhjKZDZvKOC1b5sthy1ZeeLcvjYSFBHK3CDRG7Do5IvW/79stgkoKjl5sJ+Mf7fA0yPrxUiCW2ubQNkevz+JNWAtynwCfgr91o1lTLA49C2Y36EXnkQvVMky99+a6oeBqnOIy2Wbs74oSG27/ZgyZ7G9CvuxXViolYw/Fd6da8LQYVdUPcWlnLZWM3eRasjQX+eeGmzx9GGqIsAQTCjP152RK0SXq3qwsYxa9OZaZNeUP2t6U7Bk5NXk2768U10AVoIHEkphtjjUjP9pud9B6QjjVSiUJfXSyUA6XWWZgPoSyDQBKQL5gYs9ZO29NbfCnu3YVf9YaOKyzMOSbWTNKugBuPorB+C8xWOW+b20uAvhdKJnEdT0Cyz8fmixR7cUXu1Xx0EBlylBZVgxf7k8a+VouJvD7dFlsXB2u8fYiP2sPQW61ed7+eHeS0PKgALY7HzvFNMclSk+ApcXO/rxhB9mFPzyME7ceuC9RlOVqOU/DpRiMOgtPA+qz32E+G8v3ULSevCnKsRKddrP6xY6xxZe9NLTgGoPgRZQCGbopiync4UCpkXOjoYb/+UwMbNR/+VR+ffVegq8xn5IvLgyJKdQWTRIMIjC3Gs9PBKS7x/WnhdWZ9dUz5vWRlYtRAzkTIl0= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2155; 31:NbRv15LmXXAa4deOwSBlFt4Fall/nwun1C511Og1ZjFGoqSFzGmR6ujrqK1qKFhFoxio2fUcylixbR95Tpg8bK/e1Ssth+UVo81XMQPJRuYmAJMhZTSsoCRG8T5u1WSt9B6psHpSwxmz0IAK0YNj9ESFPodCyrZbkLdk02V++rOgjwHSD0/0JgzouipDvALmzNOyoYMqKIqrbCf0XxTe4tJFsJQooGsz7tDlABfueJXT4arW+Gn5ogj3gFjcZ2VUMHINe5ANu5smp5FtMqFlZQ==; 20:/SOtdpo8mv+xhR+4w7ztMVwT0jvhu0bhhTqASGu+UsT1ftktpRZ8+8XmacjDJYdTm7VTrAgHxJmQ05u5E4FYXncQGF4OP34zmH6n7UZlD8nUZYSSfAOye+6aqnZmS17LW5dRKTaNF6th6YMqxXUYqDQqsInZvO9Xv/iJyED7lYc= NoDisclaimer: True X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415395)(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123560025)(20161123564025)(20161123555025); SRVR:HE1PR0802MB2155; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0802MB2155; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2155; 4:MSELYjyif3musEgEffUSiZX2+KrJH2AnuzKumyGJMkCiD9bY59JYY1J0Z63+eSk42vEDxi+SnLlIeKMRQRLWkP2nfPAJxVcbWLjnjRiwrtd//5YxYrySmJain4F6hU5KkEYlp5aFgitlKmdk9zAHhMd4MXwbsTAjvp4Zr4rro4GBRI45fw/KetUnKEoCCPXN4i3KgxAbYnunnX1EII7cFvrBwy4vTZ0Cb59xkr6o4wIMm+EXSW+n8QfcHksm+xALWdog3rdPariMETqOb3lZdplWXBdBW0P206npJVnHyQaYaMlX4Z0M8hB8tu8miuCIKdzDMXrPMBTju61XqGwG+01S2kzyl52xnh7o2tLfKYgOeWYyXpo89b0P/5lecxBBgBhn8PE+AiZ0iIIZ8zFqja0jANnzNOM2t8fL/cyVdZi4poK4mrxKy9+QSNFGKgGHI2qQyuCK0TaxztvzghUeajLpIMffouOlsjCSm0uB0SA3sj03KnBvJ5OebUewH32UyJGoIo2fQIrL2/fCL0JHBPtnFDqmRm3//HtB43WIGScanQ/O5uPa5WGSjjzusTpuRlEQpGirQuFigOZuWe3qmTL3kdDMX31i8HWRtrnC7rMPcMioY26ZrAhxPoRnhuVCASADVkEQ/Xjqh2VaV9uDhQ== X-Forefront-PRVS: 0142F22657 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(189002)(377424004)(199003)(733004)(80316001)(42186005)(189998001)(50986999)(7736002)(39450400002)(54356999)(4001150100001)(270700001)(4001350100001)(2906002)(5000100001)(3846002)(105586002)(21490400002)(5890100001)(33656002)(512874002)(65816999)(81156014)(110136003)(97736004)(101416001)(87266999)(36756003)(7846002)(59896002)(81166006)(8676002)(68736007)(6666003)(65806001)(4326007)(6116002)(92566002)(65956001)(39410400001)(568964002)(106356001)(86362001)(5660300001)(77096006)(2476003)(84326002)(6916009)(64126003)(305945005)(4610100001)(66066001)(38730400001)(6486002)(83506001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0802MB2155; H:[10.2.206.73]; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE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0aRN/46yX60C2ncn22ovJKhLk2meCA3J1IWY/kchE6z3ykvx1y7TX8FOnpIk90Oi74q/Q836HdvFzhKPuy6+EdZZgXak7EYlo0c8V6UT4adKuFw+zZDTGlQURuwDCZCAPKk+jqIAI3nQA=; 5:qshbstCplSYlO+5zqe1bfCmOGdZjS0hE/mUC9NkcOjibpRz1X4Ry6yKd4NwYgebhQzeJwHHAC1+Fn1N2h9VSEhivRyoulj3vGx6RcTENBPBL7VtRXP1AN5mA5J2ETXCZWXbJlmGRCbY6CKoI0iPMEw==; 24:eToULlt52tG5SpBNLGTrUt99GKuxAi31O6HqFaXR9xqOkLcV3+R52bOTjU0fD0DHb1vEc7vvNx/dxLVsKv2Yd7WXPzLdlSWFB8KnpnY5dBA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0802MB2155; 7:TBbhyWqhFyYNKTuKgN1sWdV5/tbRQs6d1TetpEDrXT/Qlivr7Epa7Of4TKrMg54oAJ7wG+IaTf5yiJa2GP6Z9qBDq+8XRVkKXVbbgAD4yfvpA/p4mb4MzaEHvniEJVl4r/e5cNfxuz5d4M/ZzTt/ELUlPtT9fvxX76kq4hltBOZpKyi1mgQtGeFHSVb+KtOQr2PSAVkbxwuCNAXwEt1Jspw+Iqz2yaPzgIK4l4EBcW19QGa3wuybuRVf7BqHVtdYMTf9fGzM3PnbdIeYj1v1e5gIZDdrb5/SEeBDtE+U8T8MNcRdPdb3mI8ldKAJBymhAs+78GO5vV4TdEU9qpQGSfZvLWy6Dp2qJaIgUcPM1Hk= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2016 11:44:29.8653 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0802MB2155 This patch is not necessary for the bug fix, just makes concurrency code review easier (removes a data race and overflow from a broken code path). dlopen can oom crash anyway in _dl_resize_dtv and it's probably better to crash than leave half setup modules around. 2016-11-30 Szabolcs Nagy * elf/dl-tls.c (_dl_add_to_slotinfo): OOM crash. diff --git a/elf/dl-tls.c b/elf/dl-tls.c index 60f4c1d..2feee67 100644 --- a/elf/dl-tls.c +++ b/elf/dl-tls.c @@ -959,18 +959,10 @@ _dl_add_to_slotinfo (struct link_map *l) + TLS_SLOTINFO_SURPLUS * sizeof (struct dtv_slotinfo)); if (listp == NULL) { - /* We ran out of memory. We will simply fail this - call but don't undo anything we did so far. The - application will crash or be terminated anyway very - soon. */ - - /* We have to do this since some entries in the dtv - slotinfo array might already point to this - generation. */ - ++GL(dl_tls_generation); - - _dl_signal_error (ENOMEM, "dlopen", NULL, N_("\ -cannot create TLS data structures")); + /* We ran out of memory in dlopen while updating tls structures. + TODO: side-effects should be rolled back and the failure should + be reported to the caller, but that's hard. */ + oom (); } listp->len = TLS_SLOTINFO_SURPLUS;