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]
Message-ID: <alpine.LFD.1.10.0807111110330.2936@woody.linux-foundation.org>
Date:	Fri, 11 Jul 2008 11:16:40 -0700 (PDT)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Roland McGrath <roland@...hat.com>
cc:	Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, Elias Oltmanns <eo@...ensachen.de>,
	Török Edwin <edwintorok@...il.com>,
	Arjan van de Ven <arjan@...radead.org>
Subject: Re: [PATCH] x86_64: fix delayed signals



On Fri, 11 Jul 2008, Roland McGrath wrote:
>
> > +		/* Only check signals if we have filled at least one entry! */
> > +		if (signal_pending(current))
> > +			return -EINTR;
> 
> Shouldn't it return the short count?  
> (And if not, then probably should be -ERESTARTSYS.)

readdir (getdents) is a complex system call, and the path is

    sys_getdents64() ->
      vfs_readdir (with 'filldir64' as a callback) ->
        low-level filesystem 'readdir' function ->	
          filldir64 callback

and what happens is that when that 'filldir64()' callback returns an 
error, the low-level filesystem just stops and returns with a success 
(because everything worked for _it_ - it was the callback that errored 
out).

The 'sys_getdents64()' then does:

	..
	lastdirent = buf.previous;
        if (lastdirent) {
                typeof(lastdirent->d_off) d_off = file->f_pos;
                error = -EFAULT;
                if (__put_user(d_off, &lastdirent->d_off))
                        goto out_putf;
                error = count - buf.count;
        }
	..

ie we'll do that "return partial buffer size" at that level, not deep in 
the callback.

So making the callback just return an error is the right thing to do - 
because the callers will then fix up the file offset in the last directory 
entry and the final return value.

			Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ