Re: fs/notify/fanotify/fanotify.c:198:2: note: in expansion of macro 'pr_warn_ratelimited'

From: Paul Burton
Date: Thu Mar 14 2019 - 13:45:06 EST


Hi Amir,

On Thu, Mar 14, 2019 at 06:16:35PM +0200, Amir Goldstein wrote:
> On Thu, Mar 14, 2019 at 4:34 PM Ralf Baechle <ralf@xxxxxxxxxxxxxx> wrote:
> > On Thu, Mar 14, 2019 at 01:38:11PM +0100, Jan Kara wrote:
> > > On Thu 14-03-19 14:01:18, Amir Goldstein wrote:
> > > > On Thu, Mar 14, 2019 at 10:37 AM Jan Kara <jack@xxxxxxx> wrote:
> > > > > AFAICS this is the known problem with weird mips definitions of
> > > > > __kernel_fsid_t which uses long whereas all other architectures use int,
> > > > > right? Seeing that mips can actually have 8-byte longs, I guess this
> > > > > bogosity is just wired in the kernel API and we cannot easily fix it in
> > > > > mips (mips guys, correct me if I'm wrong). So what if we just
> > > > > unconditionally typed printed values to unsigned int to silence the
> > > > > warning?
> > > >
> > > > I don't understand why. To me that sounds like papering over a bug.
> > > >
> > > > See this reply from mips developer Paul Burton:
> > > > https://marc.info/?l=linux-fsdevel&m=154783680019904&w=2
> > > > mips developers have not replied to the question why __kernel_fsid_t
> > > > should use long.
> > >
> > > Ah, right. I've missed that mips defines __kernel_fsid_t only if
> > > sizeof(long) == 4. OK, than fixing MIPS headers is definitely what we ought
> > > to do. Mips guys, any reason why the patch from Ralf didn't get merged yet?
> >
> > Paul's patch :-)
> >
> > As for the reason why the definition is as it is - 32-bit MIPS was
> > born using long, then in 2000 64-bit MIPS started off as arch/mips64
> > using int. Eventually the two ports were combined using:
> >
> > ypedef struct {
> > #if (_MIPS_SZLONG == 32)
> > long val[2];
> > #endif
> > #if (_MIPS_SZLONG == 64)
> > int val[2];
> > #endif
> > } __kernel_fsid_t;
> >
> > A desparate attempt to use asm-generic where ever possible then resulted
> > in the confusing definition we'e having today.
> >
> > Normally APIs are cast into stone not to be changed. But fsid is used in
> > struct statfs and the man page states "Nobody knows what f_fsid is supposed
> > to contain (but see below)." and f_fsid is supposed to be opaque anyway so
> > I'm wondering if something could break at all. Researching that.
> >
>
> Its content is opaque, but its size must be equal to that of fsid_t
> from glibc/toolchain headers. Do the mips32 glibc headers also
> define fsid_t as long val[2], or do they define it as int val[2]?

First off, my apologies that my proposed patch slipped through the
cracks. It somehow didn't make it onto my to-do list & after that there
was little chance I was going to remember it until someone replied... :)

I've just polished off the patch & submitted it [1]. Presuming nobody
has a problem with it in the next couple of days, I'll apply it to
mips-fixes & send it on to Linus.

To address your question about glibc headers - it shouldn't matter. On
MIPS32 int & long are the same, so even if userland & the kernel
disagree about the type the data in memory should be identical.

[1] https://lore.kernel.org/linux-mips/20190314173900.25454-1-paul.burton@xxxxxxxx/T/#u

Thanks,
Paul