A potential bug to squeeze extra memory through command line arguments

haris iqbal haris.phnx at gmail.com
Tue Mar 1 10:16:12 UTC 2016


On Tue, Mar 1, 2016 at 2:01 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> On Tue, Mar 01, 2016 at 10:08:16AM +0530, haris iqbal wrote:
>> On Tue, Mar 1, 2016 at 5:09 AM, Dmitry V. Levin <ldv at altlinux.org> wrote:
>> >
>> > On Wed, Feb 24, 2016 at 06:02:01PM +0530, haris iqbal wrote:
>> > [...]
>> > > Ok. I have come up with a separate memory model for tcbtab. In this
>> > > model, we will use a linked list instead of a global array of pointers
>> > > tcbtab.
>> > >
>> > > The structure
>> > >
>> > > struct s_tcbtab
>> > > {
>> > >     struct tcb* data;
>> > >     struct s_tcbtab* next;
>> > > }
>> > >
>> > > And a global head of the linked list.
>> > >
>> > > struct s_tcbtab* head_tcbtab = NULL;
>> >
>> > I suppose this memory model is better for some use cases and worse for
>> > some other use cases.
>> > What kind of strace usage would win/lose from this change?
>>
>> quick question. How many pids can we give with the -p option?
>
> It depends on the maximum length of the arguments to execve(2),
> which varies between systems.

One disadvantage I can think of in when there are a substantial number
of pids with the -p option. Then the new proposed model would iterate
over the linked list till the end while allocating a struct for every
pid. Thus the time taken for n pids would be (n * ( n + 1)) / 2.

The same case would happen with the older model also. But the
difference would be, the older one using an array (thus branch
prediction would help, and linear access of memory being an
advantage), and the newer model would be using linked list thus would
be slower. But I think there won't be a visible time difference for a
few pids with the -p option.

Is there any other disadvantage for the newer model that I missed?

>
>
> --
> ldv
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> Strace-devel mailing list
> Strace-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/strace-devel
>



-- 

With regards,

Md Haris Iqbal,
Placement Coordinator, MTech IT
NITK Surathkal,
Contact: +91 8861996962




More information about the Strace-devel mailing list