linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christian P. Schmidt" <schmidt@digadd.de>
To: linux-hotplug@vger.kernel.org
Subject: udevadm settle (udev 146) & pam-mount (1.32) via mount (util-linux-ng
Date: Thu, 29 Oct 2009 18:15:47 +0000	[thread overview]
Message-ID: <4AE9DBD3.6090602@digadd.de> (raw)

[-- 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);

             reply	other threads:[~2009-10-29 18:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29 18:15 Christian P. Schmidt [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AE9DBD3.6090602@digadd.de \
    --to=schmidt@digadd.de \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).