Bug 1196028 - libgfapi: glfs_init() hangs on pthread_cond_wait() when user is non-root
Summary: libgfapi: glfs_init() hangs on pthread_cond_wait() when user is non-root
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: GlusterFS
Classification: Community
Component: libgfapi
Version: mainline
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
Assignee: Vijay Bellur
QA Contact: Sudhir D
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-25 06:36 UTC by Prashanth Pai
Modified: 2019-05-07 14:48 UTC (History)
6 users (show)

Fixed In Version: glusterfs-6.x
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-07 14:48:50 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)
Sample code to be run as non-root (559 bytes, text/x-csrc)
2015-02-25 06:36 UTC, Prashanth Pai
no flags Details

Description Prashanth Pai 2015-02-25 06:36:06 UTC
Created attachment 994997 [details]
Sample code to be run as non-root

glfs_init() hangs on pthread_cond_wait() when user is non-root

Steps to Reproduce:
$ gcc try.c -I /usr/local/include/glusterfs/ -lgfapi -O0 -ggdb
$ ./a.out

Trace:
Program received signal SIGINT, Interrupt.
0x00007ffff68d7ca0 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
Missing separate debuginfos, use: debuginfo-install glibc-2.18-16.fc20.x86_64 keyutils-libs-1.5.9-1.fc20.x86_64 krb5-libs-1.11.5-11.fc20.x86_64 libcom_err-1.42.8-3.fc20.x86_64 libselinux-2.2.1-6.fc20.x86_64 openssl-libs-1.0.1e-41.fc20.x86_64 pcre-8.33-8.fc20.x86_64 sssd-client-1.11.7-2.fc20.x86_64 xz-libs-5.1.2-12alpha.fc20.x86_64 zlib-1.2.8-3.fc20.x86_64
(gdb) bt
#0  0x00007ffff68d7ca0 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007ffff7bc6cc2 in glfs_lock (fs=0x630b80) at glfs-internal.h:214
#2  0x00007ffff7bc7fb6 in glfs_init_wait (fs=0x630b80) at glfs.c:703
#3  0x00007ffff7bc82a7 in pub_glfs_init (fs=0x630b80) at glfs.c:809
#4  0x00000000004009d3 in main (argc=1, argv=0x7fffffffdee8) at try.c:20
(gdb) 


Expected results:
Should error out gracefully

Comment 1 Niels de Vos 2015-03-03 12:38:23 UTC
The issue does not occur when the server.allow-insecure and rpc-allow-insecure options are set. Without these options, the gfapi application will not be allowed to connect from ports > 1024. Only root can bind() to ports < 1024, running a gfapi application as non-root uses ports > 1024.

Possibly http://review.gluster.org/7405 contains a way to catch the error and report the problem back to the application.

Comment 2 Prashanth Pai 2015-03-04 12:10:22 UTC
Yes Niels, that's true. I wouldn't expect a hang though. Ideally, glfs_init() should return -1 with errno set to EPERM (or something)

Comment 3 Niels de Vos 2015-03-04 22:10:37 UTC
(In reply to Prashanth Pai from comment #2)
> Yes Niels, that's true. I wouldn't expect a hang though. Ideally,
> glfs_init() should return -1 with errno set to EPERM (or something)

Yes, most definitely!

Comment 4 Amar Tumballi 2019-05-07 14:48:50 UTC
Tried glfsxmp.c as a non-user, and things are working fine with glusterfs-6.x


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