On Sat, Feb 28, 2004 at 01:45:52PM -0800, Matt Zimmerman wrote: > On Sat, Feb 28, 2004 at 11:57:58AM -0600, Steve Langasek wrote: > > I know that evms 1.2 had problems such as this, where some unfortunate > > casts resulted in 64-bit values being written to the address of a 32-bit > > field. I'm not currently using evms on alpha, but I can probably dig up > > some patches to see whether they still apply to evms 2.2. > > This ought to be filed as a grave bug against the Debian package, FWIW. > This is #235328 now, and if you have any insight or patches, by all means > send them to the BTS. Ok, I resurrected the retired box long enough to pull my code changes off of it, and sure enough, evms 2.2 has a 64-bit bug in the same place as the evms 1.2 codebase. This time I did a search through the code to look for the same error in other parts of the code; attached is a patch which addresses all instances that I found. Apologies for not having submitted this patch long ago. FWIW, I could not reproduce the segfault in question on my current system, probably because all my disks are using BSD disklabels, which EVMS does not appear to understand; so this patch *might* not fix the segfault in question -- but odds are good that it does. If not, it might be a good idea to build the whole system with -Wcast-align once, to see what else shows up. A bit of friendly 64-bit advise to the EVMS folks: if you have an explicit data type in your code, don't substitute an arbitrary integer type for it in your declarations; and if you *do*, at least don't use an explicit cast to suppress the compiler warnings when you try to use its address. ;) Cheers, -- Steve Langasek postmodern programmer
only in patch2: unchanged: --- evms-2.2.2.orig/plugins/md/multipath.c +++ evms-2.2.2/plugins/md/multipath.c @@ -690,7 +690,7 @@ storage_object_t * object; int nr_disks; unsigned long size = -1; - int tag; + TAG tag; int index = 0; int rc = 0; int i; @@ -720,7 +720,7 @@ return EINVAL; } - while (!(rc = BlindExtractObject(objects, (TAG *)&tag, NULL, (void *)&object))) { + while (!(rc = BlindExtractObject(objects, &tag, NULL, (void *)&object))) { volume->child_object[index] = object; index ++; } only in patch2: unchanged: --- evms-2.2.2.orig/plugins/md/md_dlist.c +++ evms-2.2.2/plugins/md/md_dlist.c @@ -240,12 +240,12 @@ void empty_setup_funcs_queue(md_volume_t *vol) { - int tag; + TAG tag; md_setup_func_t *setup; GoToStartOfList(vol->setup_funcs); - while (BlindExtractObject(vol->setup_funcs, (TAG *) &tag, NULL, (void**)&setup)==0) { + while (BlindExtractObject(vol->setup_funcs, &tag, NULL, (void**)&setup)==0) { if (setup->setup_func) { setup->proceed = FALSE; setup->setup_func(vol, setup); @@ -302,7 +302,7 @@ int process_setup_funcs(storage_object_t *region) { int rc=0; - int tag; + TAG tag; md_setup_func_t *setup; md_volume_t * vol; @@ -321,7 +321,7 @@ GoToStartOfList(vol->setup_funcs); - while (!rc && BlindExtractObject(vol->setup_funcs, (TAG *) &tag, NULL, (void**)&setup)==0) { + while (!rc && BlindExtractObject(vol->setup_funcs, &tag, NULL, (void**)&setup)==0) { setup->proceed = TRUE; rc = setup->setup_func(vol, setup); EngFncs->engine_free(setup); @@ -336,7 +336,7 @@ void empty_ioctl_queue(md_volume_t *vol) { - int tag; + TAG tag; md_ioctl_pkg_t *pkg; LOG_ENTRY(); @@ -346,7 +346,7 @@ } GoToStartOfList(vol->ioctl_pkgs); - while (BlindExtractObject(vol->ioctl_pkgs, (TAG *) &tag, NULL, (void**)&pkg)==0) { + while (BlindExtractObject(vol->ioctl_pkgs, &tag, NULL, (void**)&pkg)==0) { if (pkg->callback_func) { pkg->callback_func(vol, pkg); } @@ -357,7 +357,7 @@ void free_ioctl_pkgs(md_volume_t *vol) { - int tag; + TAG tag; md_ioctl_pkg_t *pkg; LOG_ENTRY(); @@ -369,7 +369,7 @@ GoToStartOfList(vol->ioctl_cleanup); - while (BlindExtractObject(vol->ioctl_cleanup, (TAG *) &tag, NULL, (void**)&pkg)==0) { + while (BlindExtractObject(vol->ioctl_cleanup, &tag, NULL, (void**)&pkg)==0) { if (pkg->callback_func) { pkg->callback_func(vol, pkg); } @@ -451,7 +451,8 @@ evms_md_ioctl_parm_t *parm) { boolean removed = FALSE; - int rc, tag; + int rc; + TAG tag; md_ioctl_pkg_t *pkg; LOG_ENTRY(); @@ -459,7 +460,7 @@ GoToStartOfList(vol->ioctl_pkgs); do { rc = BlindGetObject(vol->ioctl_pkgs, - (TAG *)&tag, + &tag, NULL, TRUE, (ADDRESS *)&pkg); @@ -546,7 +547,7 @@ int process_md_ioctl_pkgs(storage_object_t *region) { int rc=0; - int tag; + TAG tag; void *handle; md_ioctl_pkg_t *pkg; md_volume_t * vol; @@ -563,7 +564,7 @@ GoToStartOfList(vol->ioctl_pkgs); - while (!rc && BlindExtractObject(vol->ioctl_pkgs, (TAG *) &tag, NULL, (void**)&pkg)==0) { + while (!rc && BlindExtractObject(vol->ioctl_pkgs, &tag, NULL, (void**)&pkg)==0) { switch (pkg->cmd) { case EVMS_MD_ADD: disk_info = pkg->parm.disk_info; only in patch2: unchanged: --- evms-2.2.2.orig/plugins/md/raid5_mgr.c +++ evms-2.2.2/plugins/md/raid5_mgr.c @@ -347,7 +347,7 @@ int rc = 0; storage_object_t * object = NULL; dlist_t objects; - int tag; + TAG tag; LOG_ENTRY(); if (!name) { @@ -363,7 +363,7 @@ VALID_INPUT_OBJECT, &objects); if (!rc) { - while (BlindExtractObject(objects, (TAG *) &tag, NULL, (void**)&object)==0) { + while (BlindExtractObject(objects, &tag, NULL, (void**)&object)==0) { if (!strncmp(object->name, name, EVMS_VOLUME_NAME_SIZE + 1)) { break; } @@ -395,7 +395,7 @@ storage_object_t * object; int nr_disks; unsigned long size = -1; - int tag; + TAG tag; int i, spare_disks=0, spare_index = 0, index = 0; int rc = 0; mdp_disk_t disk; @@ -433,7 +433,7 @@ return ENOMEM; } - while (!(rc = BlindExtractObject(objects, (TAG *)&tag, NULL, (void *)&object))) { + while (!(rc = BlindExtractObject(objects, &tag, NULL, (void *)&object))) { size = min(size, object->size); /* Track smallest object for super block */ volume->child_object[index] = object; index ++; @@ -872,7 +872,8 @@ int rc = 0; storage_object_t * object; dlist_t tmp_list, selected_tmp_list; - int count, i, tag; + int count, i; + TAG tag; LOG_ENTRY(); @@ -899,7 +900,7 @@ } GoToStartOfList(selected_tmp_list); - while (!BlindExtractObject(selected_tmp_list, (TAG *)&tag, NULL, (void **)&object)) { + while (!BlindExtractObject(selected_tmp_list, &tag, NULL, (void **)&object)) { LOG_DETAILS("Object %s selected, removing from spare list\n",object->name); rc = DeleteObject(tmp_list, object); if (rc) { @@ -927,7 +928,7 @@ i = 0; SET_STRING((*value_list)->value[i].s, MD_NO_SELECTION); i++; - while (BlindExtractObject(tmp_list, (TAG *) &tag, NULL, (void**)&object)==0) { + while (BlindExtractObject(tmp_list, &tag, NULL, (void**)&object)==0) { if (object->size >= min_size) { (*value_list)->value[i].s = EngFncs->engine_alloc(strlen(object->name) + 1); strcpy((*value_list)->value[i].s, object->name); only in patch2: unchanged: --- evms-2.2.2.orig/plugins/md/raid0_mgr.c +++ evms-2.2.2/plugins/md/raid0_mgr.c @@ -187,7 +187,7 @@ storage_object_t * object; int nr_disks; unsigned long size = -1; - int tag; + TAG tag; int i, spare_disks = 0, index = 0; int rc = 0; mdp_disk_t disk; @@ -221,7 +221,7 @@ return ENOMEM; } - while (!(rc = BlindExtractObject(objects, (TAG *)&tag, NULL, (void *)&object))) { + while (!(rc = BlindExtractObject(objects, &tag, NULL, (void *)&object))) { size = min(size, object->size); // track smallest object for super block volume->child_object[index] = object; index ++; only in patch2: unchanged: --- evms-2.2.2.orig/plugins/md/raid1_mgr.c +++ evms-2.2.2/plugins/md/raid1_mgr.c @@ -720,7 +720,7 @@ int rc = 0; storage_object_t * object = NULL; dlist_t objects; - int tag; + TAG tag; LOG_ENTRY(); if (!name) { @@ -736,7 +736,7 @@ VALID_INPUT_OBJECT, &objects); if (!rc) { - while (BlindExtractObject(objects, (TAG *) &tag, NULL, (void**)&object)==0) { + while (BlindExtractObject(objects, &tag, NULL, (void**)&object)==0) { if (!strncmp(object->name ,name,128)) { break; } @@ -767,7 +767,7 @@ storage_object_t * object; int nr_disks; unsigned long size = -1; - int tag; + TAG tag; int i, spare_disks=0, spare_index = 0, index = 0; int rc = 0; mdp_disk_t disk; @@ -804,7 +804,7 @@ return ENOMEM; } - while (!(rc = BlindExtractObject(objects, (TAG *)&tag, NULL, (void *)&object))) { + while (!(rc = BlindExtractObject(objects, &tag, NULL, (void *)&object))) { size = min(size, object->size); // track smallest object for super block volume->child_object[index] = object; index ++; @@ -1288,7 +1288,8 @@ int rc = 0; storage_object_t * object; dlist_t tmp_list, selected_tmp_list; - int count, i, tag; + int count, i; + TAG tag; LOG_ENTRY(); // get the list of objects to search for original volumes @@ -1314,7 +1315,7 @@ } GoToStartOfList(selected_tmp_list); - while (!BlindExtractObject(selected_tmp_list, (TAG *)&tag, NULL, (void **)&object)) { + while (!BlindExtractObject(selected_tmp_list, &tag, NULL, (void **)&object)) { LOG_DETAILS("Object %s selected, removing from spare list\n",object->name); rc = DeleteObject(tmp_list, object); if (rc) { @@ -1341,7 +1342,7 @@ i = 0; SET_STRING((*value_list)->value[i].s,MD_NO_SELECTION); i++; - while (BlindExtractObject(tmp_list, (TAG *) &tag, NULL, (void**)&object)==0) { + while (BlindExtractObject(tmp_list, &tag, NULL, (void**)&object)==0) { if (object->size >= min_size) { (*value_list)->value[i].s = EngFncs->engine_alloc(strlen(object->name) + 1); strcpy((*value_list)->value[i].s, object->name); only in patch2: unchanged: --- evms-2.2.2.orig/plugins/md/linear_mgr.c +++ evms-2.2.2/plugins/md/linear_mgr.c @@ -512,7 +512,7 @@ storage_object_t * object; int nr_disks; unsigned long size = -1; - int tag; + TAG tag; int i, index = 0; int rc = 0; mdp_disk_t disk; @@ -532,7 +532,7 @@ LOG_EXIT_INT(EINVAL); return EINVAL; } - while (!(rc = BlindExtractObject(objects, (TAG *)&tag, NULL, (void *)&object))) { + while (!(rc = BlindExtractObject(objects, &tag, NULL, (void *)&object))) { size = min(size, object->size); // track smallest object for super block volume->child_object[index] = object; index ++; only in patch2: unchanged: --- evms-2.2.2.orig/plugins/md/md_discover.c +++ evms-2.2.2/plugins/md/md_discover.c @@ -853,7 +853,7 @@ int md_discover_volumes( dlist_t input_list, dlist_t output_list) { void * waste; storage_object_t * object; - int tag; + TAG tag; int rc = 0; mdp_super_t * md_super_buffer; @@ -863,7 +863,7 @@ // A buffer for md_check_object_for_pv to use for reading // the PV metadata. - while (!(rc = BlindExtractObject(input_list, (TAG *)&tag, NULL, (void *)&object))) { + while (!(rc = BlindExtractObject(input_list, &tag, NULL, (void *)&object))) { if (object->data_type == DATA_TYPE) { rc = md_check_for_pv(object, &md_super_buffer); if (rc) { only in patch2: unchanged: --- evms-2.2.2.orig/plugins/jfs/fs_jfs.c +++ evms-2.2.2/plugins/jfs/fs_jfs.c @@ -385,7 +385,8 @@ */ static int fs_unmkfs_setup(logical_volume_t * volume) { - int tag, rc = 0; + TAG tag; + int rc = 0; struct superblock *sb_ptr = (struct superblock *)volume->private_data; logsuper_t *log_sb_ptr = NULL; dlist_t JFS_vols; @@ -416,7 +417,7 @@ * checking for a match of the actual uuid of the external log, and the * uuid of the external log that is stored in the JFS volume's superblock. */ - while (BlindExtractObject(JFS_vols, (TAG *) &tag, NULL, (void**)&extlog_vol)==0) { + while (BlindExtractObject(JFS_vols, &tag, NULL, (void**)&extlog_vol)==0) { /* look for the JFS claimed volumes that are JFS external logs */ if ( Is_JFS_Log_Vol((logsuper_t *)extlog_vol->private_data) ) { log_sb_ptr = (logsuper_t *)extlog_vol->private_data; @@ -585,7 +586,8 @@ static int fs_mkfs_setup(logical_volume_t * volume, option_array_t * options) { - int i, tag, rc = 0; + int i, rc = 0; + TAG tag; char * ext_log_vol = NULL; dlist_t avail_ext_logs; logical_volume_t * vol; @@ -623,7 +625,7 @@ */ rc = EngFncs->get_volume_list(NULL, NULL, 0, &avail_ext_logs); GoToStartOfList(avail_ext_logs); - while (BlindExtractObject(avail_ext_logs, (TAG *) &tag, NULL, (void**)&vol)==0) { + while (BlindExtractObject(avail_ext_logs, &tag, NULL, (void**)&vol)==0) { /************************************************************* * TODO: When a min log volume size is put into mkfs.jfs, * * add that requirement here for validation of a volume to * @@ -765,7 +767,8 @@ dlist_t selected_volumes ) { int rc = 0; - int count, i, tag; + int count, i; + TAG tag; logical_volume_t * vol; dlist_t tmp_list, selected_tmp_list; @@ -800,7 +803,7 @@ * Loop through 'selected' volumes, remove them from temp list. */ GoToStartOfList(selected_tmp_list); - while (!BlindExtractObject(selected_tmp_list, (TAG *)&tag, NULL, (void **)&vol)) { + while (!BlindExtractObject(selected_tmp_list, &tag, NULL, (void **)&vol)) { LOG_DETAILS("Volume %s selected, removing from 'available' list\n",vol->name); rc = DeleteObject(tmp_list, vol); if (rc) { @@ -830,7 +833,7 @@ i = 0; SET_STRING((*value_list)->value[i].s, NO_SELECTION); i++; - while (BlindExtractObject(tmp_list, (TAG *) &tag, NULL, (void**)&vol)==0) { + while (BlindExtractObject(tmp_list, &tag, NULL, (void**)&vol)==0) { /* add proper volumes to 'available volumes' list */ /************************************************************* * TODO: When a min log volume size is put into mkfs.jfs, * @@ -866,7 +869,7 @@ dlist_t global_volumes; logical_volume_t * volume; void* waste; - int tag; + TAG tag; int rc = 0; LOG_ENTRY(); @@ -891,7 +894,7 @@ EngFncs->get_volume_list(NULL, NULL, 0, &global_volumes); } - while (!(rc = BlindExtractObject(global_volumes, (TAG *)&tag, NULL, (void **)&volume))) { + while (!(rc = BlindExtractObject(global_volumes, &tag, NULL, (void **)&volume))) { switch (context->action) { case EVMS_Task_mkfs: only in patch2: unchanged: --- evms-2.2.2.orig/plugins/ext2/fs_ext2.c +++ evms-2.2.2/plugins/ext2/fs_ext2.c @@ -630,7 +630,7 @@ dlist_t global_volumes; logical_volume_t * volume; void* waste; - int tag; + TAG tag; int rc = 0; option_descriptor_t *opt; @@ -648,7 +648,7 @@ rc = EngFncs->get_volume_list(NULL, NULL, 0, &global_volumes); - while (!(rc = BlindExtractObject(global_volumes, (TAG *)&tag, NULL, (void **)&volume))) { + while (!(rc = BlindExtractObject(global_volumes, &tag, NULL, (void **)&volume))) { switch (context->action) { case EVMS_Task_mkfs: only in patch2: unchanged: --- evms-2.2.2.orig/plugins/s390/390segmgr.c +++ evms-2.2.2/plugins/s390/390segmgr.c @@ -1337,7 +1337,8 @@ int rc = 0; int count = 0; storage_object_t * object; - int tag,waste; + TAG tag; + int waste; LOG_ENTRY(); @@ -1345,7 +1346,7 @@ rc = GoToStartOfList(input_objects); if (rc == 0) { - while ((rc=BlindExtractObject(input_objects, (TAG *)&tag, NULL, (void *)&object ))==DLIST_SUCCESS) { + while ((rc=BlindExtractObject(input_objects, &tag, NULL, (void *)&object ))==DLIST_SUCCESS) { LOG_DEBUG("examining object %s\n", object->name ); only in patch2: unchanged: --- evms-2.2.2.orig/plugins/ogfs/fs_ogfs.c +++ evms-2.2.2/plugins/ogfs/fs_ogfs.c @@ -684,7 +684,7 @@ */ static struct list_element *ogfs_unclaim_volumes(dlist_t volumes, struct list_element *volnames) { - int tag; + TAG tag; logical_volume_t *volume; struct list_element *head = NULL, *vnames = NULL; @@ -696,7 +696,7 @@ GoToStartOfList(volumes); - while (BlindExtractObject(volumes, (TAG *)&tag, NULL, (void**)&volume) == 0 + while (BlindExtractObject(volumes, &tag, NULL, (void**)&volume) == 0 && vnames != NULL) { struct list_element *element; only in patch2: unchanged: --- evms-2.2.2.orig/plugins/swap/swapfs.c +++ evms-2.2.2/plugins/swap/swapfs.c @@ -633,7 +633,7 @@ dlist_t global_volumes; logical_volume_t * volume; void* waste; - int tag; + TAG tag; int rc = 0; LOG_ENTRY(); @@ -648,7 +648,7 @@ rc = EngFncs->get_volume_list(NULL, NULL, 0, &global_volumes); - while (!(rc = BlindExtractObject(global_volumes, (TAG *)&tag, NULL, (void **)&volume))) { + while (!(rc = BlindExtractObject(global_volumes, &tag, NULL, (void **)&volume))) { switch (context->action) { case EVMS_Task_mkfs: only in patch2: unchanged: --- evms-2.2.2.orig/plugins/reiser/reiserfs.c +++ evms-2.2.2/plugins/reiser/reiserfs.c @@ -1162,7 +1162,7 @@ dlist_t global_volumes; logical_volume_t * volume; void* waste; - int tag; + TAG tag; int rc = 0; value_list_t * value_list; @@ -1180,7 +1180,7 @@ rc = EngFncs->get_volume_list(NULL, NULL, 0, &global_volumes); - while (!(rc = BlindExtractObject(global_volumes, (TAG *)&tag, NULL, (void **)&volume))) { + while (!(rc = BlindExtractObject(global_volumes, &tag, NULL, (void **)&volume))) { switch (context->action) { case EVMS_Task_mkfs:
Attachment:
signature.asc
Description: Digital signature