[linux-lvm] lvcreate from a setuid-root binary

Christoph Pleger christoph.pleger at cs.uni-dortmund.de
Mon Nov 19 15:35:40 UTC 2018


Hello,

On 2018-11-15 17:39, Christoph Pleger wrote:

> Unfortunately - though these UIDs are all set to 0 - lvcreate still
> does not work for me. That is, it does work when I call my
> setuid-binary as a non-root user from the command line, but it does
> not work when I call my setuid-binary from PAM module pam_exec - and
> that is what I need my program for. I let my program send lvcreate
> output to a file and that file has the following content:
> 
>  device-mapper: version ioctl on  failed: Permission denied
>   Incompatible libdevmapper 1.02.137 (2016-11-30) and kernel driver
> (unknown version).
>   striped: Required device-mapper target(s) not detected in your 
> kernel.
>   Run `lvcreate --help' for more information.
> 
> What might be the problem here so that lvcreate gives these errors
> though all UIDs are 0?

No matter if I use that setuid-mechanism in the end or not, I would 
still like to know why it does not work as-is with lvcreate. :-)

I guess that the error message "device-mapper: version ioctl on  failed: 
Permission denied" comes from the following lines in LVM's 
libdm/ioctl/libdm-iface.c:


if (_log_suppress || dmt->ioctl_errno == EINTR)
         log_verbose("device-mapper: %s ioctl on %s%s%s%.0d%s%.0d%s%s "
                     "failed: %s",
                     _cmd_data_v4[dmt->type].name,
                     dmi->name, dmi->uuid,
                     dmt->major > 0 ? "(" : "",
                     dmt->major > 0 ? dmt->major : 0,
                     dmt->major > 0 ? ":" : "",
                     dmt->minor > 0 ? dmt->minor : 0,
                     dmt->major > 0 && dmt->minor == 0 ? "0" : "",
                     dmt->major > 0 ? ")" : "",
                     strerror(dmt->ioctl_errno));
else
         log_error("device-mapper: %s ioctl on %s%s%s%.0d%s%.0d%s%s "
                   "failed: %s",
                   _cmd_data_v4[dmt->type].name,
                   dmi->name, dmi->uuid,
                   dmt->major > 0 ? "(" : "",
                   dmt->major > 0 ? dmt->major : 0,
                   dmt->major > 0 ? ":" : "",
                   dmt->minor > 0 ? dmt->minor : 0,
                   dmt->major > 0 && dmt->minor == 0 ? "0" : "",
                   dmt->major > 0 ? ")" : "",
                   strerror(dmt->ioctl_errno));

But somehow, the values are empty ...

Regards
   Christoph




More information about the linux-lvm mailing list