EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Another SPARC alignment bug in 3.14_beta1
From: Till Straumann <[email protected]>
To: "Tech Talk (EPICS)" <[email protected]>
Date: Fri, 20 Sep 2002 10:23:37 -0700
Hi there.

You probably fixed this one already - RSRV on SPARC
dies with SIGBUS on putNotify due to a misaligned buffer.

Just to make sure, there's a patch attached (3.14_beta1)...

-- Till
Index: camessage.c
===================================================================
RCS file: /afs/slac/g/spear/cvsrep//epics/base/src/rsrv/camessage.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** camessage.c	2002/03/09 18:09:35	1.1.1.1
--- camessage.c	2002/09/19 23:52:08	1.2
***************
*** 1548,1555 ****
--- 1548,1568 ----
           * block if it is to small
           */
          if(pciu->pPutNotify->valueSize<size){
+ #ifdef MISALIGNED_BUFFER
              free(pciu->pPutNotify);
              pciu->pPutNotify = NULL;
+ #else
+ 			free(pciu->pPutNotify->dbPutNotify.pbuffer);
+ 			pciu->pPutNotify->valueSize = 0;
+ 			pciu->pPutNotify->dbPutNotify.pbuffer = casCalloc(1,size);
+ 			if (!pciu->pPutNotify->dbPutNotify.pbuffer) {
+             	log_header ( "no memory to initiate put notify", 
+                	 client, mp, pPayload, 0 );
+             	putNotifyErrorReply (client, mp, ECA_ALLOCMEM);
+             	return RSRV_ERROR;
+ 			}
+ 			pciu->pPutNotify->valueSize = size;
+ #endif
          }
      }
  
***************
*** 1559,1573 ****
--- 1572,1598 ----
       */
      if(!pciu->pPutNotify){
          pciu->pPutNotify = (RSRVPUTNOTIFY *) 
+ #ifdef MISALIGNED_BUFFER
              casCalloc(1, sizeof(*pciu->pPutNotify)+size);
+ #else
+             casCalloc(1, sizeof(*pciu->pPutNotify));
+ 		if (pciu->pPutNotify)
+ 			pciu->pPutNotify->dbPutNotify.pbuffer = casCalloc(1,size);
+ #endif
+ #ifdef MISALIGNED_BUFFER
          if(!pciu->pPutNotify){
+ #else
+         if(!pciu->pPutNotify || !pciu->pPutNotify->dbPutNotify.pbuffer){
+ #endif
              log_header ( "no memory to initiate put notify", 
                  client, mp, pPayload, 0 );
              putNotifyErrorReply (client, mp, ECA_ALLOCMEM);
              return RSRV_ERROR;
          }
          pciu->pPutNotify->valueSize = size;
+ #ifdef MISALIGNED_BUFFER
          pciu->pPutNotify->dbPutNotify.pbuffer = (pciu->pPutNotify+1);
+ #endif
          pciu->pPutNotify->dbPutNotify.usrPvt = pciu;
          pciu->pPutNotify->dbPutNotify.paddr = &pciu->addr;
          pciu->pPutNotify->dbPutNotify.userCallback = write_notify_call_back;
***************
*** 1758,1763 ****
--- 1783,1792 ----
       }
       
       if (pciu->pPutNotify) {
+ #ifdef MISALIGNED_BUFFER
+ #else
+ 		 free (pciu->pPutNotify->dbPutNotify.pbuffer);
+ #endif
           free (pciu->pPutNotify);
       }
       
Index: caservertask.c
===================================================================
RCS file: /afs/slac/g/spear/cvsrep//epics/base/src/rsrv/caservertask.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** caservertask.c	2002/03/09 18:09:35	1.1.1.1
--- caservertask.c	2002/09/19 23:52:08	1.2
***************
*** 587,592 ****
--- 587,596 ----
          status = db_flush_extra_labor_event (client->evuser);
          assert (status==DB_EVENT_OK);
          if (pciu->pPutNotify) {
+ #ifdef MISALIGNED_BUFFER
+ #else
+             free (pciu->pPutNotify->dbPutNotify.pbuffer);
+ #endif
              free(pciu->pPutNotify);
          }
          LOCK_CLIENTQ;

Replies:
RE: Another SPARC alignment bug in 3.14_beta1 Jeff Hill

Navigate by Date:
Prev: Re: Recommendations for Power PC VME cards Till Straumann
Next: Making CA calls from multi-threaded programs??? Leonard Reder
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Recommendations for Power PC VME cards Kevin Tsubota
Next: RE: Another SPARC alignment bug in 3.14_beta1 Jeff Hill
Index: 1994  1995  1996  1997  1998  1999  2000  2001  <20022003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·