Re: [PATCH v6 1/1] landlock.7: Explain the best-effort fallback mechanism in the example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 18/04/2023 16:37, Alejandro Colomar wrote:
Hi Mickaël,

On 4/17/23 22:54, Mickaël Salaün wrote:
BTW, now I checked that while in Linux ENOTSUP and EOPNOTSUPP are
equivalent, in POSIX the latter has a connotation that it's about

For Linux:
#define	EOPNOTSUPP	95	/* Operation not supported on transport endpoint */
#define ENOTSUPP	524	/* Operation is not supported */

$ errno 95
EOPNOTSUPP 95 Operation not supported
$ errno 524
$ echo $?
1


$ grepc -k ENOTSUP /usr/include/
/usr/include/x86_64-linux-gnu/bits/errno.h:30:#  define ENOTSUP		EOPNOTSUPP
$ grepc -k ENOTSUPP /usr/include/
$ grepc -k EOPNOTSUPP /usr/include/
/usr/include/asm-generic/errno.h:78:#define	EOPNOTSUPP	95	/* Operation not supported on transport endpoint */


Is ENOTSUPP a kernel thing?  User space we doesn't seem to agree with
that :).  I'm on Debian Sid.

Indeed, ENOTSUPP is a kernel error type, only EOPNOTSUPP should be used to return error to user space. ENOTSUPP is not used by the kernel, it is only defined by the libc:

# ifndef ENOTSUP
#  define ENOTSUP		EOPNOTSUPP
# endif




Indeed, it seems a kernel thing:

$ man -Kaw ENOTSUPP
/usr/local/man/man1/checkpatch.1


That page is one I wrote extracting info from checkpatch.rst.  It seems
checkpatch.pl warns about use of ENOTSUPP.



EOPNOTSUPP is not only used for network error, but to identify generic
unsupported operations, while ENOTSUPP was initially dedicated to NFS
error (but now also slipped to other areas)

sockets.  Should we document ENOTSUP in landlock_create_ruleset(2)
instead of EOPNOTSUPP? >>
EOPNOTSUP is also used in Landlock's kernel documentation,
we'd maybe have to update it there as well.
I'll have a look at what is more common.

Thanks.  In the man pages I see both often, so maybe we need to fix
consistency there too.

No, ENOTSUP*P* is not used by Landlock.

But should it?  I mean ENOTSUP, not ENOTSUPP.

ENOTSUP doesn't exist in the kernel source, so it is legitimate that Landlock and any other kernel interfaces use EOPNOTSUPP. ENOTSUP should then not replace EOPNOTSUPP for Landlock nor any other kernel interfaces.



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux