[LITMUS^RT] proposing liblitmus API additions and changes

Hiroyuki Chishiro chishiro at cs.unc.edu
Fri Jun 28 03:35:01 CEST 2013


Hi Glenn,

I hit a bug in release_master() in "liblitmus/src/migration.c".

  11  int release_master()
  12  {
  13  static const char NO_CPU[] = "NO_CPU";
  14  char buf[5] = {0}; /* up to 9999 CPUs */
  15  int master = -1;
  16
  17  int ret = read_file("/proc/litmus/release_master", &buf,
sizeof(buf)-1);
  18
  19  if ((ret > 0) && (strncmp(buf, NO_CPU, sizeof(NO_CPU)-1) != 0))
  20  master = atoi(buf);
  21
  22  return master;
  23  }


If /proc/litmus/release_master is "NO_CPU", then buf = "NO_C" in line 17
because sizeof(buf) - 1 = 4.
So "strncmp(buf, NO_CPU, sizeof(NO_CPU)-1) != 0" in line 19 is always true
because sizeof(NO_CPU) - 1 = 6.

I think that the size of buf should be 7.

  14  char buf[7] = {0}; /* up to 999999 CPUs */

- Hiro



On Wed, Apr 17, 2013 at 12:05 PM, Björn Brandenburg <bbb at mpi-sws.org> wrote:

>
> Glenn Elliott <gelliott at cs.unc.edu> wrote:
> > Done.  I've removed up old branches that have been superseded.  Two new
> branches pushed to github.
> >
> > prop/migration-final (2 commits): This branch implements the CPU
> affinity mask assignment based against partition/cluster assignment.
>  rtspin and rt_launch were also updated to include clustered scheduling
> options.  This branch has been rebased off of liblitmus/staging.
> >
> > prop/rt_task-init-final (2 commits): This branch adds the
> init_rt_task_param() routine.  It also updates liblitmus code to: (1) use
> init_rt_task_param() or new sporadic_*() convenience routines,  and (2)
> express time in nanoseconds.  #2 is needed because the sporadic_*()
> routines expect nanosecond parameters (the old sporadic_task() used
> milliseconds).  Please note that this branch builds on top of
> prop/migration-final.  Please further note that this branch depends upon
> litmus-rt/staging's 181b6bb0f5f122741262edc7ac0eca86d3f6dd73.
>
>
> Finally got around to merging this. Thanks a lot for the patches. I had to
> add one compile fix commit on top. GCC 4.4.5 uncovered some aliasing
> violations (fallout from the earlier -O2 patch).
>
> Thanks,
> Björn
>
>
> _______________________________________________
> litmus-dev mailing list
> litmus-dev at lists.litmus-rt.org
> https://lists.litmus-rt.org/listinfo/litmus-dev
>



-- 

Hiroyuki Chishiro

Visiting Scholar

Department of Computer Science

The University of North Carolina at Chapel Hill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.litmus-rt.org/pipermail/litmus-dev/attachments/20130627/008bf51d/attachment.html>


More information about the litmus-dev mailing list