From nobody Mon Apr 6 18:56:34 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BC3B3815DC; Wed, 18 Mar 2026 08:25:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773822327; cv=none; b=XIahQL6K8Sp9LH0be8RntmrIzyYsnOkLvd/j/0n4y47orHiW+JRQ0as8ycWCUalj+qmSi/trZfyM+495HsCJ02p/FRz3Qpg97NT5x37iZS55w0yJxxCJK1FYAlcd98Bg2LqYwp+BplOizfwdwm+uEPOxeuT1VH+3Oh0YXmJJmMM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773822327; c=relaxed/simple; bh=zh8r7hsDZMBssavvrRqJIlJHF3gk+x4I4EAscn3NXzw=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=svzxpsKvRHM4sf3OyB8CWpbhA3H3ACFhApPSbM8qc8SPU6VHS7MM1+RNe5UaLdt6siGKtlNL4GXj9g/MxxKxibpTYhXoMWhGllY24hmgnVWruFK8JYJyXpQTgmMuc9vjiHRISynK9eV89QZBPme1q7sE17qhOaJuDBNp+r2QCN8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=FWpQR5/Z; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=6tUcP9uP; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FWpQR5/Z"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="6tUcP9uP" Date: Wed, 18 Mar 2026 08:25:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773822325; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U6YcsM+nNJWTTcT1VfdZG926AAHOqp1EULtDF6XwUfQ=; b=FWpQR5/Z9cOSZ0m/uGfC+h3yeLjjOtAR4VONZoQrDM1KtNP4ZkX6jDtP/Rfu5hWhf17OTg nNkkGHeIi2HMy0ehCvjmIcTwhyJKOT3eGkjkQfl9URBKFCfV+mrQ6elKknPM7SL3ZZlw5o QImbybG7+80+ZwrTqQj+H19+P+bPgXrjC0bzzjSr9gQ32eRgBJLblsQKjrXMSixdlSkWlj a3FeoxYffyxZq9+SRdlWMEhVvRxWUO1W+5tA3AuN1vTZHZ6R0Vq32CZSApjVhODj9rh8nq fcOgjM7UrGJ3zT60gVyVsdr3ClrLmPkujLiN4dNg1pgjKLD047Dhsh++d8BPgg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773822325; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U6YcsM+nNJWTTcT1VfdZG926AAHOqp1EULtDF6XwUfQ=; b=6tUcP9uPjo4qJBrIunnkdxpaIuZxwU3Pj83h2pThc4zGP8ZwH0veCm+txqcSs/GT0/sO5x vBXHkiITF3ov3pDQ== From: "tip-bot2 for Joe Lawrence" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/urgent] objtool/klp: fix mkstemp() failure with long paths Cc: Song Liu , Joe Lawrence , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260310203751.1479229-3-joe.lawrence@redhat.com> References: <20260310203751.1479229-3-joe.lawrence@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177382232384.1647592.15721838348502020490.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the objtool/urgent branch of tip: Commit-ID: 28e367a969b0c54c87ca655ec180715fe469fd14 Gitweb: https://git.kernel.org/tip/28e367a969b0c54c87ca655ec180715fe= 469fd14 Author: Joe Lawrence AuthorDate: Tue, 10 Mar 2026 16:37:41 -04:00 Committer: Josh Poimboeuf CommitterDate: Mon, 16 Mar 2026 12:40:31 -07:00 objtool/klp: fix mkstemp() failure with long paths The elf_create_file() function fails with EINVAL when the build directory path is long enough to truncate the "XXXXXX" suffix in the 256-byte tmp_name buffer. Simplify the code to remove the unnecessary dirname()/basename() split and concatenation. Instead, allocate the exact number of bytes needed for the path. Acked-by: Song Liu Signed-off-by: Joe Lawrence Link: https://patch.msgid.link/20260310203751.1479229-3-joe.lawrence@redhat= .com Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 3da9068..2ffe3eb 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -1189,7 +1188,7 @@ err: struct elf *elf_create_file(GElf_Ehdr *ehdr, const char *name) { struct section *null, *symtab, *strtab, *shstrtab; - char *dir, *base, *tmp_name; + char *tmp_name; struct symbol *sym; struct elf *elf; =20 @@ -1203,29 +1202,13 @@ struct elf *elf_create_file(GElf_Ehdr *ehdr, const = char *name) =20 INIT_LIST_HEAD(&elf->sections); =20 - dir =3D strdup(name); - if (!dir) { - ERROR_GLIBC("strdup"); - return NULL; - } - - dir =3D dirname(dir); - - base =3D strdup(name); - if (!base) { - ERROR_GLIBC("strdup"); - return NULL; - } - - base =3D basename(base); - - tmp_name =3D malloc(256); + tmp_name =3D malloc(strlen(name) + 8); if (!tmp_name) { ERROR_GLIBC("malloc"); return NULL; } =20 - snprintf(tmp_name, 256, "%s/%s.XXXXXX", dir, base); + sprintf(tmp_name, "%s.XXXXXX", name); =20 elf->fd =3D mkstemp(tmp_name); if (elf->fd =3D=3D -1) {