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, 17 Dec 2018 23:45:41 -0500
From:   "Theodore Y. Ts'o" <tytso@....edu>
To:     Andreas Dilger <adilger@...ger.ca>
Cc:     Ext4 Developers List <linux-ext4@...r.kernel.org>,
        stable@...nel.org
Subject: Re: [PATCH] ext4: avoid declaring fs inconsistent due to invalid
 file handles

On Mon, Dec 17, 2018 at 03:53:46PM -0700, Andreas Dilger wrote:
> > +#define EXT4_IGET_NORMAL	1
> > +#define EXT4_IGET_HANDLE	2
> 
> It would be better to make this:
> 
>  enum ext4_iget_flags {
>         EXT4_IGET_RESERVED = 0x00,	/* just guessing, see further below */
> 	EXT4_IGET_NORMAL   = 0x01,
> 	EXT4_IGET_HANDLE   = 0x02,
>  };
> 
> > -	inode = ext4_iget(sb, ino);
> > +	inode = ext4_iget(sb, ino, 0);
> 
> What does "0" mean?  It isn't in the list of EXT4_IGET_* flags.  I'm guessing it
> means that access to reserved or otherwise invalid inodes is allowed?

The flags are boolean OR'ed together, much like O_TRUNC | O_CREAT,
etc.  So an enum isn't really appropriate.  So 0 means we're not
enforcing "must be a normal inode" rules, and we're also not going to
avoid throwing an EXT4_ERROR if the inode number is invalid.

I had thought it was obvious that flags can be or'ed together, and
that "modes" are what might use an enum.  I personally like flags
because the can be more expressive, although I can see that "modes"
are simpler since there is a much smaller set of valid modes, and you
don't have to worry about define what happens when flags interact in
unusual/unexpected ways.

It sounds like should add more explicit documentation at the very
least so it's more clear what's going on.

      	      	   	 	      - Ted

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ