From patchwork Tue Jan 13 21:25:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DJ Delorie X-Patchwork-Id: 128023 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id E08DC4BA2E28 for ; Tue, 13 Jan 2026 21:26:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E08DC4BA2E28 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bigQVP+E X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id C20C64BA2E07 for ; Tue, 13 Jan 2026 21:25:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C20C64BA2E07 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C20C64BA2E07 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1768339528; cv=none; b=fqJaAaEZjHKJQhPHYdw9+VUY012VdkoxI98K14GYaTETp0aHFZvrrUqAvcikPQXSw/VsXlVog0ijWqMs6JMF+p62qfpDMAKNDgxvwF9b0sYbRXB3uHkR74afTnqcqvgZs/mD4Uvg2tt2mUpeVtFVImQtUXoyW92yQAg7/CFnc3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1768339528; c=relaxed/simple; bh=5cp1j8bVKD9Vf3WBiQ8cOhz5erJzH0rpYbNyk3C1E3c=; h=DKIM-Signature:Date:Message-Id:From:To:Subject; b=TPu+qU8+QmWSgCGO6G5dfX3kBjmC+aSv0u1hFiYxzuhxP82bwrufoQ5mXG+/9w3Ua/BefnyrIMgju2YxFPC99pYC+l2C+D/rSbY1CBUld54Vkz10JpPk2JC0f66b/fGrz+VmrKLWtjtgQPCsl8UbzIaqyUbXWlYUjDdrwocQLWI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C20C64BA2E07 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768339528; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:content-type:content-type; bh=oxkl7s8CT6Z24raelR5y2prQDfFsoyBIzOsINl/KWVw=; b=bigQVP+EJbLiANvZF9wc2NltiB3HLd0wcP6toHubuCB4WrUxwBSmbI2oMDMiWFXN1GEqR8 8OJluVVnpZ/WH4giBGoeVzjauejRrkxlm9d06lkIMgJrPwpUPvbIf1V2QITIGkB0FWexI8 rbSBAx9h9gWxdb225unnNY6SdjFhUNU= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-496-y3PyraZFNSGrWwkvg5b5ZQ-1; Tue, 13 Jan 2026 16:25:27 -0500 X-MC-Unique: y3PyraZFNSGrWwkvg5b5ZQ-1 X-Mimecast-MFC-AGG-ID: y3PyraZFNSGrWwkvg5b5ZQ_1768339526 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4EEE11800357 for ; Tue, 13 Jan 2026 21:25:26 +0000 (UTC) Received: from greed.delorie.com (unknown [10.22.89.134]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 050F718004D8 for ; Tue, 13 Jan 2026 21:25:25 +0000 (UTC) Received: from greed.delorie.com.redhat.com (localhost [127.0.0.1]) by greed.delorie.com (8.16.1/8.16.1) with ESMTP id 60DLPO9s2832643; Tue, 13 Jan 2026 16:25:24 -0500 Date: Tue, 13 Jan 2026 16:25:24 -0500 Message-Id: From: DJ Delorie To: libc-alpha@sourceware.org Subject: asm-generic/fcntl.h vs bits/fcntl.h X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: GXy18eYokKLyJuzxYqmKjnjYLrkyfYOYw-kRkL-R5e0_1768339526 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on 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~patchwork=sourceware.org@sourceware.org wrt: https://issues.redhat.com/browse/RHEL-49857 This case is wrt fcntl.h conflicts between kernel and glibc. Both define the same things, but the kernel uses its kernel-specific types and glibc uses userland types. It's possible for the user to inadvertently include both, either via hidden includes or directly: #include #include or #include #include (order of includes doesn't matter) I can think of three ways around this "problem" 1. Take out part of 78a408ee7ba041fc8d5dbd5f67065b4a982c11e5 which added fcntl.h to sys/mount.h which fixes the reproducer but not the underlying cause. User might get unexpected error messages using open_tree() if they didn't manually include fcntl.h> 2. Clever macros and ifdefs between the kernel and glibc to make them compatible. Requires coordination across both projects, including backports. 3. Punt! I found this simple patch "solves" the problem by not allowing both to be included (and warning when it can) and "seems" to work, but I expect some subtle problems in corner cases: The only other solutions would be "clever shared headers between kernel and glibc" or "go back in time and tell someone to use a different file name". I don't expect either of those to be practical. Or of course "provide our own copy of the rest of the kernel headers, instead of including the kernel headers." :-P Thoughts? diff --git a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h index ad7f7c98c6..5da26e19c7 100644 --- a/sysdeps/unix/sysv/linux/bits/fcntl-linux.h +++ b/sysdeps/unix/sysv/linux/bits/fcntl-linux.h @@ -20,6 +20,11 @@ # error "Never use directly; include instead." #endif +#ifdef _ASM_GENERIC_FCNTL_H +#warning including both kernel and glibc versions of fcntl constants +#else +#define _ASM_GENERIC_FCNTL_H + /* This file contains shared definitions between Linux architectures and is included by to declare them. The various #ifndef cases allow the architecture specific file to define those @@ -488,6 +493,8 @@ extern int openat2 (int __dfd, const char * __filename, #endif /* use GNU */ +#endif + #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function # include #endif