public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/33548]  New: Core dump on HPUX
@ 2007-09-24 23:16 zhou_dx at yahoo dot com
  2007-10-01  1:58 ` [Bug target/33548] " ajd at gentrack dot com
  2008-08-06 20:29 ` sje at cup dot hp dot com
  0 siblings, 2 replies; 3+ messages in thread
From: zhou_dx at yahoo dot com @ 2007-09-24 23:16 UTC (permalink / raw)
  To: gcc-bugs

I am getting a core dump with a program compiled with gcc-4.1.2 (64bit). The
program crashed inside the function call pam_authenticate.

The program uses the pam library and is compiled by the following command:

gcc-4.1.2/bin/gcc -mlp64 pam_test.c -lpam -o pt

-bash-3.00$ ldd pt
        libpam.so.1 =>  /lib/hpux64/libpam.so.1
        libunwind.so.1 =>       /lib/hpux64/libunwind.so.1
        libc.so.1 =>    /lib/hpux64/libc.so.1
        libuca.so.1 =>  /usr/lib/hpux64/libuca.so.1
        libdl.so.1 =>   /usr/lib/hpux64/libdl.so.1

If compiled with 32bit, the program works fine.
gcc-4.1.2/bin/gcc pam_test.c -lpam -o pt

-bash-3.00$ ldd pt
  libpam.so.1 =>  /usr/lib/hpux32/libpam.so.1
        libunwind.so.1 =>       /usr/lib/hpux32/libunwind.so.1
        libc.so.1 =>    /usr/lib/hpux32/libc.so.1
        libuca.so.1 =>  /usr/lib/hpux32/libuca.so.1
        libdl.so.1 =>   /usr/lib/hpux32/libdl.so.1

When compiled using gcc-3.4, it works fine on both 64 and 32 bit.
-bash-3.00$ gcc-3.4/bin/gcc -mlp64 pam_test.c -lpam -o pt
-bash-3.00$ ldd pt
        libpam.so.1 =>  /lib/hpux64/libpam.so.1
        libc.so.1 =>    /lib/hpux64/libc.so.1
        libdl.so.1 =>   /usr/lib/hpux64/libdl.so.1

We built gcc-4.1.2 from the source with the following configuration and with
binutil-2.17. 

Configured with: /home/gcc-4.1.2/configure --prefix=/usr/local/gcc-4.1.2
--enable-languages=c,c++ --enable-threads=posix --with-gnu-as --without-gnu-ld
--with-as=/usr/local/gcc-4.1.2/bin/as

Is this likely a gcc bug? 
---------------------------------------------------------
#include <pwd.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <security/pam_appl.h>

const char *PAM_username = "guest";
const char *PAM_password = "guest";

static int PAM_conv (int num_msg, struct pam_message **msg,
        struct pam_response **resp, void *appdata_ptr)
{
        struct pam_response *repl = NULL;
        int count = 0, replies = 0;
        int size = sizeof(struct pam_response);

        printf("In PAM_conv:num_msg:%i\n",num_msg);
        for(count = 0; count < num_msg; count++) {
                switch(msg[0]->msg_style) {
                case PAM_PROMPT_ECHO_ON:
                        printf("PAM_conv:PAM_PROMPT_ECHO_ON\n");

                        if (!(repl = (struct pam_response*)realloc(repl,
size))) {
                                return PAM_CONV_ERR; 
                        }
                        size += sizeof(struct pam_response);
                        repl[replies].resp_retcode = PAM_SUCCESS;
                        repl[replies].resp = strdup(PAM_username);
                        replies++;
                        break;
                case PAM_PROMPT_ECHO_OFF:
                        printf("PAM_conv:PAM_PROMPT_ECHO_OFF\n");
                        if (!(repl = (struct pam_response*)realloc(repl,
size))) {
                                return PAM_CONV_ERR; 
                        }
                        size += sizeof(struct pam_response);
                        repl[replies].resp_retcode = PAM_SUCCESS;
                        repl[replies].resp = strdup(PAM_password);
                        break;
                default:
                        break;
                }
        }
        if (repl) {
                *resp = repl;
        }
        return PAM_SUCCESS;
}

int main()
{
        static struct pam_conv conv = {
                 &PAM_conv,
                 NULL
        };
        pam_handle_t *pamh = NULL;
        int retval;
        retval = pam_start("su", PAM_username, &conv, &pamh);
        if (retval != PAM_SUCCESS)
                printf("pam_start() failed.\n");
printf("authenticate--- do not crash\n");
        retval = pam_authenticate(pamh, 0);
printf("authenticate-- \n");
        if (retval != PAM_SUCCESS) {
                printf("PAM authentication failed.\n");
        } else {
                printf("PAM authentication OK.\n");
        }
        pam_end(pamh, PAM_SUCCESS);
        return 1;
}


-- 
           Summary: Core dump on HPUX
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zhou_dx at yahoo dot com
GCC target triplet: ia64-hp-hpux11.23


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33548


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/33548] Core dump on HPUX
  2007-09-24 23:16 [Bug c/33548] New: Core dump on HPUX zhou_dx at yahoo dot com
@ 2007-10-01  1:58 ` ajd at gentrack dot com
  2008-08-06 20:29 ` sje at cup dot hp dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ajd at gentrack dot com @ 2007-10-01  1:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ajd at gentrack dot com  2007-10-01 01:58 -------
Compile with -Wl,-Z and it succeeds:
gcc-4.1.2/bin/gcc -mlp64 pam_test.c -lpam -o pt -Wl,-Z

It appears libpam on hpux requires -Z.

It was removed here:
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00542.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33548


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/33548] Core dump on HPUX
  2007-09-24 23:16 [Bug c/33548] New: Core dump on HPUX zhou_dx at yahoo dot com
  2007-10-01  1:58 ` [Bug target/33548] " ajd at gentrack dot com
@ 2008-08-06 20:29 ` sje at cup dot hp dot com
  1 sibling, 0 replies; 3+ messages in thread
From: sje at cup dot hp dot com @ 2008-08-06 20:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from sje at cup dot hp dot com  2008-08-06 20:28 -------
I am resolving this as invalid since it is not a GCC bug (unless you consider
not using -Z to be a bug).  There is a patch for libpam which should fix the
null pointer reference available from HP.  It is HP patch PHCO_37076.


-- 

sje at cup dot hp dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33548


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-06 20:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-24 23:16 [Bug c/33548] New: Core dump on HPUX zhou_dx at yahoo dot com
2007-10-01  1:58 ` [Bug target/33548] " ajd at gentrack dot com
2008-08-06 20:29 ` sje at cup dot hp dot com

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 read-only IMAP folder(s) and NNTP newsgroup(s).