Re: RTC wakealarm write-only, still has 644 permissions

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Pavel Machek <pavel@...>
Cc: <rtc-linux@...>, kernel list <linux-kernel@...>, Alessandro Zummo <alessandro.zummo@...>
Date: Thursday, November 29, 2007 - 2:10 pm

On Wednesday 28 November 2007, Pavel Machek wrote:

There were some patches from Mark Lord to update the wildcarding,
and to hibernation to work better with ACPI.  I still don't think
the wildcarding is done quite right; there are some date-wrap cases
that looked wrong.



It's not an issue of accidental writes, it's an issue of there being
no other synchronization for setting those alarms.  Remember that both
RTC_WKALM_SET and RTC_ALM_SET ioctls can set that same alarm, and so
could a different userspace activity ...

If there's no alarm set, it's clear that changing the (single) alarm
can't cause event lossage.  But if an alarm *is* set it sure seems
that changing it would discard an event that something was expecting,
and thus cause breakage.

As written, this allows one userspace activity to clobber another if
it does so explicitly, by first disabling the other one and then
setting its own alarm.  But the idea is to minimize "accidents" like
unintentionally clobbering an alarm set by someone else.



Evidently the alarm isn't being disabled then...

I think the issue there is that the alarm isn't acting as a one-shot
event.  There are some model questions lurking there ... if the RTC
has a sane alarm model, "fire at YYYY-MM-DD at HH:MM:SS", then it's
naturally one-shot.

But if the YYYY-MM-DD part is a wildcard (or equivalently, ignored)
at the hardware level, that model is awkward.  You can't easily look
at such alarms and know if they already triggered -- especially after
hibernation.  With respect to rtc-cmos, it'd always be practical to
disable the alarm after it triggers while the system is running.
(Not currently done, pending resolution of such issues.)  And there's
an ACPI flag -- currently ignored by Linux, or maybe trashed -- to
report whether the system wakeup was triggered by an alarm; that
could be read, and used to disable the alarm.

I think the right thing to do there is just insist that in the RTC
framework, alarms should always follow the one-shot model.

- Dave
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
RTC wakealarm write-only, still has 644 permissions, Pavel Machek, (Thu Sep 20, 6:32 am)
Re: RTC wakealarm write-only, still has 644 permissions, Pavel Machek, (Thu Sep 20, 6:50 am)
Re: RTC wakealarm write-only, still has 644 permissions, David Brownell, (Sat Sep 22, 1:38 am)
Re: RTC wakealarm write-only, still has 644 permissions, Pavel Machek, (Wed Nov 28, 7:26 pm)
Re: RTC wakealarm write-only, still has 644 permissions, David Brownell, (Thu Nov 29, 2:10 pm)
Re: RTC wakealarm write-only, still has 644 permissions, Pavel Machek, (Fri Nov 30, 4:35 pm)
Re: RTC wakealarm write-only, still has 644 permissions, David Brownell, (Fri Nov 30, 5:10 pm)
Re: RTC wakealarm write-only, still has 644 permissions, David Brownell, (Sun Dec 2, 12:03 pm)
Re: RTC wakealarm write-only, still has 644 permissions, Pavel Machek, (Fri Nov 30, 5:27 pm)
Re: RTC wakealarm write-only, still has 644 permissions, Alessandro Zummo, (Thu Nov 29, 2:14 pm)
Re: RTC wakealarm write-only, still has 644 permissions, David Brownell, (Tue Oct 2, 10:15 pm)