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:	Wed, 18 May 2011 09:35:32 +0200
From:	Jan Kara <jack@...e.cz>
To:	Christoph Hellwig <hch@...radead.org>
Cc:	Jan Kara <jack@...e.cz>, Ted Tso <tytso@....edu>,
	linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 1/3] fs: Create __block_page_mkwrite() helper passing
 error values back

On Tue 17-05-11 11:09:03, Christoph Hellwig wrote:
> > +	if (unlikely(ret < 0))
> >  		unlock_page(page);
> > +	else
> >  		ret = VM_FAULT_LOCKED;
> >  out:
> >  	return ret;
> 
> Using two different types of return values here seems rather unclean.
> I'd rather use 0 instead of VM_FAULT_LOCKED here, and maybe overload
> -EAGAIN for VM_FAULT_NOPAGE.
  OK, makes sense. I'll do that.

> > +int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
> > +		   get_block_t get_block)
> > +{
> > +	int ret = __block_page_mkwrite(vma, vmf, get_block);
> > +
> > +	if (unlikely(ret < 0)) {
> > +		if (ret == -ENOMEM)
> > +			return VM_FAULT_OOM;
> > +		/* -ENOSPC, -EIO, etc */
> > +		return VM_FAULT_SIGBUS;
> > +	}
> > +	return ret;
> 
> and maybe also add a small inlined block_page_mkwrite_error helper
> to translate the values.
  Good idea.

> Alternatively it might make sense to add a VM_FAULT_ENOSPC return value
> so that you could re-use block_page_mkwrite unmodified, and we could
> also have better error reporting for that case for the core VM.
  Umm, I think the first solution is better. For example ext[34] needs to
differentiate ENOSPC and EDQUOT (for the second one it does not make sense
to force transaction commit because quota accounting is always precise) and
other filesystems might possibly have different requirements. So returning
the error value and letting fs sort it out looks like the most versatile
solution.

								Honza
-- 
Jan Kara <jack@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ