Re: [PATCH 20/23] y2038: move itimer reset into itimer.c

From: Ondrej Mosnacek
Date: Sat Nov 09 2019 - 18:08:00 EST


On Sat, Nov 9, 2019 at 10:03 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
> On Sat, Nov 9, 2019 at 2:43 PM Ondrej Mosnacek <omosnace@xxxxxxxxxx> wrote:
>
> > > -struct itimerval;
> > > -extern int do_setitimer(int which, struct itimerval *value,
> > > - struct itimerval *ovalue);
> > > -extern int do_getitimer(int which, struct itimerval *value);
> > > +#ifdef CONFIG_POSIX_TIMERS
> > > +extern void clear_itimer(void);
> > > +#else
> > > +static inline void clear_itimer(void) {}
> > > +#endif
> > >
>
> > > @@ -249,6 +249,17 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
> > > return 0;
> > > }
> > >
> > > +#ifdef CONFIG_SECURITY_SELINUX
> >
> > Did you mean "#ifdef CONFIG_POSIX_TIMERS" here to match the header?
>
> No, this part is intentional, CONFIG_POSIX_TIMERS already controls
> whether itimer.c is
> compiled in the first place, but this function is only needed when called from
> the selinux driver.

All right, but you declare the function in time.h even if
CONFIG_SECURITY_SELINUX is not enabled... it is kind of awkward when
it can happen that the function is declared but not defined anywhere
(even if it shouldn't be used by new users). Maybe you could at least
put the header declaration/definition inside #ifdef
CONFIG_SECURITY_SELINUX as well so it is clear that this function is
intended for SELinux only?

--
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.