mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] sandbox fixes
@ 2019-07-02  9:59 Antony Pavlov
  2019-07-02  9:59 ` [PATCH 1/3] sandbox: prevent segfault in tap_alloc() Antony Pavlov
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Antony Pavlov @ 2019-07-02  9:59 UTC (permalink / raw)
  To: barebox


Antony Pavlov (3):
  sandbox: prevent segfault in tap_alloc()
  sandbox: eliminale no previous prototype for ‘sandbox_add_device’ warning
  sandbox: drop blank lines at EOF

 arch/sandbox/board/board.c                     | 1 -
 arch/sandbox/board/console.c                   | 1 -
 arch/sandbox/board/devices.c                   | 1 +
 arch/sandbox/mach-sandbox/include/mach/linux.h | 2 +-
 arch/sandbox/os/tap.c                          | 3 +--
 5 files changed, 3 insertions(+), 5 deletions(-)

-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 1/3] sandbox: prevent segfault in tap_alloc()
  2019-07-02  9:59 [PATCH 0/3] sandbox fixes Antony Pavlov
@ 2019-07-02  9:59 ` Antony Pavlov
  2019-07-02 10:00 ` [PATCH 2/3] sandbox: eliminale no previous prototype for ‘sandbox_add_device’ warning Antony Pavlov
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2019-07-02  9:59 UTC (permalink / raw)
  To: barebox

Tap network interface initialization in sandbox
barebox leads to segfault under Debian Buster/Sid.

The problem is that strcpy(dev, ifr.ifr_name) inside
tap_alloc() tries to alter read-only data passed
by tap_probe() and barebox receives SIGSEGV.

Nobody uses network interface name returned
by tap_alloc() so we can drop this strcpy().

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/sandbox/mach-sandbox/include/mach/linux.h | 2 +-
 arch/sandbox/os/tap.c                          | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h
index 52360f8771..7d0ed55735 100644
--- a/arch/sandbox/mach-sandbox/include/mach/linux.h
+++ b/arch/sandbox/mach-sandbox/include/mach/linux.h
@@ -8,7 +8,7 @@ int sandbox_add_device(struct device_d *dev);
 struct fb_bitfield;
 
 int linux_register_device(const char *name, void *start, void *end);
-int tap_alloc(char *dev);
+int tap_alloc(const char *dev);
 uint64_t linux_get_time(void);
 int linux_read(int fd, void *buf, size_t count);
 int linux_read_nonblock(int fd, void *buf, size_t count);
diff --git a/arch/sandbox/os/tap.c b/arch/sandbox/os/tap.c
index 0e29e8e8ad..3a29a4be64 100644
--- a/arch/sandbox/os/tap.c
+++ b/arch/sandbox/os/tap.c
@@ -28,7 +28,7 @@
 #include <linux/if_tun.h>
 #include <string.h>
 
-int tap_alloc(char *dev)
+int tap_alloc(const char *dev)
 {
 	struct ifreq ifr;
 	int fd, err;
@@ -55,7 +55,6 @@ int tap_alloc(char *dev)
 		return err;
 	}
 
-	strcpy(dev, ifr.ifr_name);
 	return fd;
 }
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/3] sandbox: eliminale no previous prototype for ‘sandbox_add_device’ warning
  2019-07-02  9:59 [PATCH 0/3] sandbox fixes Antony Pavlov
  2019-07-02  9:59 ` [PATCH 1/3] sandbox: prevent segfault in tap_alloc() Antony Pavlov
@ 2019-07-02 10:00 ` Antony Pavlov
  2019-07-02 10:00 ` [PATCH 3/3] sandbox: drop blank lines at EOF Antony Pavlov
  2019-07-04  6:50 ` [PATCH 0/3] sandbox fixes Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2019-07-02 10:00 UTC (permalink / raw)
  To: barebox

The patch fixes the following gcc-8.3.0 warning:

arch/sandbox/board/devices.c:13:5: warning: no previous prototype for ‘sandbox_add_device’ [-Wmissing-prototypes]
 int sandbox_add_device(struct device_d *dev)
     ^~~~~~~~~~~~~~~~~~

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/sandbox/board/devices.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/sandbox/board/devices.c b/arch/sandbox/board/devices.c
index 10d6b67cc4..242a0d718e 100644
--- a/arch/sandbox/board/devices.c
+++ b/arch/sandbox/board/devices.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <driver.h>
+#include <mach/linux.h>
 #include <init.h>
 
 static LIST_HEAD(sandbox_device_list);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/3] sandbox: drop blank lines at EOF
  2019-07-02  9:59 [PATCH 0/3] sandbox fixes Antony Pavlov
  2019-07-02  9:59 ` [PATCH 1/3] sandbox: prevent segfault in tap_alloc() Antony Pavlov
  2019-07-02 10:00 ` [PATCH 2/3] sandbox: eliminale no previous prototype for ‘sandbox_add_device’ warning Antony Pavlov
@ 2019-07-02 10:00 ` Antony Pavlov
  2019-07-04  6:50 ` [PATCH 0/3] sandbox fixes Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Antony Pavlov @ 2019-07-02 10:00 UTC (permalink / raw)
  To: barebox

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 arch/sandbox/board/board.c   | 1 -
 arch/sandbox/board/console.c | 1 -
 2 files changed, 2 deletions(-)

diff --git a/arch/sandbox/board/board.c b/arch/sandbox/board/board.c
index dcad3c249b..1f6392d15e 100644
--- a/arch/sandbox/board/board.c
+++ b/arch/sandbox/board/board.c
@@ -58,4 +58,3 @@ static int devices_init(void)
 }
 
 device_initcall(devices_init);
-
diff --git a/arch/sandbox/board/console.c b/arch/sandbox/board/console.c
index 006bbd1a6e..4b251e9087 100644
--- a/arch/sandbox/board/console.c
+++ b/arch/sandbox/board/console.c
@@ -40,4 +40,3 @@ int barebox_register_console(int stdinfd, int stdoutfd)
 
 	return sandbox_add_device(dev);
 }
-
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 0/3] sandbox fixes
  2019-07-02  9:59 [PATCH 0/3] sandbox fixes Antony Pavlov
                   ` (2 preceding siblings ...)
  2019-07-02 10:00 ` [PATCH 3/3] sandbox: drop blank lines at EOF Antony Pavlov
@ 2019-07-04  6:50 ` Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2019-07-04  6:50 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Tue, Jul 02, 2019 at 12:59:58PM +0300, Antony Pavlov wrote:
> 
> Antony Pavlov (3):
>   sandbox: prevent segfault in tap_alloc()
>   sandbox: eliminale no previous prototype for ‘sandbox_add_device’ warning
>   sandbox: drop blank lines at EOF

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2019-07-04  6:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-02  9:59 [PATCH 0/3] sandbox fixes Antony Pavlov
2019-07-02  9:59 ` [PATCH 1/3] sandbox: prevent segfault in tap_alloc() Antony Pavlov
2019-07-02 10:00 ` [PATCH 2/3] sandbox: eliminale no previous prototype for ‘sandbox_add_device’ warning Antony Pavlov
2019-07-02 10:00 ` [PATCH 3/3] sandbox: drop blank lines at EOF Antony Pavlov
2019-07-04  6:50 ` [PATCH 0/3] sandbox fixes Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox