lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 22 Jan 2024 11:47:43 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Geert Uytterhoeven <geert@...ux-m68k.org>, Linus Torvalds
 <torvalds@...ux-foundation.org>
Cc: Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org, Masami
 Hiramatsu <mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>,
 Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Andrew Morton
 <akpm@...ux-foundation.org>, Christian Brauner <brauner@...nel.org>, Al
 Viro <viro@...iv.linux.org.uk>, Ajay Kaher <ajay.kaher@...adcom.com>
Subject: Re: [for-linus][PATCH 1/3] eventfs: Have the inodes all for files
 and directories all be the same

On Mon, 22 Jan 2024 17:23:29 +0100
Geert Uytterhoeven <geert@...ux-m68k.org> wrote:

> > +/* Just try to make something consistent and unique */
> > +static int eventfs_dir_ino(struct event_inode *ei, const char *name)  
> 
> eventfs_inode

Heh, I fixed that, but must have created the patch before catching it. :-/

> 
> > +{
> > +       unsigned long sip = (unsigned long)ei;
> > +
> > +       sip += strhash(name) + EVENTFS_DIR_INODE_INO;
> > +       sip = siphash_1u32((int)sip, &inode_key);
> > +
> > +       /* keep it positive */
> > +       return sip & ((1U << 31) - 1);
> > +}
> > +
> >  /*
> >   * The eventfs_inode (ei) itself is protected by SRCU. It is released from
> >   * its parent's list and will have is_freed set (under eventfs_mutex).  
> 
> Thanks, find is happy now the directories have different inode numbers.
> The files still have identical inodes numbers, I hope that doesn't cause
> any issues...

Well, I guess I should ask Linus.

Linus,

I can add this patch to make sure directory inodes are unique, as it causes
a regression in find, but keep the file inodes the same. I can see how the
issue is with directories, as find (and probably other applications) check
for invalid directory loops. But with files, there should be no issue. It
could just think it's another hard link.

The question I have is, should this just make dir inodes unique and keep
files the same, as this patch does? Or make all inodes unique?

This is assuming that my algorithm is good enough to not leak kernel
addresses. I could also chop it down to 28 bits, as that's probably still
"good enough" to keep things unique.

	return sip & ((1U << 28) - 1);

That would make it even harder to unhash to get an address.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ