From patchwork Mon Apr 8 16:06:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1920937 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=BBmaKKLR; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VCv9J6Q5xz1yYb for ; Tue, 9 Apr 2024 02:06:44 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DA4A73858C50 for ; Mon, 8 Apr 2024 16:06:42 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by sourceware.org (Postfix) with ESMTPS id D43A93858D28 for ; Mon, 8 Apr 2024 16:06:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D43A93858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D43A93858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::435 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712592390; cv=none; b=DRC8Pp+doOr5Hpm+tkIVOurFLvJLCJAI0/8Fk+YuY1//XuVLSswegaEnlz0mc68fZ7lLzqLqg1L/MiU2u+ulld7wD+N2LzhfO4kxgfMMdH+LjvLPFDgljs8o/IiggFjKPjMuSbF/LwCI+nC1XGwkvsqgfM3qEhiJufRWIZYjstk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712592390; c=relaxed/simple; bh=NcxvStl9/kFJ388G6qoZDmUY+XFqpiThhY1e/MpbRQw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=wwQC4+SlWRCLKHpbSUsTSFusjg0ykac6GqcCuyVoO18O/GDptwM4gDsX7NeGz5GHNU3nQx4eo08SiWltd7hNgQIlruN9ZW+gpCtfugr6pBIqUxF2El09xYiE6nRaRU5A2Xt5ve20EYWAp5okA3TBfQyYdRSGOBjGVL7zZQJ7TQw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6ed0938cd1dso2608316b3a.2 for ; Mon, 08 Apr 2024 09:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712592386; x=1713197186; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ESuW+BkBzFbQTvClbohAt6cTaR+u/x0l+Dyil3UHhR4=; b=BBmaKKLR2+hWuuwKiOjiAdwHrcPfQ8UXsvsJk7m9BKsRwZVdZM9z8V3QaWFj61IJV8 5Q39RVCeDuuinliEogi4VixmZ2bLswZws74rjfBsJV9+5DAWTakIchHDSE9j3hyGe8+o owHSd2y09UIwQU+AT4YjB5cpGu5u9+u46j3di07cWGPsJ4BmsOtDXq0pdlzgW7Adedd2 zY/nqMdvjQzMR9jCVYfrxeMmFM/UaEDJimUjWXOTt45LDeisr4wblcFRXOoN/cHPjBxG mkUCUB8350aBscqFplZmFBfgfd11CHCE0lxFnEwjTnWpXBBKCkPrXJBD/je/n4hiROn8 Z5sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712592386; x=1713197186; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ESuW+BkBzFbQTvClbohAt6cTaR+u/x0l+Dyil3UHhR4=; b=GikPbgn/672rtxD8d5z/faos14ZzkbxaiQn3vam6JDBWssw0laL2CilgLlPnv7JD1Y J+k7r6lz290UUel9zqr7Y3fZ7IVZP/3RuBjdolPppfqnYIPLQYfvgPbQJZOVr6G/zPAe ZCaVJm25/70nNvcKNM9cmbEeBisyGYuBtoA/laXhnRPxHv2hi6Z1xo4T9n3Lsu8k7vLJ /FIvFoyn2eUgf+D+32YhrVqiOQqtp9CB92Kd4kL6RtCU9ZyhNoDW71mq2zzfo6oW9CZr hqlGONF71rIxTc/prefmRSCn2cqDgk8jqMGFC2xtEcWIg0dohwLNNf1X2vFU/9YaK2LV OJyw== X-Gm-Message-State: AOJu0YxPMj+z91M3UfR1byXgQl1AEXkPKZdA4ehmz8K2+KmKGd4KBO67 97vS7rbkC0RwCw7FQrPktHckZJmxQOUb9FmN74GrKlhoM/r2Z0AO/f5Jxqmu X-Google-Smtp-Source: AGHT+IEIeRiNxrbM456rKNOB2/a17ReUynGDtwK/3vRpHgbS/HCmtefD1/PcDC96cpus+qLDGnzcPw== X-Received: by 2002:a05:6a00:c89:b0:6ea:c62c:c20f with SMTP id a9-20020a056a000c8900b006eac62cc20fmr11418778pfv.9.1712592386332; Mon, 08 Apr 2024 09:06:26 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.56.169.48]) by smtp.gmail.com with ESMTPSA id x8-20020a056a00188800b006ed045e3a70sm5963204pfh.25.2024.04.08.09.06.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 09:06:10 -0700 (PDT) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 83FBA7402F8 for ; Mon, 8 Apr 2024 09:06:09 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH] elf: Check objname before calling fatal_error Date: Mon, 8 Apr 2024 09:06:09 -0700 Message-ID: <20240408160609.1264205-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Spam-Status: No, score=-3020.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL_CSS, SPF_HELO_NONE, SPF_PASS, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org _dl_signal_error may be called with objname == NULL. _dl_exception_create checks objname == NULL. But fatal_error doesn't. Check objname before calling fatal_error. This fixes BZ #31596. Reviewed-by: Sunil K Pandey --- elf/dl-catch.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/elf/dl-catch.c b/elf/dl-catch.c index 2109516dba..8ef7a4c706 100644 --- a/elf/dl-catch.c +++ b/elf/dl-catch.c @@ -126,7 +126,11 @@ _dl_signal_error (int errcode, const char *objname, const char *occasion, __longjmp (lcatch->env[0].__jmpbuf, 1); } else - fatal_error (errcode, objname, occasion, errstring); + { + if (objname == NULL) + objname = ""; + fatal_error (errcode, objname, occasion, errstring); + } } rtld_hidden_def (_dl_signal_error)