linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* udevadm settle (udev 146) & pam-mount (1.32) via mount (util-linux-ng
@ 2009-10-29 18:15 Christian P. Schmidt
  2009-10-30 13:28 ` udevadm settle (udev 146) & pam-mount (1.32) via mount Kay Sievers
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christian P. Schmidt @ 2009-10-29 18:15 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 2234 bytes --]

Hi there,

I'm trying to figure out some interaction between pam-mount and udev
which, for some time now, fail to log me in.

First of, the invocation:

+-login---mount---mount.crypto_LUKS---cryptsetup---udevadm

After the getty replaces itself with login the pam module pam_mount
calls mount. This in turn determines that the partition to be mounted is
LUKS encrypted, and calls cryptsetup. Cryptsetup receives the password,
unlocks the partition, and calls udevadm settle in order to avoid some
problems in interaction with LVM.

udevadm settle never returns.

strace reveals why:

rt_sigaction(SIGALRM, {0x40cf10, [], SA_RESTORER, 0x7f03082606d0}, NULL,
8) = 0
rt_sigaction(SIGUSR1, {0x40cf10, [], SA_RESTORER, 0x7f03082606d0}, NULL,
8) = 0
alarm(180)                              = 0
getuid()                                = 0
socket(PF_FILE, SOCK_DGRAM, 0)          = 4
rt_sigprocmask(SIG_BLOCK, [USR1 ALRM], ~[TRAP KILL SEGV STOP RTMIN
RT_1], 8) = 0
sendto(4,
"udev-146\0\0\0\0\0\0\0\0\352\35\255\336\10\0\0\0\0\0\0\0\0\0\0\0\0"...,
280, 0, {sa_family=AF_FILE, path=@"/org/kernel/udev/udevd"...}, 25) = 280
rt_sigsuspend(~[TRAP KILL SEGV STOP RTMIN RT_1] <unfinished ...>

and the code:

        /* guarantee that the udev daemon isn't pre-processing */
        if (getuid() == 0) {
                struct udev_ctrl *uctrl;

                uctrl = udev_ctrl_new_from_socket(udev,
UDEV_CTRL_SOCK_PATH);
                if (uctrl != NULL) {
                        sigset_t mask, oldmask;

                        sigemptyset(&mask);
                        sigaddset(&mask, SIGUSR1);
                        sigaddset(&mask, SIGALRM);
                        sigprocmask(SIG_BLOCK, &mask, &oldmask);
                        if (udev_ctrl_send_settle(uctrl) > 0)
                                sigsuspend(&oldmask);
                        sigprocmask(SIG_SETMASK, &oldmask, NULL);
                        udev_ctrl_unref(uctrl);
                }
        }

The problem here is that SIGUSR1 and SIGALRM are both blocked in oldmask
already, and never reach udevadm. No care is ever taken to ensure those
signals are not blocked.

The attached patch is one of the many possible ways to rectify the solution.

Regards,
Christian

[-- Attachment #2: udev-unblock-signals.patch --]
[-- Type: text/plain, Size: 531 bytes --]

diff -ur udev-146/udev/udevadm-settle.c udev-146.new/udev/udevadm-settle.c
--- udev-146/udev/udevadm-settle.c	2009-08-01 16:38:44.000000000 +0300
+++ udev-146.new/udev/udevadm-settle.c	2009-10-29 20:56:50.105716340 +0300
@@ -171,6 +171,8 @@
 			sigaddset(&mask, SIGUSR1);
 			sigaddset(&mask, SIGALRM);
 			sigprocmask(SIG_BLOCK, &mask, &oldmask);
+			sigdelset(&oldmask, SIGUSR1);
+			sigdelset(&oldmask, SIGALRM);
 			if (udev_ctrl_send_settle(uctrl) > 0)
 				sigsuspend(&oldmask);
 			sigprocmask(SIG_SETMASK, &oldmask, NULL);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: udevadm settle (udev 146) & pam-mount (1.32) via mount
  2009-10-29 18:15 udevadm settle (udev 146) & pam-mount (1.32) via mount (util-linux-ng Christian P. Schmidt
@ 2009-10-30 13:28 ` Kay Sievers
  2009-10-30 15:33 ` udevadm settle (udev 146) & pam-mount (1.32) via mount (util-linux-ng Christian Schmidt
  2009-11-02 11:51 ` udevadm settle (udev 146) & pam-mount (1.32) via mount Kay Sievers
  2 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2009-10-30 13:28 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Oct 29, 2009 at 19:15, Christian P. Schmidt <schmidt@digadd.de> wrote:

> The problem here is that SIGUSR1 and SIGALRM are both blocked in oldmask
> already, and never reach udevadm. No care is ever taken to ensure those
> signals are not blocked.
>
> The attached patch is one of the many possible ways to rectify the solution.

Oh, I see. I guess, we should just unblock these both signals right at
the time we install the signal handler?

Thanks,
Kay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: udevadm settle (udev 146) & pam-mount (1.32) via mount  (util-linux-ng
  2009-10-29 18:15 udevadm settle (udev 146) & pam-mount (1.32) via mount (util-linux-ng Christian P. Schmidt
  2009-10-30 13:28 ` udevadm settle (udev 146) & pam-mount (1.32) via mount Kay Sievers
@ 2009-10-30 15:33 ` Christian Schmidt
  2009-11-02 11:51 ` udevadm settle (udev 146) & pam-mount (1.32) via mount Kay Sievers
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Schmidt @ 2009-10-30 15:33 UTC (permalink / raw)
  To: linux-hotplug

Kay Sievers wrote:
> On Thu, Oct 29, 2009 at 19:15, Christian P. Schmidt <schmidt@digadd.de> wrote:
> 
>> The problem here is that SIGUSR1 and SIGALRM are both blocked in oldmask
>> already, and never reach udevadm. No care is ever taken to ensure those
>> signals are not blocked.
>>
>> The attached patch is one of the many possible ways to rectify the solution.
> 
> Oh, I see. I guess, we should just unblock these both signals right at
> the time we install the signal handler?

That would probably be the most correct solution, indeed.

Regards,
Christian

> Thanks,
> Kay


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: udevadm settle (udev 146) & pam-mount (1.32) via mount
  2009-10-29 18:15 udevadm settle (udev 146) & pam-mount (1.32) via mount (util-linux-ng Christian P. Schmidt
  2009-10-30 13:28 ` udevadm settle (udev 146) & pam-mount (1.32) via mount Kay Sievers
  2009-10-30 15:33 ` udevadm settle (udev 146) & pam-mount (1.32) via mount (util-linux-ng Christian Schmidt
@ 2009-11-02 11:51 ` Kay Sievers
  2 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2009-11-02 11:51 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Oct 30, 2009 at 16:33, Christian Schmidt <schmidt@digadd.de> wrote:
> Kay Sievers wrote:
>> On Thu, Oct 29, 2009 at 19:15, Christian P. Schmidt <schmidt@digadd.de> wrote:
>>
>>> The problem here is that SIGUSR1 and SIGALRM are both blocked in oldmask
>>> already, and never reach udevadm. No care is ever taken to ensure those
>>> signals are not blocked.
>>>
>>> The attached patch is one of the many possible ways to rectify the solution.
>>
>> Oh, I see. I guess, we should just unblock these both signals right at
>> the time we install the signal handler?
>
> That would probably be the most correct solution, indeed.

I've added this now:
  http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff;h¼3ec7bd45814a75845529fd0aca5c5a9d9f0c14

Thanks,
Kay

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-02 11:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-29 18:15 udevadm settle (udev 146) & pam-mount (1.32) via mount (util-linux-ng Christian P. Schmidt
2009-10-30 13:28 ` udevadm settle (udev 146) & pam-mount (1.32) via mount Kay Sievers
2009-10-30 15:33 ` udevadm settle (udev 146) & pam-mount (1.32) via mount (util-linux-ng Christian Schmidt
2009-11-02 11:51 ` udevadm settle (udev 146) & pam-mount (1.32) via mount Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).