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:	Sun, 11 Apr 2010 21:16:17 +0200
From:	Michal Nazarewicz <mina86@...a86.com>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	Michal Nazarewicz <m.nazarewicz@...sung.com>,
	linux-usb@...r.kernel.org,
	Davide Libenzi <davidel@...ilserver.org>,
	Greg KH <greg@...ah.com>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	Marek Szyprowski <m.szyprowski@...sung.com>,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2 2/8] fs/timerfd.c: make use of wait_event_interruptible_locked_irq()

> On Fri, 9 Apr 2010, Michal Nazarewicz wrote:
>> diff --git a/fs/timerfd.c b/fs/timerfd.c
>> index 1bfc95a..4d2c371 100644
>> --- a/fs/timerfd.c
>> +++ b/fs/timerfd.c
>> @@ -109,31 +109,13 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
>>  	struct timerfd_ctx *ctx = file->private_data;
>>  	ssize_t res;
>>  	u64 ticks = 0;
>> -	DECLARE_WAITQUEUE(wait, current);
>>  
>>  	if (count < sizeof(ticks))
>>  		return -EINVAL;
>>  	spin_lock_irq(&ctx->wqh.lock);
>>  	res = -EAGAIN;
>> -	if (!ctx->ticks && !(file->f_flags & O_NONBLOCK)) {
>> -		__add_wait_queue(&ctx->wqh, &wait);
>> -		for (res = 0;;) {
>> -			set_current_state(TASK_INTERRUPTIBLE);
>> -			if (ctx->ticks) {
>> -				res = 0;
>> -				break;
>> -			}
>> -			if (signal_pending(current)) {
>> -				res = -ERESTARTSYS;
>> -				break;
>> -			}
>> -			spin_unlock_irq(&ctx->wqh.lock);
>> -			schedule();
>> -			spin_lock_irq(&ctx->wqh.lock);
>> -		}
>> -		__remove_wait_queue(&ctx->wqh, &wait);
>> -		__set_current_state(TASK_RUNNING);
>> -	}
>> +	if (!(file->f_flags & O_NONBLOCK))
>> +		wait_event_interruptible_locked_irq(ctx->wqh, ctx->ticks);

Thomas Gleixner <tglx@...utronix.de> writes:
> With this change we return -EAGAIN instead of -ERESTARTSYS when the
> wait got interrupted by a signal. That means instead of restarting the
> syscall we return -EAGAIN to user space.

Stupid mistake, the following should fix it:

+		res = wait_event_interruptible_locked_irq(ctx->wqh, ctx->ticks);

Sorry about that.

I'll resubmit an updated patchset by the end of the week.

-- 
Best regards,                                         _     _
 .o. | Liege of Serenly Enlightened Majesty of      o' \,=./ `o
 ..o | Computer Science,  Michal "mina86" Nazarewicz   (o o)
 ooo +--<mina86-tlen.pl>--<jid:mina86-jabber.org>--ooO--(_)--Ooo--
--
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