trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Jones <davej@codemonkey.org.uk>
To: Vinson Lee <vlee@freedesktop.org>
Cc: trinity@vger.kernel.org
Subject: Re: [PATCH v2] Fix build on older kernels without BPF.
Date: Mon, 25 Jul 2016 20:59:29 -0400	[thread overview]
Message-ID: <20160726005929.GA17542@codemonkey.org.uk> (raw)
In-Reply-To: <CACKvgLE23r+RGDWhp3D0z9_gnbWCXJS45=mZGV+o6L3pZ=Ypkw@mail.gmail.com>

On Mon, Jul 25, 2016 at 05:24:43PM -0700, Vinson Lee wrote:

 > > for each of these, otherwise the next syscall will be in the wrong slot.
 > 
 > I tried making that change but trinity would crash in
 > copy_syscall_table with memcpy with a NULL from[n].entry.
 > 
 > Program received signal SIGSEGV, Segmentation fault.
 > 0x000000000041300e in copy_syscall_table (from=0x63d840, nr=329) at
 > /usr/include/bits/string3.h:52
 > 52  return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
 > (gdb) bt
 > #0  0x000000000041300e in copy_syscall_table (from=0x63d840, nr=329)
 > at /usr/include/bits/string3.h:52
 > #1  0x00000000004130f3 in select_syscall_tables () at tables.c:491
 > #2  0x0000000000413e95 in main (argc=1, argv=0x7fffffffe438) at trinity.c:115
 > 
 > tables.c
 >    470  static struct syscalltable * copy_syscall_table(struct
 > syscalltable *from, unsigned int nr)
 >    471  {
 >    472          unsigned int n;
 >    473          struct syscallentry *copy;
 >    474
 >    475          copy = alloc_shared(nr * sizeof(struct syscallentry));
 >    476          if (copy == NULL)
 >    477                  exit(EXIT_FAILURE);
 >    478
 >    479          for (n = 0; n < nr; n++) {
 >    480                  memcpy(copy + n , from[n].entry, sizeof(struct
 > syscallentry));
 >    481                  copy[n].number = n;
 >    482                  copy[n].active_number = 0;
 >    483                  from[n].entry = &copy[n];
 >    484          }
 >    485          return from;
 >    486  }


stick a 
		if (from[n] == NULL)
			continue

before the memcpy. Does that dtrt ?

We might segv somewhere else after patching this up. It's been so long since
I touched this stuff I don't fully recall how it works.  I'll poke at it
some tomorrow.

	Dave

  reply	other threads:[~2016-07-26  0:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12 18:43 [PATCH] Fix build on older kernels without BPF Vinson Lee
2016-07-12 19:02 ` Dave Jones
2016-07-12 21:33   ` [PATCH v2] " Vinson Lee
2016-07-21 20:10     ` Dave Jones
2016-07-26  0:24       ` Vinson Lee
2016-07-26  0:59         ` Dave Jones [this message]
2016-08-04 20:36           ` Dave Jones
2016-08-05 18:44             ` Dave Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160726005929.GA17542@codemonkey.org.uk \
    --to=davej@codemonkey.org.uk \
    --cc=trinity@vger.kernel.org \
    --cc=vlee@freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).