trinity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] Add support for cross building using CROSS_COMPILE
@ 2013-06-01 11:46 Michael Ellerman
  2013-06-01 11:46 ` [PATCH 2/4] Ignore vim swap files Michael Ellerman
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Michael Ellerman @ 2013-06-01 11:46 UTC (permalink / raw)
  To: trinity

Similarly to the kernel.  CROSS_COMPILE is optional, when specified it's
a prefix, eg. myarch-linux-gnu-

We still allow overriding CC, separately, or in addition to setting
CROSS_COMPILE.

There is also support for cross configuring, because at the moment all
the configure tests only need to build, they're not run.
---
 Makefile     |    3 +++
 configure.sh |    2 ++
 2 files changed, 5 insertions(+)

diff --git a/Makefile b/Makefile
index 2dbaa65..f5a35b6 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,9 @@ VERSION=1.2pre
 INSTALL_PREFIX ?= $(DESTDIR)
 INSTALL_PREFIX ?= $(HOME)
 
+CC := $(CROSS_COMPILE)$(CC)
+LD := $(CROSS_COMPILE)$(LD)
+
 CFLAGS = -Wall -W -g -O2 -I. -Iinclude/ -Wimplicit -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
 #CFLAGS += $(shell if $(CC) -m32 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-m32"; fi)
 CFLAGS += -Wdeclaration-after-statement
diff --git a/configure.sh b/configure.sh
index 4be1e59..a02db7f 100755
--- a/configure.sh
+++ b/configure.sh
@@ -10,6 +10,8 @@ MISSING_DEFS=0
 
 [ -z "$CC" ] && CC=cc
 
+CC=${CROSS_COMPILE}${CC}
+
 echo "/* This file is auto-generated by configure.sh */" > config.h
 
 TMP=$(mktemp)
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] Ignore vim swap files
  2013-06-01 11:46 [PATCH 1/4] Add support for cross building using CROSS_COMPILE Michael Ellerman
@ 2013-06-01 11:46 ` Michael Ellerman
  2013-06-01 11:46 ` [PATCH 3/4] Fix compile error in net/bpf.c for non x86 Michael Ellerman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2013-06-01 11:46 UTC (permalink / raw)
  To: trinity

---
 .gitignore |    1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 25f8a38..2b3edaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ trinity-*.tgz
 victims
 tags
 config.h
+.*.swp
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] Fix compile error in net/bpf.c for non x86
  2013-06-01 11:46 [PATCH 1/4] Add support for cross building using CROSS_COMPILE Michael Ellerman
  2013-06-01 11:46 ` [PATCH 2/4] Ignore vim swap files Michael Ellerman
@ 2013-06-01 11:46 ` Michael Ellerman
  2013-06-01 11:46 ` [PATCH 4/4] Sanity check the syscall number in print_syscall_name() Michael Ellerman
  2013-06-07  5:04 ` [PATCH 1/4] Add support for cross building using CROSS_COMPILE Michael Ellerman
  3 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2013-06-01 11:46 UTC (permalink / raw)
  To: trinity

In bpf.c there is an architecture check with cases for i386, x86-64 and
"other". But the other case typos TRUE_ARCH, leading to a build error.

---

Should this be in include/arch-foo.h ?
---
 net/bpf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bpf.c b/net/bpf.c
index cc748de..1643077 100644
--- a/net/bpf.c
+++ b/net/bpf.c
@@ -150,7 +150,7 @@ static const uint32_t bpf_seccomp_jmp_arch_vars[] = {
 # define TRUE_ARCH		AUDIT_ARCH_X86_64
 #else
 # define TRUE_REG_SYSCALL	((uint32_t) rand()) /* TODO later */
-# define TRUE_ARCH_NR		((uint32_t) rand()) /* TODO later */
+# define TRUE_ARCH		((uint32_t) rand()) /* TODO later */
 #endif
 
 struct seccomp_data {
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] Sanity check the syscall number in print_syscall_name()
  2013-06-01 11:46 [PATCH 1/4] Add support for cross building using CROSS_COMPILE Michael Ellerman
  2013-06-01 11:46 ` [PATCH 2/4] Ignore vim swap files Michael Ellerman
  2013-06-01 11:46 ` [PATCH 3/4] Fix compile error in net/bpf.c for non x86 Michael Ellerman
@ 2013-06-01 11:46 ` Michael Ellerman
  2013-06-07  5:04 ` [PATCH 1/4] Add support for cross building using CROSS_COMPILE Michael Ellerman
  3 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2013-06-01 11:46 UTC (permalink / raw)
  To: trinity

In case it's out of bounds, causing us to segfault.

---

My watchdog was crashing because of this a while back. I can't actually
reproduce the crash with current trinity, but it's still possible
AFAICS.
---
 tables.c |   23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/tables.c b/tables.c
index 3ba70c9..7be1ae9 100644
--- a/tables.c
+++ b/tables.c
@@ -574,14 +574,25 @@ try_64bit:
 const char * print_syscall_name(unsigned int callno, bool is32bit)
 {
 	const struct syscalltable *table;
+	unsigned int max;
 
-	if (biarch == FALSE)
-		return syscalls[callno].entry->name;
+	if (biarch == FALSE) {
+		max = max_nr_syscalls;
+		table = syscalls;
+	} else {
+		if (is32bit == FALSE) {
+			max = max_nr_64bit_syscalls;
+			table = syscalls_64bit;
+		} else {
+			max = max_nr_32bit_syscalls;
+			table = syscalls_32bit;
+		}
+	}
 
-	if (is32bit == FALSE)
-		table = syscalls_64bit;
-	else
-		table = syscalls_32bit;
+	if (callno >= max) {
+		printf("Bogus syscall number in %s (%u)\n", __func__, callno);
+		return "invalid-syscall";
+	}
 
 	return table[callno].entry->name;
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] Add support for cross building using CROSS_COMPILE
  2013-06-01 11:46 [PATCH 1/4] Add support for cross building using CROSS_COMPILE Michael Ellerman
                   ` (2 preceding siblings ...)
  2013-06-01 11:46 ` [PATCH 4/4] Sanity check the syscall number in print_syscall_name() Michael Ellerman
@ 2013-06-07  5:04 ` Michael Ellerman
  2013-06-07  5:30   ` Dave Jones
  3 siblings, 1 reply; 7+ messages in thread
From: Michael Ellerman @ 2013-06-07  5:04 UTC (permalink / raw)
  To: trinity

On Sat, Jun 01, 2013 at 09:46:15PM +1000, Michael Ellerman wrote:
> Similarly to the kernel.  CROSS_COMPILE is optional, when specified it's
> a prefix, eg. myarch-linux-gnu-
> 
> We still allow overriding CC, separately, or in addition to setting
> CROSS_COMPILE.
> 
> There is also support for cross configuring, because at the moment all
> the configure tests only need to build, they're not run.

Did this series make it to the list? They were the first I sent just
after I subscribed. Or did you just not like them ? :)

Anyway the .gitignore patch conflicts now, I can rebase and resend if
you like.

cheers

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] Add support for cross building using CROSS_COMPILE
  2013-06-07  5:04 ` [PATCH 1/4] Add support for cross building using CROSS_COMPILE Michael Ellerman
@ 2013-06-07  5:30   ` Dave Jones
  2013-06-07  6:44     ` Michael Ellerman
  0 siblings, 1 reply; 7+ messages in thread
From: Dave Jones @ 2013-06-07  5:30 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: trinity

On Fri, Jun 07, 2013 at 03:04:26PM +1000, Michael Ellerman wrote:
 > On Sat, Jun 01, 2013 at 09:46:15PM +1000, Michael Ellerman wrote:
 > > Similarly to the kernel.  CROSS_COMPILE is optional, when specified it's
 > > a prefix, eg. myarch-linux-gnu-
 > > 
 > > We still allow overriding CC, separately, or in addition to setting
 > > CROSS_COMPILE.
 > > 
 > > There is also support for cross configuring, because at the moment all
 > > the configure tests only need to build, they're not run.
 > 
 > Did this series make it to the list? They were the first I sent just
 > after I subscribed. Or did you just not like them ? :)

Sorry, I just overlooked them.

 > Anyway the .gitignore patch conflicts now, I can rebase and resend if
 > you like.

All applied and pushed out.

(For small 1-2 liners I don't mind fixing up git merges. Bigger stuff I'd I've
 asked for a rebase.)

thanks,

	Dave

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] Add support for cross building using CROSS_COMPILE
  2013-06-07  5:30   ` Dave Jones
@ 2013-06-07  6:44     ` Michael Ellerman
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Ellerman @ 2013-06-07  6:44 UTC (permalink / raw)
  To: Dave Jones; +Cc: trinity

On Fri, 2013-06-07 at 01:30 -0400, Dave Jones wrote:
> On Fri, Jun 07, 2013 at 03:04:26PM +1000, Michael Ellerman wrote:
>  > On Sat, Jun 01, 2013 at 09:46:15PM +1000, Michael Ellerman wrote:
>  > > Similarly to the kernel.  CROSS_COMPILE is optional, when specified it's
>  > > a prefix, eg. myarch-linux-gnu-
>  > > 
>  > > We still allow overriding CC, separately, or in addition to setting
>  > > CROSS_COMPILE.
>  > > 
>  > > There is also support for cross configuring, because at the moment all
>  > > the configure tests only need to build, they're not run.
>  > 
>  > Did this series make it to the list? They were the first I sent just
>  > after I subscribed. Or did you just not like them ? :)
> 
> Sorry, I just overlooked them.

No stress.

>  > Anyway the .gitignore patch conflicts now, I can rebase and resend if
>  > you like.
> 
> All applied and pushed out.
> 
> (For small 1-2 liners I don't mind fixing up git merges. Bigger stuff I'd I've
>  asked for a rebase.)

Thanks.

cheers

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-06-07  6:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-01 11:46 [PATCH 1/4] Add support for cross building using CROSS_COMPILE Michael Ellerman
2013-06-01 11:46 ` [PATCH 2/4] Ignore vim swap files Michael Ellerman
2013-06-01 11:46 ` [PATCH 3/4] Fix compile error in net/bpf.c for non x86 Michael Ellerman
2013-06-01 11:46 ` [PATCH 4/4] Sanity check the syscall number in print_syscall_name() Michael Ellerman
2013-06-07  5:04 ` [PATCH 1/4] Add support for cross building using CROSS_COMPILE Michael Ellerman
2013-06-07  5:30   ` Dave Jones
2013-06-07  6:44     ` Michael Ellerman

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).