lkml.org 
[lkml]   [2022]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] mm/secretmem: fix panic when growing a memfd_secret
Any strong opinions on which error code is used? I think overall I
would still pick EOPNOTSUPP, but happy to change it if anyone feels
strongly.

- I think ENOSYS is specific to syscall nr not defined
- I think ENOTTY is specific to ioctls
- The kernel (sort of mistakenly) defines ENOTSUPP instead of ENOTSUP,
but it's marked deprecated and it's recommended to use EOPNOTSUPP
instead (despite POSIX saying these should be distinct and for
different uses).

On Thu, Mar 24, 2022 at 2:44 PM Axel Rasmussen <axelrasmussen@google.com> wrote:
>
> On Thu, Mar 24, 2022 at 2:33 PM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > On Thu, Mar 24, 2022 at 02:09:09PM -0700, Axel Rasmussen wrote:
> > > This patch avoids the panic by implementing a custom setattr for
> > > memfd_secret, which detects resizes specifically (setting the size for
> > > the first time works just fine, since there are no existing pages to try
> > > to zero), and rejects them as not supported (ENOTSUP).
> >
> > Isn't ENOTTY the normal return value for this? Or even ENOSYS?
>
> I'm unsure.
>
> Since errno(3) says ENOTTY means "Inappropriate I/O control operation"
> that makes me think it's meant to be used only for ioctls?
>
> I tried ENOSYS, but checkpatch warns me it's meant to be used for
> "invalid syscall nr" and nothing else.
>
> ENOTSUP / ENOTSUPP / EOPNOTSUPP all have their own share of
> weirdnesses too, though. There's the whole ENOTSUP / ENOTSUPP mess,
> and then also the fact that glibc says ENOTSUP == EOPNOTSUPP, whereas
> POSIX says EOPNOTSUPP should be distinct and used specifically for
> sockets...

\
 
 \ /
  Last update: 2022-03-31 19:43    [W:0.066 / U:0.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site