Bug 596255 - cryptsetup: semop failed for cookie, incorrect semaphore state
cryptsetup: semop failed for cookie, incorrect semaphore state
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: device-mapper (Show other bugs)
6.0
All Linux
low Severity medium
: rc
: ---
Assigned To: Peter Rajnoha
Release Test Team
:
: 606807 (view as bug list)
Depends On:
Blocks: 582286
  Show dependency treegraph
 
Reported: 2010-05-26 09:23 EDT by Jan Stodola
Modified: 2014-03-20 03:48 EDT (History)
16 users (show)

See Also:
Fixed In Version: lvm2-2.02.66-3.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-07-02 14:57:59 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jan Stodola 2010-05-26 09:23:12 EDT
Description of problem:
When working with cryptsetup on s390x, error messages are displayed:

[root@rtt6 ~]# cryptsetup luksClose test
semid 622592: semop failed for cookie 0xd4da050: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223191120 (0xd4da050) to initialize waiting for incoming notifications.

The same error you can see if you perform installation on s390x with encrypted device(s). Error message is shown when user enter passphrase to unlock encrypted device. It doesn't seem to have any impact on functionality, system boots.


Version-Release number of selected component (if applicable):
RHEL6.0-20100523.0
cryptsetup-luks-1.1.1-0.2.el6.s390x.rpm 
kernel-2.6.32-28.el6.s390x.rpm 

How reproducible:
always

Steps to Reproduce:

[root@rtt6 ~]# dd if=/dev/zero of=file bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB) copied, 2.05507 s, 51.0 MB/s
[root@rtt6 ~]# losetup /dev/loop0 file 
[root@rtt6 ~]# cryptsetup luksFormat /dev/loop0 

WARNING!
========
This will overwrite data on /dev/loop0 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase: 
Verify passphrase: 
semid 491520: semop failed for cookie 0xd4dd77a: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223205242 (0xd4dd77a) to initialize waiting for incoming notifications.
[root@rtt6 ~]# cryptsetup luksOpen /dev/loop0 test
Enter passphrase for /dev/loop0: 
semid 557056: semop failed for cookie 0xd4d8a1e: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223185438 (0xd4d8a1e) to initialize waiting for incoming notifications.
Key slot 0 unlocked.
[root@rtt6 ~]# cryptsetup luksClose test
semid 622592: semop failed for cookie 0xd4da050: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223191120 (0xd4da050) to initialize waiting for incoming notifications.
  
Actual results:
semid 622592: semop failed for cookie 0xd4da050: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223191120 (0xd4da050) to initialize waiting for incoming notifications.

Expected results:
no error message
Comment 1 Martin Banas 2010-05-26 09:36:05 EDT
The same result on PPC64 with build RHEL6.0-20100523.0. Changing architecture to ALL.

Password [/dev/sda3 (luks-a68...)]::*********
semid 32768: semop failed for cookie 0xd4dd5dc: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223204828 (0xd4dd5dc) to initialize waiting for incoming notifications.
Key slot 0 unlocked.
semid 131072: semop failed for cookie 0xd4d666c: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223176300 (0xd4d666c) to initialize waiting for incoming notifications.
Key slot 0 unlocked.
semid 229376: semop failed for cookie 0xd4dca38: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223201848 (0xd4dca38) to initialize waiting for incoming notifications.
Key slot 0 unlocked.
Comment 2 RHEL Product and Program Management 2010-05-26 09:38:38 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.
Comment 3 Milan Broz 2010-05-26 09:43:59 EDT
This is probably underlying device-mapper issue. Peter?
Comment 4 Milan Broz 2010-05-26 09:46:48 EDT
(Just to be sure - it works on i386 & x86_64, right?)
Comment 5 Martin Banas 2010-05-26 09:57:54 EDT
[root@ibm-js22-vios-01-lp2 ~]# cryptsetup luksOpen /dev/loop0 test --debug
# cryptsetup 1.1.1-rc2 processing "cryptsetup luksOpen /dev/loop0 test --debug"
# Locking memory.
# Allocating crypt device /dev/loop0 context.
# Trying to open and read device /dev/loop0.
# Initialising device-mapper backend, UDEV is enabled.
# Detected dm-crypt target of version 1.7.0.
# Timeout set to 0 miliseconds.
# Password retry count set to 3.
# Iteration time set to 1000 miliseconds.
# Password verification disabled.
# Trying to load LUKS1 crypt type from device /dev/loop0.
# Initializing crypto backend (using secure memory).
# Reading LUKS header of size 1024 from device /dev/loop0
# Activating volume test [keyslot -1] using [none] passphrase.
# dm status test  OF   [16384]
Enter passphrase for /dev/loop0: 
# Trying to open key slot 0 [3].
# Reading key slot 0 area.
# DM-UUID is CRYPT-TEMP-temporary-cryptsetup-4615
# Udev cookie 0xd4d8ace (semid 720896) created
# Udev cookie 0xd4d8ace (semid 720896) incremented
# Udev cookie 0xd4d8ace (semid 720896) incremented
# Udev cookie 0xd4d8ace (semid 720896) assigned to dm_task type 0 with flags 0xe
# dm create temporary-cryptsetup-4615 CRYPT-TEMP-temporary-cryptsetup-4615 OF   [16384]
# temporary-cryptsetup-4615: Stacking NODE_ADD (253,6) 0:6 0660
# dm reload temporary-cryptsetup-4615  OF   [16384]
# dm resume temporary-cryptsetup-4615  OF   [16384]
# temporary-cryptsetup-4615: Stacking NODE_READ_AHEAD 256 (flags=1)
# Udev cookie 0xd4d8ace (semid 720896) decremented
# Udev cookie 0xd4d8ace (semid 720896): Waiting for zero
# Udev cookie 0xd4d8ace (semid 720896) destroyed
# /dev/mapper/temporary-cryptsetup-4615 not set up by udev: Falling back to direct node creation.
# Created /dev/mapper/temporary-cryptsetup-4615
# Setting SELinux context for /dev/mapper/temporary-cryptsetup-4615 to system_u:object_r:fixed_disk_device_t:s0.
# temporary-cryptsetup-4615: read ahead is 256
# temporary-cryptsetup-4615: Setting read ahead to 256
# Udev cookie 0xd4dfe17 (semid 753664) created
# Udev cookie 0xd4dfe17 (semid 753664) incremented
# Udev cookie 0xd4dfe17 (semid 753664) incremented
# Udev cookie 0xd4dfe17 (semid 753664) assigned to dm_task type 2 with flags 0x0
# dm remove temporary-cryptsetup-4615  OF   [16384]
# temporary-cryptsetup-4615: Stacking NODE_DEL (replaces other stacked ops)
semid 753664: semop failed for cookie 0xd4dfe17: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223215127 (0xd4dfe17) to initialize waiting for incoming notifications.
# Udev cookie 0xd4dfe17 (semid 753664) destroyed
Key slot 0 unlocked.
# Calculated device size is 202744 sectors (RW), offset 2056.
# DM-UUID is CRYPT-LUKS1-338aa9a1350e4ba6b8fbed7d0e7b57e7-test
# Udev cookie 0xd4d1800 (semid 786432) created
# Udev cookie 0xd4d1800 (semid 786432) incremented
# Udev cookie 0xd4d1800 (semid 786432) incremented
# Udev cookie 0xd4d1800 (semid 786432) assigned to dm_task type 0 with flags 0x0
# dm create test CRYPT-LUKS1-338aa9a1350e4ba6b8fbed7d0e7b57e7-test OF   [16384]
# test: Stacking NODE_ADD (253,6) 0:6 0660
# dm reload test  OF   [16384]
# dm resume test  OF   [16384]
# test: Stacking NODE_READ_AHEAD 256 (flags=1)
# Udev cookie 0xd4d1800 (semid 786432) decremented
# Udev cookie 0xd4d1800 (semid 786432): Waiting for zero
# Udev cookie 0xd4d1800 (semid 786432) destroyed
# /dev/mapper/test not set up by udev: Falling back to direct node creation.
# Created /dev/mapper/test
# Setting SELinux context for /dev/mapper/test to system_u:object_r:fixed_disk_device_t:s0.
# test: read ahead is 256
# test: Setting read ahead to 256
# Releasing crypt device /dev/loop0 context.
# Releasing device-mapper backend.
# Unlocking memory.
Command successful.
Comment 6 Milan Broz 2010-05-26 10:02:12 EDT
(In reply to comment #5)

> # /dev/mapper/temporary-cryptsetup-4615 not set up by udev: Falling back to
> direct node creation.
> # Created /dev/mapper/temporary-cryptsetup-4615
> # Setting SELinux context for /dev/mapper/temporary-cryptsetup-4615 to

> # /dev/mapper/test not set up by udev: Falling back to direct node creation.
> # Created /dev/mapper/test
> # Setting SELinux context for /dev/mapper/test to

... udev/device-mapper issue, reassigning to device-mapper.
Comment 7 Peter Rajnoha 2010-05-27 11:20:12 EDT
During initialisation of the semaphores we use for udev synchronisation, we set a certain initial semaphore value that is also expected at the end of the synchronisation. This value was not initialised correctly due to incorrect definition of semctl's arguments ending up with the error messages reported.

We should use standard "union semun" for all semctl operations that expect additional arguments, not just a direct value. Otherwise problems like these can appear on some architectures because of misalignment of the arguments.

The fix is in the upstream now...
Comment 9 Milan Broz 2010-06-22 10:40:59 EDT
*** Bug 606807 has been marked as a duplicate of this bug. ***
Comment 10 Jan Stodola 2010-06-25 04:27:35 EDT
Tested on build RHEL6.0-20100622.1 with lvm2-2.02.66-3.el6, architectures: x86_64, ppc64, s390x, this issue is fixed.

Moving to VERIFIED.
Comment 12 releng-rhel@redhat.com 2010-07-02 14:57:59 EDT
Red Hat Enterprise Linux Beta 2 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.
Comment 13 Sami Farin 2014-03-20 03:48:20 EDT
having this problem. kernel 3.14.0-rc7-g4907cdca+, device-mapper 1.02.82-5.fc20, systemd-208-15.fc20

# cryptsetup -h sha256 -i 3000 -s 512 luksFormat /dev/sdd4

WARNING!
========
This will overwrite data on /dev/sdd4 irrevocably.

Are you sure? (Type uppercase yes): YES
Enter passphrase: 
Verify passphrase: 
semid 294912: semop failed for cookie 0xd4dcdb0: incorrect semaphore state
Failed to set a proper state for notification semaphore identified by cookie value 223202736 (0xd4dcdb0) to initialize waiting for incoming notifications.

Note You need to log in before you can comment on or make changes to this bug.