FreeBSD Bugzilla – Attachment 144257 Details for
Bug 187381
[panic] pfsync: memory address not aligned
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Workable fix
pr187381.rev0.patch (text/plain), 2.17 KB, created by
lytboris
on 2014-06-29 16:43:11 UTC
(
hide
)
Description:
Workable fix
Filename:
MIME Type:
Creator:
lytboris
Created:
2014-06-29 16:43:11 UTC
Size:
2.17 KB
patch
obsolete
>Index: if_pfsync.c >=================================================================== >--- a/sys/netpfil/pf/if_pfsync.c (revision 264268) >+++ b/sys/netpfil/pf/if_pfsync.c (working copy) >@@ -404,6 +404,7 @@ > struct pf_state_key *skw = NULL, *sks = NULL; > struct pf_rule *r = NULL; > struct pfi_kif *kif; >+ struct pfsync_state_key sp_key[2]; > int error; > > PF_RULES_RASSERT(); >@@ -449,12 +450,15 @@ > if ((skw = uma_zalloc(V_pf_state_key_z, M_NOWAIT)) == NULL) > goto cleanup; > >- if (PF_ANEQ(&sp->key[PF_SK_WIRE].addr[0], >- &sp->key[PF_SK_STACK].addr[0], sp->af) || >- PF_ANEQ(&sp->key[PF_SK_WIRE].addr[1], >- &sp->key[PF_SK_STACK].addr[1], sp->af) || >- sp->key[PF_SK_WIRE].port[0] != sp->key[PF_SK_STACK].port[0] || >- sp->key[PF_SK_WIRE].port[1] != sp->key[PF_SK_STACK].port[1]) { >+ /* fix possible memory unalignment */ >+ memcpy(sp_key, &sp->key, sizeof(sp_key)); >+ >+ if (PF_ANEQ(&sp_key[PF_SK_WIRE].addr[0], >+ &sp_key[PF_SK_STACK].addr[0], sp->af) || >+ PF_ANEQ(&sp_key[PF_SK_WIRE].addr[1], >+ &sp_key[PF_SK_STACK].addr[1], sp->af) || >+ sp_key[PF_SK_WIRE].port[0] != sp_key[PF_SK_STACK].port[0] || >+ sp_key[PF_SK_WIRE].port[1] != sp_key[PF_SK_STACK].port[1]) { > sks = uma_zalloc(V_pf_state_key_z, M_NOWAIT); > if (sks == NULL) > goto cleanup; >@@ -467,17 +471,17 @@ > goto cleanup; > > /* copy to state key(s) */ >- skw->addr[0] = sp->key[PF_SK_WIRE].addr[0]; >- skw->addr[1] = sp->key[PF_SK_WIRE].addr[1]; >- skw->port[0] = sp->key[PF_SK_WIRE].port[0]; >- skw->port[1] = sp->key[PF_SK_WIRE].port[1]; >+ skw->addr[0] = sp_key[PF_SK_WIRE].addr[0]; >+ skw->addr[1] = sp_key[PF_SK_WIRE].addr[1]; >+ skw->port[0] = sp_key[PF_SK_WIRE].port[0]; >+ skw->port[1] = sp_key[PF_SK_WIRE].port[1]; > skw->proto = sp->proto; > skw->af = sp->af; > if (sks != skw) { >- sks->addr[0] = sp->key[PF_SK_STACK].addr[0]; >- sks->addr[1] = sp->key[PF_SK_STACK].addr[1]; >- sks->port[0] = sp->key[PF_SK_STACK].port[0]; >- sks->port[1] = sp->key[PF_SK_STACK].port[1]; >+ sks->addr[0] = sp_key[PF_SK_STACK].addr[0]; >+ sks->addr[1] = sp_key[PF_SK_STACK].addr[1]; >+ sks->port[0] = sp_key[PF_SK_STACK].port[0]; >+ sks->port[1] = sp_key[PF_SK_STACK].port[1]; > sks->proto = sp->proto; > sks->af = sp->af; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 187381
:
144257
|
144551
|
144553