Re: [RFC PATCH] UAPI: Document auxvec AT_* namespace policy and note reservations

From: Yann Droneaud
Date: Thu May 17 2018 - 11:46:51 EST


Hi,

Le mercredi 16 mai 2018 Ã 15:20 +0100, Dave Martin a Ãcrit :
> There are constraints on defining AT_* auxvec tags that are not
> obvious to the casual maintainer of either the global
> <uapi/linux/auxvec.h> or the arch-specific headers. This is likely
> to lead to mistakes. (I certainly fell foul of it...)
>
> For the benefit of future maintainers, this patch collects the
> relevant information in one place, documenting how the namespace
> needs to be managed, and noting all the values currently in use.
>
> Maintaining a global list may result in some merge conflicts, but
> AT_* values are not added frequently. I'm open to suggestions on
> the best approach.
>
> I also assume that values 38 and 39 may have been used for
> historical purposes, such as an architecture that is no longer
> supported. If they have definitely never been used for anything,
> they could be removed from the "reserved" list.
>

Some of those AT_* values are described in getauxval(3) man-page:

http://man7.org/linux/man-pages/man3/getauxval.3.html

https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/man3/g
etauxval.3?id=4eae8eb731386d81797d5c30365426722410874e

And glibc provides <elf.h> with definitions for almost all AT_*,
regardless of the current target architecture:

https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/elf.h;h=954f3266f7
11ab83996670ea504a17dcf668e061;hb=23158b08a0908f381459f273a984c6fd32836
3cb#l1135

Also, despite not being listed as a reserved namespace by POSIX, one
should try to avoid name collision with other AT_ constants,
those used with *at() functions (openat(), etc.):

- AT_EACCESS
- AT_EMPTY_PATH
- AT_FDCWD
- AT_NO_AUTOMOUNT
- AT_REMOVEDIR
- AT_STATX_DONT_SYNC
- AT_STATX_FORCE_SYNC
- AT_STATX_SYNC_AS_STAT
- AT_SYMLINK_FOLLOW
- AT_SYMLINK_NOFOLLOW

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/fcntl.h.html

http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.htm
l#tag_15_02_02

https://sourceware.org/git/?p=glibc.git;a=blob;f=io/fcntl.h;h=3d239e8f0
9f7ce0a3106621be327e1ea4cd1a3e7;hb=23158b08a0908f381459f273a984c6fd3283
63cb#l142

And there's also AT_ANYNET and AT_ANYNODE from ddp (aka. AppleTalk)

http://man7.org/linux/man-pages/man7/ddp.7.html

Regards.

--
Yann Droneaud
OPTEYA