From nobody Mon Sep 05 14:53:32 2022 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MLs361D53z4cYk2 for ; Mon, 5 Sep 2022 14:53:38 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MLs350pKKz3tlk; Mon, 5 Sep 2022 14:53:37 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-il1-x12d.google.com with SMTP id k9so1569896ils.12; Mon, 05 Sep 2022 07:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date; bh=gEDLec3QbUzLipKlU2tkbcmA9TFoQ/2NMQlfHtEmg18=; b=hLOF6n5AwT4k0xbeMUO8NeCQ+St2CTrTTiFC4YEo+Tvu5YtP7NojB82DjV5+xZv8X9 8nNJhz4TV7Qf2NO4Jp4UpljxmZwooNwTXgh/szwVldmnHCQnH13oxH2baFKBuhs+Hoob Z4sE/wYXrGqayS4FeOiZQ1atlY3dUQHIVK5+f3X0nmd9n5PkiWfQUIECNawIi21jTjMb sfAYyvm7gczJiXKA/rud7YQcQOAQ/dYc575k+D+Guj/MwBbJx3KH3pz6/S3gOo1LaAsr CelAk0WlWYOmTH1vqyABTFFwLXy7OJ8qfmpp7p5Ewr/5VANRki4yOEzHQ+zdzYTQ+gWe Ac9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date; bh=gEDLec3QbUzLipKlU2tkbcmA9TFoQ/2NMQlfHtEmg18=; b=Kpj/9SEBjKxBgTngS+4NvapoCvxGlB75YfjqELZewfUzSNCenPs67ipjf839IhCOTp Bf4VqtpASE8P1u7P2cbBjRiP5JEbRhBBxa4Qt5yR7TuqWZo5DcXVQOVvB48YDGSIeufH UCQusG/mfAew/V/fPMkQy400wuUFfJrGPKyN4E8cYKr1fTJJ0PiRQOv/8DX8GIoDO/Jp 4egeTLPwht7msMdlKWcT6C8aChxlmCaVvFyXSzoUNrrzynHOel5AxLUgNCUTjJa12TKe yKpHh4jNTeP4Glsd98HtY4MuS925jRmLv+HmbkyWYuptz23JNjQrvnlTQeKcynKarmtg BRzA== X-Gm-Message-State: ACgBeo3N8C0sW84lgxU540+9uG+QPAb/D9DndABzQQ4jyN8oKSrs3zVe 1KoUMqJb0zK0FQDKmp5tAX2x/7juxAg= X-Google-Smtp-Source: AA6agR7ywDAHM9v5YbaMIDVumiHTssNO+EmYgUTZHjx3VfDgcNoBusbmeTIsbtGNHjP9GNX1wNJFJw== X-Received: by 2002:a92:c20f:0:b0:2ea:e8b5:ba16 with SMTP id j15-20020a92c20f000000b002eae8b5ba16mr18709268ilo.280.1662389615797; Mon, 05 Sep 2022 07:53:35 -0700 (PDT) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id z66-20020a0293c8000000b00342cb39de68sm4068491jah.130.2022.09.05.07.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 07:53:35 -0700 (PDT) Date: Mon, 5 Sep 2022 10:53:32 -0400 From: Mark Johnston To: Alan Somers Cc: Konstantin Belousov , FreeBSD CURRENT Subject: Re: Header symbols that shouldn't be visible to ports? Message-ID: References: List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4MLs350pKKz3tlk X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=hLOF6n5A; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::12d as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-1.52 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; NEURAL_HAM_MEDIUM(-0.82)[-0.825]; MID_RHS_NOT_FQDN(0.50)[]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_THREE(0.00)[3]; RCVD_VIA_SMTP_AUTH(0.00)[]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_LAST(0.00)[]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::12d:from]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; TO_DN_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; DKIM_TRACE(0.00)[gmail.com:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_CC(0.00)[gmail.com,freebsd.org] X-ThisMailContainsUnwantedMimeParts: N On Mon, Sep 05, 2022 at 08:41:58AM -0600, Alan Somers wrote: > On Sat, Sep 3, 2022 at 11:10 PM Konstantin Belousov wrote: > > > > On Sat, Sep 03, 2022 at 10:19:12AM -0600, Alan Somers wrote: > > > Our /usr/include headers define a lot of symbols that are used by > > > critical utilities in the base system like ps and ifconfig, but aren't > > > stable across major releases. Since they aren't stable, utilities > > > built for older releases won't run correctly on newer ones. Would it > > > make sense to guard these symbols so they can't be used by programs in > > > the ports tree? There is some precedent for that, for example > > > _WANT_SOCKET and _WANT_MNTOPTNAMES. > > _WANT_SOCKET is clearly about exposing parts of the kernel definitions > > for userspace code that wants to dig into kernel structures. Similarly > > for _WANT_MNTOPTNAMES, but in fact this thing is quite stable. The > > definitions are guarded by additional defines not due to their instability, > > but because using them in userspace requires (much) more preparation from > > userspace environment, which is either not trivial (_WANT_SOCKET) or > > contradicts to standartized use of the header (_WANT_MNTOPTNAMES + > > sys/mount.h). > > > > > > > > I'm particular, I'm thinking about symbols like the following: > > > MINCORE_SUPER > > Why this symbol should be hidden? It is implementation-defined and > > intended to be exposed to userspace. All MINCORE_* not only MINCORE_SUPER > > are under BSD_VISIBLE braces, because POSIX does not define the symbols. > > Because it isn't stable. It changed for example in rev 847ab36bf22 > for 13.0. Programs using the older value (including virtually every > Rust program) won't work on 13.0 and later. Why won't they work? Code that tests (vec[i] & MINCORE_SUPER) using the old value will still give the same result when running on a newer kernel, since MINCORE_PSIND(1) is 0x20, the old MINCORE_SUPER value. This isn't to say that the change was perfectly backwards compatible, but I haven't seen an example of code which was broken by the change.