FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 03-09-2009, 09:13 PM
Kir Kolyshkin
 
Default lenny updates (CPT patches)

Kir Kolyshkin wrote:
Also, while I am at it... I am currently checking all the ~80 patches
that are not in openvz lenny kernel. Looks like most are really
needed. Let me suggest some in a few emails I will send as a reply to
this one.


Checkpointing-related patches. Needed if we want working
checkpointing/restart.


1. High-priority patches

http://git.openvz.org/?p=linux-2.6.26-openvz;a=commitdiff;h=d588f384c7a326c049f27cf4d90b 949a89c1fe94
CPT: Use sock_create instead sock_create_kern
Puts sockets in correct net namespace. Pretty trivial, not an ABI breaker. Found by internal testing.
Attached as 0001*


http://git.openvz.org/?p=linux-2.6.26-openvz;a=commitdiff;h=15ce7ef10f52493f94f5438d22a6 0a60e6bffdb0
CPT: Fix memory corruption
Found by internal testing. Exports one more function (needed since cpt/rst can be build as modules) so can be an ABI breaker.
Attached as 0002*


http://git.openvz.org/?p=linux-2.6.26-openvz;a=commitdiff;h=e744de05b10aeff8289c5d287ed9 2cbb0438426d
CPT: Fixed checkpoint error due to skipped mm->exe_file dump
Needed due to changes in 2.6.26 kernel.Found by internal testing. Exports one more function so can be an ABI breaker.
Attached as 0006*



http://git.openvz.org/?p=linux-2.6.26-openvz;a=commitdiff;h=6d18ba377cfa3e86ee830fe6a5fc e52b8fd51039
CPT: revert check on sk_reuse>1
This is fix for Debian bug #500645 (OpenVZ bug #1034).
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=500645
Attached as 0038-CPT-revert-check-on-sk_reuse-1.patch



http://git.openvz.org/?p=linux-2.6.26-openvz;a=commitdiff;h=029cecb45ceb652b0add04388fca abe822e83660
cpt: Make the proper check for sigmask
Trivial fix, not an ABI breaker. Fixes OpenVZ bug #1122
http://bugzilla.openvz.org/show_bug.cgi?id=1122


2. "Not sure those are needed" patches.

http://git.openvz.org/?p=linux-2.6.26-openvz;a=commitdiff;h=ef2def76125ba8753042329df1ed e57449de4609
cpt: Ban fib trie
Pretty trivial. Not really needed if we make sure CONFIG_IP_FIB_TRIE is not set in openvz kernel .config, but shouldn't break anything.
Attached as 0012*


http://git.openvz.org/?p=linux-2.6.26-openvz;a=commitdiff;h=4fc3a18ab7c46e4bc375fa3ce59b 7fb1b173f35b
cpt: bump image version to VERSION_26
Needed to not confuse the user.
Attached as 0017*


http://git.openvz.org/?p=linux-2.6.26-openvz;a=commitdiff;h=c00febbae95a18b264fd8ca72b8e ef09ef28ae2e
cpt: Make it module by default
CONFIG_VZ_CHECKPOINT was set to n by default in kernel config. Now since it's working we enable it.
Doesn't make much sense for Debian if we set CONFIG_VZ_CHECKPOINT explicitly.
Attached as 0019*


http://git.openvz.org/?p=linux-2.6.26-openvz;a=commitdiff;h=281828bf90ea4e49bf5d8e777b1e c43972bf0949
cpt: replace BUG_ON-s checking for sizeof-s with BUILD_BUG_ON
Those checks need to be done compile-time not runtime. Mostly needed for developers but won't hurt to include.
Attached as 0032*

>From d588f384c7a326c049f27cf4d90b949a89c1fe94 Mon Sep 17 00:00:00 2001
From: Vitaliy Gusev <vgusev@openvz.org>
Date: Mon, 18 Aug 2008 15:10:15 +0400
Subject: [PATCH] CPT: Use sock_create instead sock_create_kern
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

sock_create_kern() uses init_net as default net namespace. Therefore
sockets and net devices are belonged to init_net, though must belong
to current net namespace.

Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
kernel/cpt/cpt_net.c | 2 +-
kernel/cpt/rst_net.c | 2 +-
kernel/cpt/rst_socket.c | 8 ++++----
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/kernel/cpt/cpt_net.c b/kernel/cpt/cpt_net.c
index 373db60..78919d8 100644
--- a/kernel/cpt/cpt_net.c
+++ b/kernel/cpt/cpt_net.c
@@ -337,7 +337,7 @@ static int cpt_dump_route(struct cpt_context * ctx)
mm_segment_t oldfs;
char *pg;

- err = sock_create_kern(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE, &sock);
+ err = sock_create(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE, &sock);
if (err)
return err;

diff --git a/kernel/cpt/rst_net.c b/kernel/cpt/rst_net.c
index b246ddb..c6be61a 100644
--- a/kernel/cpt/rst_net.c
+++ b/kernel/cpt/rst_net.c
@@ -202,7 +202,7 @@ int rst_restore_route(struct cpt_context *ctx)
if (err < 0)
return err;

- err = sock_create_kern(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE, &sock);
+ err = sock_create(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE, &sock);
if (err)
return err;

diff --git a/kernel/cpt/rst_socket.c b/kernel/cpt/rst_socket.c
index d90488e..4963f34 100644
--- a/kernel/cpt/rst_socket.c
+++ b/kernel/cpt/rst_socket.c
@@ -268,13 +268,13 @@ static int open_socket(cpt_object_t *obj, struct cpt_sock_image *si,
cpt_object_t *fobj;
cpt_object_t *pobj = NULL;

- err = sock_create_kern(si->cpt_family, si->cpt_type, si->cpt_protocol,
+ err = sock_create(si->cpt_family, si->cpt_type, si->cpt_protocol,
&sock);
if (err)
return err;

if (si->cpt_socketpair) {
- err = sock_create_kern(si->cpt_family, si->cpt_type,
+ err = sock_create(si->cpt_family, si->cpt_type,
si->cpt_protocol, &sock2);
if (err)
goto err_out;
@@ -436,10 +436,10 @@ static int open_listening_socket(loff_t pos, struct cpt_sock_image *si,
struct file *file;
cpt_object_t *obj, *fobj;

- err = sock_create_kern(si->cpt_family, si->cpt_type, si->cpt_protocol,
+ err = sock_create(si->cpt_family, si->cpt_type, si->cpt_protocol,
&sock);
if (err) {
- eprintk_ctx("open_listening_socket: sock_create_kern: %d
", err);
+ eprintk_ctx("open_listening_socket: sock_create: %d
", err);
return err;
}

--
1.6.0.6

>From 15ce7ef10f52493f94f5438d22a60a60e6bffdb0 Mon Sep 17 00:00:00 2001
From: Vitaliy Gusev <vgusev@openvz.org>
Date: Mon, 18 Aug 2008 15:10:49 +0400
Subject: [PATCH] CPT: Fix memory corruption

Structure thread_struct has xstate member that is pointer to
union thread_xstate.

Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
arch/x86/kernel/i387.c | 1 +
kernel/cpt/cpt_process.c | 5 ++++-
kernel/cpt/rst_process.c | 12 ++++++++++--
3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 95e80e5..bbcaada 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -144,6 +144,7 @@ int init_fpu(struct task_struct *tsk)
set_stopped_child_used_math(tsk);
return 0;
}
+EXPORT_SYMBOL(init_fpu);

int fpregs_active(struct task_struct *target, const struct user_regset *regset)
{
diff --git a/kernel/cpt/cpt_process.c b/kernel/cpt/cpt_process.c
index 4ceb351..0a1e109 100644
--- a/kernel/cpt/cpt_process.c
+++ b/kernel/cpt/cpt_process.c
@@ -471,6 +471,9 @@ static int dump_fpustate(struct task_struct *tsk, struct cpt_context *ctx)
unsigned long size;
int type;

+ if (!tsk->thread.xstate)
+ return 0;
+
cpt_open_object(NULL, ctx);

type = CPT_CONTENT_X86_FPUSTATE;
@@ -489,7 +492,7 @@ static int dump_fpustate(struct task_struct *tsk, struct cpt_context *ctx)
hdr.cpt_size = size;

ctx->write(&hdr, sizeof(hdr), ctx);
- ctx->write(&tsk->thread.xstate, size, ctx);
+ ctx->write(tsk->thread.xstate, size, ctx);
ctx->align(ctx);
cpt_close_object(ctx);
return 0;
diff --git a/kernel/cpt/rst_process.c b/kernel/cpt/rst_process.c
index 0f60a06..f3f383c 100644
--- a/kernel/cpt/rst_process.c
+++ b/kernel/cpt/rst_process.c
@@ -1192,6 +1192,10 @@ static void rst_apply_mxcsr_mask(struct task_struct *tsk)
#endif
}

+#ifdef CONFIG_X86
+#include <asm/i387.h>
+#endif
+
int rst_restore_process(struct cpt_context *ctx)
{
cpt_object_t *obj;
@@ -1365,7 +1369,9 @@ int rst_restore_process(struct cpt_context *ctx)
case CPT_OBJ_BITS:
if (b->cpt_content == CPT_CONTENT_X86_FPUSTATE &&
cpu_has_fxsr) {
- memcpy(&tsk->thread.xstate,
+ if (init_fpu(tsk))
+ return -ENOMEM;
+ memcpy(tsk->thread.xstate,
(void*)b + b->cpt_hdrlen,
sizeof(struct i387_fxsave_struct));
rst_apply_mxcsr_mask(tsk);
@@ -1375,7 +1381,9 @@ int rst_restore_process(struct cpt_context *ctx)
#ifndef CONFIG_X86_64
else if (b->cpt_content == CPT_CONTENT_X86_FPUSTATE_OLD &&
!cpu_has_fxsr) {
- memcpy(&tsk->thread.xstate,
+ if (init_fpu(tsk))
+ return -ENOMEM;
+ memcpy(tsk->thread.xstate,
(void*)b + b->cpt_hdrlen,
sizeof(struct i387_fsave_struct));
if (ti->cpt_used_math)
--
1.6.0.6

>From e744de05b10aeff8289c5d287ed92cbb0438426d Mon Sep 17 00:00:00 2001
From: Vitaliy Gusev <vgusev@openvz.org>
Date: Mon, 18 Aug 2008 15:14:54 +0400
Subject: [PATCH] CPT: Fixed checkpoint error due to skipped mm->exe_file dump

Fixed checkpoint error:

CPT ERR: ffff81001dcfa800,2 :file struct is referenced outside 2 3
CPT ERR: </sbin/init>

Since mainstream commit 925d1c401fa6cfd0df5d2e37da8981494ccdec07
structure mm_struct has pointer exe_file to execute file. So count
this file in the prep state.

During restore all vmas with VM_EXECUTABLE flag are related to the same
file. So set set_mm_exe_file() only once.

Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
fs/proc/base.c | 1 +
kernel/cpt/cpt_mm.c | 5 +++++
kernel/cpt/rst_mm.c | 6 ++++++
3 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index fb40acb..0e7207f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1268,6 +1268,7 @@ void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
mm->exe_file = new_exe_file;
mm->num_exe_file_vmas = 0;
}
+EXPORT_SYMBOL(set_mm_exe_file);

struct file *get_mm_exe_file(struct mm_struct *mm)
{
diff --git a/kernel/cpt/cpt_mm.c b/kernel/cpt/cpt_mm.c
index a3d8c8e..4e98a8e 100644
--- a/kernel/cpt/cpt_mm.c
+++ b/kernel/cpt/cpt_mm.c
@@ -78,6 +78,11 @@ static int collect_one_mm(struct mm_struct *mm, cpt_context_t * ctx)
return -ENOMEM;
}
}
+
+ if (mm->exe_file &&
+ cpt_object_add(CPT_OBJ_FILE, mm->exe_file, ctx) == NULL)
+ return -ENOMEM;
+
#ifdef CONFIG_BEANCOUNTERS
if (cpt_add_ubc(mm->mm_ub, ctx) == NULL)
return -ENOMEM;
diff --git a/kernel/cpt/rst_mm.c b/kernel/cpt/rst_mm.c
index 380b382..377e2e8 100644
--- a/kernel/cpt/rst_mm.c
+++ b/kernel/cpt/rst_mm.c
@@ -481,6 +481,8 @@ static int copy_mm_pages(struct mm_struct *src, unsigned long start,
return 0;
}

+#include <linux/proc_fs.h>
+
static int do_rst_vma(struct cpt_vma_image *vmai, loff_t vmapos, loff_t mmpos, struct cpt_context *ctx)
{
int err = 0;
@@ -518,6 +520,10 @@ static int do_rst_vma(struct cpt_vma_image *vmai, loff_t vmapos, loff_t mmpos, s
}

down_write(&mm->mmap_sem);
+
+ if ((make_flags(vmai) & VM_EXECUTABLE) && mm->exe_file != file)
+ set_mm_exe_file(mm, file);
+
addr = do_mmap_pgoff(file, vmai->cpt_start,
vmai->cpt_end-vmai->cpt_start,
prot, make_flags(vmai),
--
1.6.0.6

>From 6d18ba377cfa3e86ee830fe6a5fce52b8fd51039 Mon Sep 17 00:00:00 2001
From: Vitaliy Gusev <vgusev@openvz.org>
Date: Tue, 14 Oct 2008 19:10:44 +0400
Subject: [PATCH] CPT: revert check on sk_reuse>1

Revert commit ac6f78192054784f02dd47f8e6d7d1c8d75ab173
("[INET]: sk_reuse is valbool", Author: Gerrit Renker <gerrit@erg.abdn.ac.uk>)

Check on sk_reuse>1 is needed as during restore "bind" fails
for sockets that was bound to the same port for same sk_family and also
fails for sockets that are bound to the same port for other sk_family
(Example: sshd that listen to port 22 IPv4 and IPv6 any address).

For additional information see open_listening_sockets() and open_socket().

Related to the bug#1034
http://bugzilla.openvz.org/show_bug.cgi?id=1034

Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
net/ipv4/inet_connection_sock.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 5bfa408..2fbce13 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -146,6 +146,8 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
goto tb_not_found;
tb_found:
if (!hlist_empty(&tb->owners)) {
+ if (sk->sk_reuse > 1)
+ goto success;
if (tb->fastreuse > 0 &&
sk->sk_reuse && sk->sk_state != TCP_LISTEN) {
goto success;
--
1.6.0.6

>From 029cecb45ceb652b0add04388fcaabe822e83660 Mon Sep 17 00:00:00 2001
From: Konstantin Khlebnikov <khlebnikov@openvz.org>
Date: Mon, 29 Dec 2008 19:37:47 +0300
Subject: [PATCH] cpt: Make the proper check for sigmask

invalid check of TS_RESTORE_SIGMASK (always false!)

original code ..rhel5..2.6.24 code from diff-cpt-sigsuspend-lockup-20070131
if (!signal_pending(current) &&
!test_thread_flag(TIF_RESTORE_SIGMASK)) {

TIF_RESTORE_SIGMASK replaced with TS_RESTORE_SIGMASK and
after commit 7648d96 setting TS_RESTORE_SIGMASK always set TIF_SIGPENDING.

so, second check is not needed.

http://bugzilla.openvz.org/show_bug.cgi?id=1122

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
kernel/cpt/rst_process.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/kernel/cpt/rst_process.c b/kernel/cpt/rst_process.c
index f3f383c..a05390e 100644
--- a/kernel/cpt/rst_process.c
+++ b/kernel/cpt/rst_process.c
@@ -814,8 +814,7 @@ static void rst_restart_sys(void)
}
}

- if (!signal_pending(current) &&
- !current_thread_info()->status & TS_RESTORE_SIGMASK) {
+ if (!signal_pending(current)) {
if (SYSCALL_ERRNO(regs) == ERESTARTSYS ||
SYSCALL_ERRNO(regs) == ERESTARTNOINTR ||
SYSCALL_ERRNO(regs) == ERESTARTNOHAND) {
--
1.6.0.6

>From ef2def76125ba8753042329df1ede57449de4609 Mon Sep 17 00:00:00 2001
From: Pavel Emelyanov <xemul@openvz.org>
Date: Tue, 2 Sep 2008 20:51:36 +0400
Subject: [PATCH] cpt: Ban fib trie

This sounds wierd (we restore routing via common API), but
with fib trie turned on after (successfull) restore I see the
CPT ERR: f6c1e240,296 :NLMERR: -3
message in logs and not working networking in container.

So ban this thing for a while...

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

P.S. I know, that Kconfig ban looks better
---
kernel/cpt/cpt_net.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/cpt/cpt_net.c b/kernel/cpt/cpt_net.c
index 78919d8..d61126c 100644
--- a/kernel/cpt/cpt_net.c
+++ b/kernel/cpt/cpt_net.c
@@ -322,6 +322,10 @@ int cpt_dump_ifaddr(struct cpt_context * ctx)
return 0;
}

+#ifdef CONFIG_IP_FIB_TRIE
+#error "Trie fib rules are known not to be restored proprly yet"
+#endif
+
static int cpt_dump_route(struct cpt_context * ctx)
{
int err;
--
1.6.0.6

>From 4fc3a18ab7c46e4bc375fa3ce59b7fb1b173f35b Mon Sep 17 00:00:00 2001
From: Pavel Emelyanov <xemul@openvz.org>
Date: Tue, 9 Sep 2008 19:25:00 +0400
Subject: [PATCH] cpt: bump image version to VERSION_26

Images from older kernels will most likely not get restored...

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
kernel/cpt/cpt_context.c | 2 +-
kernel/cpt/rst_context.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cpt/cpt_context.c b/kernel/cpt/cpt_context.c
index 58a8069..e3f3f9f 100644
--- a/kernel/cpt/cpt_context.c
+++ b/kernel/cpt/cpt_context.c
@@ -122,7 +122,7 @@ int cpt_major_hdr_out(struct cpt_context *ctx)
hdr.cpt_signature[2] = CPT_SIGNATURE2;
hdr.cpt_signature[3] = CPT_SIGNATURE3;
hdr.cpt_hdrlen = sizeof(hdr);
- hdr.cpt_image_version = CPT_VERSION_20;
+ hdr.cpt_image_version = CPT_VERSION_26;
#ifdef CONFIG_X86_64
hdr.cpt_os_arch = CPT_OS_ARCH_EMT64;
#elif defined(CONFIG_X86_32)
diff --git a/kernel/cpt/rst_context.c b/kernel/cpt/rst_context.c
index 47e4f35..cc381fe 100644
--- a/kernel/cpt/rst_context.c
+++ b/kernel/cpt/rst_context.c
@@ -178,7 +178,7 @@ int rst_open_dumpfile(struct cpt_context *ctx)
ctx->start_time.tv_nsec = h.cpt_start_nsec;
ctx->kernel_config_flags = h.cpt_kernel_config[0];
ctx->iptables_mask = h.cpt_iptables_mask;
- if (h.cpt_image_version > CPT_VERSION_20 ||
+ if (h.cpt_image_version > CPT_VERSION_26 ||
CPT_VERSION_MINOR(h.cpt_image_version) > 1) {
eprintk_ctx("Unknown image version: %x. Can't restore.
",
h.cpt_image_version);
--
1.6.0.6

>From c00febbae95a18b264fd8ca72b8eef09ef28ae2e Mon Sep 17 00:00:00 2001
From: Pavel Emelyanov <xemul@openvz.org>
Date: Wed, 10 Sep 2008 13:55:58 +0400
Subject: [PATCH] cpt: Make it module by default

---
kernel/Kconfig.openvz | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/Kconfig.openvz b/kernel/Kconfig.openvz
index dfd54fd..b7620f2 100644
--- a/kernel/Kconfig.openvz
+++ b/kernel/Kconfig.openvz
@@ -82,7 +82,7 @@ config VZ_CHECKPOINT
select TUN
select VE_ETHDEV
select VE_NETDEV
- default n
+ default m
help
This option adds two modules, "cpt" and "rst", which allow
to save a running Virtual Environment and restore it
--
1.6.0.6

>From 281828bf90ea4e49bf5d8e777b1ec43972bf0949 Mon Sep 17 00:00:00 2001
From: Pavel Emelyanov <xemul@openvz.org>
Date: Wed, 1 Oct 2008 11:52:31 +0400
Subject: [PATCH] cpt: replace BUG_ON-s checking for sizeof-s with BUILD_BUG_ON

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
kernel/cpt/cpt_net.c | 8 ++++----
kernel/cpt/rst_net.c | 12 ++++++------
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/kernel/cpt/cpt_net.c b/kernel/cpt/cpt_net.c
index d61126c..4262378 100644
--- a/kernel/cpt/cpt_net.c
+++ b/kernel/cpt/cpt_net.c
@@ -140,11 +140,11 @@ static void cpt_dump_tuntap(struct net_device *dev, struct cpt_context * ctx)
}

v.cpt_if_flags = tun->if_flags;
- BUG_ON(sizeof(v.cpt_dev_addr) != sizeof(tun->dev_addr));
+ BUILD_BUG_ON(sizeof(v.cpt_dev_addr) != sizeof(tun->dev_addr));
memcpy(v.cpt_dev_addr, tun->dev_addr, sizeof(v.cpt_dev_addr));
- BUG_ON(sizeof(v.cpt_chr_filter) != sizeof(tun->chr_filter));
+ BUILD_BUG_ON(sizeof(v.cpt_chr_filter) != sizeof(tun->chr_filter));
memcpy(v.cpt_chr_filter, tun->chr_filter, sizeof(v.cpt_chr_filter));
- BUG_ON(sizeof(v.cpt_net_filter) != sizeof(tun->net_filter));
+ BUILD_BUG_ON(sizeof(v.cpt_net_filter) != sizeof(tun->net_filter));
memcpy(v.cpt_net_filter, tun->net_filter, sizeof(v.cpt_net_filter));
ctx->write(&v, sizeof(v), ctx);
cpt_close_object(ctx);
@@ -187,7 +187,7 @@ int cpt_dump_link(struct cpt_context * ctx)
hw.cpt_object = CPT_OBJ_NET_HWADDR;
hw.cpt_hdrlen = sizeof(hw);
hw.cpt_content = CPT_CONTENT_VOID;
- BUG_ON(sizeof(hw.cpt_dev_addr) != sizeof(dev->dev_addr));
+ BUILD_BUG_ON(sizeof(hw.cpt_dev_addr) != sizeof(dev->dev_addr));
memcpy(hw.cpt_dev_addr, dev->dev_addr, sizeof(hw.cpt_dev_addr));
ctx->write(&hw, sizeof(hw), ctx);
cpt_close_object(ctx);
diff --git a/kernel/cpt/rst_net.c b/kernel/cpt/rst_net.c
index c6be61a..a9b1d3e 100644
--- a/kernel/cpt/rst_net.c
+++ b/kernel/cpt/rst_net.c
@@ -355,11 +355,11 @@ static int rst_restore_tuntap(loff_t start, struct cpt_netdev_image *di,
tun->attached = ti.cpt_attached;
tun->if_flags = ti.cpt_if_flags;
tun_net_init(dev);
- BUG_ON(sizeof(ti.cpt_dev_addr) != sizeof(tun->dev_addr));
+ BUILD_BUG_ON(sizeof(ti.cpt_dev_addr) != sizeof(tun->dev_addr));
memcpy(tun->dev_addr, ti.cpt_dev_addr, sizeof(ti.cpt_dev_addr));
- BUG_ON(sizeof(ti.cpt_chr_filter) != sizeof(tun->chr_filter));
+ BUILD_BUG_ON(sizeof(ti.cpt_chr_filter) != sizeof(tun->chr_filter));
memcpy(tun->chr_filter, ti.cpt_chr_filter, sizeof(ti.cpt_chr_filter));
- BUG_ON(sizeof(ti.cpt_net_filter) != sizeof(tun->net_filter));
+ BUILD_BUG_ON(sizeof(ti.cpt_net_filter) != sizeof(tun->net_filter));
memcpy(tun->net_filter, ti.cpt_net_filter, sizeof(ti.cpt_net_filter));

err = register_netdevice(dev);
@@ -375,7 +375,7 @@ static int rst_restore_tuntap(loff_t start, struct cpt_netdev_image *di,
&hw, ctx);
if (err)
goto out;
- BUG_ON(sizeof(hw.cpt_dev_addr) != sizeof(dev->dev_addr));
+ BUILD_BUG_ON(sizeof(hw.cpt_dev_addr) != sizeof(dev->dev_addr));
memcpy(dev->dev_addr, hw.cpt_dev_addr,
sizeof(hw.cpt_dev_addr));
}
@@ -586,8 +586,8 @@ int rst_restore_netdev(struct cpt_context *ctx)
pos, &hw, ctx);
if (err)
goto out;
- BUG_ON(sizeof(hw.cpt_dev_addr) !=
- sizeof(dev->dev_addr));
+ BUILD_BUG_ON(sizeof(hw.cpt_dev_addr) !=
+ sizeof(dev->dev_addr));
memcpy(dev->dev_addr, hw.cpt_dev_addr,
sizeof(hw.cpt_dev_addr));
} else if (hdr.cpt_object == CPT_OBJ_NET_STATS) {
--
1.6.0.6
 

Thread Tools




All times are GMT. The time now is 09:29 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org