1
1
Mark Allen f413ef6b14 apply romio314 patch to romio321
When romio314 was first pulled in an extra patch was applied to it, see commit
92f6c7c1e210c559471a05aaac9b19e0bd3d71bb. Most of that patch is already present
in vanilla romio321, but the fix for MPIO_DATATYPE_ISCOMMITTED() isn't.

If that macro doesn't set err_ then some paths end up with a variable being used
uninitialized. In particular you can trace through romio321/romio/mpi-io/read.c
to see what happens with error_code. It's an uninitialized stack variable that goes
through three MPIO_CHECK_* macros none of which set it. The macros consistently set
error_code to a failure if they see something wrong, but they don't consistently
set it to success when things are fine.

And then in the last macro MPIO_CHECK_DATATYPE it tries to look at the value
of error_code that was never set.

Signed-off-by: Mark Allen <markalle@us.ibm.com>
2018-07-30 17:14:56 -04:00

85 строки
2.2 KiB
C

/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
*
* Copyright (C) 1997 University of Chicago.
* Copyright (c) 2018 IBM Corporation. All rights reserved.
* $COPYRIGHT$
* See COPYRIGHT notice in top-level directory.
*/
/* header file for MPI-IO implementation. not intended to be
user-visible */
#ifndef MPIOIMPL_INCLUDE
#define MPIOIMPL_INCLUDE
#include "adio.h"
#include "mpio.h"
#ifdef ROMIO_INSIDE_MPICH
#include "glue_romio.h"
#define ROMIO_THREAD_CS_ENTER() MPIR_Ext_cs_enter()
#define ROMIO_THREAD_CS_EXIT() MPIR_Ext_cs_exit()
#define ROMIO_THREAD_CS_YIELD() MPIR_Ext_cs_yield()
/* committed datatype checking support in ROMIO */
#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) \
do { \
err_ = MPIR_Ext_datatype_iscommitted(dtype_); \
} while (0)
#else /* not ROMIO_INSIDE_MPICH */
/* Any MPI implementation that wishes to follow the thread-safety and
error reporting features provided by MPICH must implement these
four functions. Defining these as empty should not change the behavior
of correct programs */
#define ROMIO_THREAD_CS_ENTER()
#define ROMIO_THREAD_CS_EXIT()
#define ROMIO_THREAD_CS_YIELD()
/* The MPI_DATATYPE_ISCOMMITTED macro now always sets err_=0.
This is an optimistic approach for Open MPI, but it is likely other
upper layers already checked the datatype was committed.
Not setting err_ is incorrect since it can lead to use of
uninitialized variable.*/
#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) do { err_ = 0; } while (0)
#ifdef HAVE_WINDOWS_H
#define MPIU_UNREFERENCED_ARG(a) a
#else
#define MPIU_UNREFERENCED_ARG(a)
#endif
#endif /* ROMIO_INSIDE_MPICH */
/* info is a linked list of these structures */
struct MPIR_Info {
int cookie;
char *key, *value;
struct MPIR_Info *next;
};
#define MPIR_INFO_COOKIE 5835657
MPI_Comm_delete_attr_function ADIOI_End_call;
/* common initialization routine */
void MPIR_MPIOInit(int * error_code);
#ifdef HAVE_MPIIO_CONST
#define ROMIO_CONST const
#else
#define ROMIO_CONST
#endif
#include "mpiu_external32.h"
#include "mpioprof.h"
#ifdef MPI_hpux
# include "mpioinst.h"
#endif /* MPI_hpux */
#endif