Need audience libopenssl/libc memory error

I have following backtrace:


#0 X509_VERIFY_PARAM_new() at /lib64/libcrypto.so.1.0.0
#1 X509_STORE_new() at /lib64/libcrypto.so.1.0.0
#2 SSL_CTX_new() at /lib64/libssl.so.1.0.0
#3 init_server() at /home/slawomir/Dokumenty/Projekty/Aplikacje tao/tao-multishell.c/network.c:558
#4 create_job() at /home/slawomir/Dokumenty/Projekty/Aplikacje tao/tao-multishell.c/job.c:128
#5 new_job() at /home/slawomir/Dokumenty/Projekty/Aplikacje tao/tao-multishell.c/gui.c:40
#6 signal_wrapper_clicked() at /usr/local/lib64/mWidgets_modules/tao-gtk.so.1.0
#7 ??() at /usr/lib64/libgobject-2.0.so.0
#8 g_signal_emit_valist() at /usr/lib64/libgobject-2.0.so.0
#9 g_signal_emit() at /usr/lib64/libgobject-2.0.so.0
#10 ??() at /usr/lib64/libgtk-x11-2.0.so.0
#11 g_closure_invoke() at /usr/lib64/libgobject-2.0.so.0
#12 ??() at /usr/lib64/libgobject-2.0.so.0
#13 g_signal_emit_valist() at /usr/lib64/libgobject-2.0.so.0
#14 g_signal_emit() at /usr/lib64/libgobject-2.0.so.0
#15 ??() at /usr/lib64/libgtk-x11-2.0.so.0
#16 ??() at /usr/lib64/libgtk-x11-2.0.so.0
#17 g_closure_invoke() at /usr/lib64/libgobject-2.0.so.0
#18 ??() at /usr/lib64/libgobject-2.0.so.0
#19 g_signal_emit_valist() at /usr/lib64/libgobject-2.0.so.0
#20 g_signal_emit() at /usr/lib64/libgobject-2.0.so.0

Line ctx= SSL_CTX_new(SSLv23_method()); writes into memory of my structure allocated by alloc.



#pragma pack(1)
struct client_data {
  struct task *first_task;
  struct file_transfer *first_file_transfer;
  int buffer_position;
  int bytes_read;
  BIO *server_connection;
  struct network_client_window *first_window;
  struct icon_list *first_icon;
  struct icon_group_list *first_icon_group;
  struct network_send_file *first_file_to_send;
  char is_header_to_download;
  struct message_header header;
  uint8_t buffer[70000];
  uint64_t to_download;
  uint64_t downloaded;
  uint8_t *location;
  uint8_t state;
  struct client_data *next;
};
#pragma pack()

struct mus_network_data {
  struct client_data *first_client, *last_client, *prev_client, *curr_client;
  BIO *server_connection;
}

struct job {

  long long int job_number;
  pid_t  pid;
  struct mus_network_data network_connections;
  const char *command_prompt;
  struct job *next;
};

Here’s how I allocate memory for my structure:


 struct job *job = (struct job*) malloc(sizeof(*job));

Thanks for help with solving error in my program or in send bug information.

Another bug I found is segfault while doing BIO_pop. BIO_pop are called after BIO_do_accept returns value greater than 0.

I find that gdb puts asterix character after current thread information in show threads table. Current thread (once sigsef is catched) is thread of gtk and executes writev. I have multicore processor(as anybody). Is that bug in my program/OpenSSL or GTK+?

I have read using libcrypto(part of openssl) was horrible. I doesn’t full support multithreading and there’s forking problem.

Ok. I have found issue. The problem was in lock function of openssl. I was used outdated/deprecated lock function.

Another mistake is in wait function. I have created structure containing pid, which I was set to minus 1. I also ran wait in another thread. Because there’s no child process, wait returns minus one and I was removing structure containing some application data.

Thanks.