Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure due to not correctly determining getpwnam_r #11

Closed
quanah opened this issue Dec 7, 2016 · 6 comments
Closed

Build failure due to not correctly determining getpwnam_r #11

quanah opened this issue Dec 7, 2016 · 6 comments

Comments

@quanah
Copy link
Contributor

quanah commented Dec 7, 2016

Building cyrus-sasl HEAD linking to the latest Heimdal 7.0.1 results in:

<command-line>:0:0: note: this is the location of the previous definition
auth_shadow.c: In function 'auth_shadow':
auth_shadow.c:151:5: error: too few arguments to function 'getpwnam_r'
     pw = getpwnam_r(login, &pwbuf, pwdata, sizeof(pwdata));
     ^
In file included from auth_shadow.c:49:0:
/usr/include/pwd.h:150:12: note: declared here
 extern int getpwnam_r (const char *__restrict __name,
            ^
auth_shadow.c:185:5: error: too few arguments to function 'getspnam_r'
     sp = getspnam_r(login, &spbuf, spdata, sizeof(spdata));
     ^
In file included from auth_shadow.c:73:0:
/usr/include/shadow.h:123:12: note: declared here
 extern int getspnam_r (const char *__name, struct spwd *__result_buf,
            ^
@quanah
Copy link
Contributor Author

quanah commented Dec 7, 2016

Note: Building on CentOS 7

@quanah
Copy link
Contributor Author

quanah commented Dec 7, 2016

Root problem appears to be that GETXXNAM_R_5ARG in config.h or anywhere else, which causes the wrong form to be used on systems where it takes 5 ARGS

@quanah
Copy link
Contributor Author

quanah commented Dec 7, 2016

Putting -DGETXXNAM_R_5ARG in my CFLAGS allowed the build to proceed. This definitely needs to be part of a configure check though.

@quanah quanah changed the title Unable to build with Heimdal 7.0.1 Build failure due to not correctly determining getpwnam_r Dec 9, 2016
@ksmurchison
Copy link
Contributor

Can you try this patch? Looks like this test was lost when we removed saslauthd/configure.in

configure.5arg.diff.txt

@quanah
Copy link
Contributor Author

quanah commented Dec 9, 2016

Worked with this patch applied, thanks.

@ksmurchison
Copy link
Contributor

Fixed with 400e0fe

azat added a commit to azat-ch/cyrus-sasl that referenced this issue Apr 27, 2021
MSan reports [1]:

    Uninitialized bytes in __interceptor_getaddrinfo at offset 20 inside [0x7febe03d1ec0, 48)
    ==7==WARNING: MemorySanitizer: use-of-uninitialized-value
        #0 0x3bcc351d in get_fqhostname obj-x86_64-linux-gnu/../contrib/cyrus-sasl/lib/saslutil.c:548:9
        ClickHouse#1 0x3bcf6e7f in sasl_client_new obj-x86_64-linux-gnu/../contrib/cyrus-sasl/lib/client.c:515:7
        cyrusimap#2 0x3bb91c19 in rd_kafka_sasl_cyrus_client_new obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_sasl_cyrus.c:500:13
        cyrusimap#3 0x3bacfd9d in rd_kafka_sasl_client_new obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_sasl.c:265:13
        cyrusimap#4 0x3b689f83 in rd_kafka_broker_connect_auth obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_broker.c:2263:8
        cyrusimap#5 0x3b6a4075 in rd_kafka_broker_handle_SaslHandshake obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_broker.c:2199:2
        cyrusimap#6 0x3b70c8e3 in rd_kafka_buf_callback obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_buf.c:480:17
        cyrusimap#7 0x3b681189 in rd_kafka_req_response obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_broker.c:1775:9
        cyrusimap#8 0x3b681189 in rd_kafka_recv obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_broker.c:1893:3
        cyrusimap#9 0x3bb18ff2 in rd_kafka_transport_io_event obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_transport.c:742:11
        cyrusimap#10 0x3bb18ff2 in rd_kafka_transport_io_serve obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_transport.c:801:17
        cyrusimap#11 0x3b6bd7b3 in rd_kafka_broker_ops_io_serve obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_broker.c:3380:21
        cyrusimap#12 0x3b6adb2d in rd_kafka_broker_consumer_serve obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_broker.c:4961:17
        cyrusimap#13 0x3b6adb2d in rd_kafka_broker_serve obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_broker.c:5066:17
        cyrusimap#14 0x3b694799 in rd_kafka_broker_thread_main obj-x86_64-linux-gnu/../contrib/librdkafka/src/rdkafka_broker.c:5208:25
        cyrusimap#15 0x3bb86676 in _thrd_wrapper_function obj-x86_64-linux-gnu/../contrib/librdkafka/src/tinycthread.c:576:9
        cyrusimap#16 0x7fecf4eaf608 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x9608)
        cyrusimap#17 0x7fecf4dd6292 in clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)

      Uninitialized value was created by an allocation of 'hints' in the stack frame of function 'get_fqhostname'
        #0 0x3bcc31b0 in get_fqhostname obj-x86_64-linux-gnu/../contrib/cyrus-sasl/lib/saslutil.c:523

    SUMMARY: MemorySanitizer: use-of-uninitialized-value obj-x86_64-linux-gnu/../contrib/cyrus-sasl/lib/saslutil.c:548:9 in get_fqhostname

  [1]: https://clickhouse-test-reports.s3.yandex.net/0/f7edcdf7c847f7d45ceede4a6073400ec2c985b7/integration_tests_(memory).html

Note that we can use __msan_unpoison() instead, but this function does
not looks hot, so it does not worth the complexity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants