NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/56894: if_lagg.c crashes on alignment-picky architectures



The following reply was made to PR kern/56894; it has been noted by GNATS.

From: Tom Lane <tgl%sss.pgh.pa.us@localhost>
To: Taylor R Campbell <riastradh%NetBSD.org@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, Shoichi Yamaguchi <yamaguchi%NetBSD.org@localhost>
Subject: Re: kern/56894: if_lagg.c crashes on alignment-picky architectures
Date: Mon, 20 Jun 2022 15:29:50 -0400

 ------- =_aaaaaaaaaa0
 Content-Type: text/plain; charset="us-ascii"
 Content-ID: <2573332.1655753358.1%sss.pgh.pa.us@localhost>
 
 Taylor R Campbell <riastradh%NetBSD.org@localhost> writes:
 > Can you try the attached patch and see if it helps?
 
 As-is, nope: you've got a thinko about which value needs to be aligned.
 Adding the attached delta patch gets me a clean pass on all the
 net/if_lagg/t_lagg test cases.
 
 			regards, tom lane
 
 
 ------- =_aaaaaaaaaa0
 Content-Type: text/x-diff; name="lagg-fix.patch"; charset="us-ascii"
 Content-ID: <2573332.1655753358.2%sss.pgh.pa.us@localhost>
 Content-Description: lagg-fix.patch
 
 --- sys/net/lagg/if_laggproto.h~	2022-06-20 10:27:29.744899667 -0400
 +++ sys/net/lagg/if_laggproto.h	2022-06-20 13:26:45.025311487 -0400
 @@ -230,7 +230,8 @@
  		return NULL;
  	}
  
 -	if (m->m_len >= len && ((uintptr_t)mtod(m, uint8_t *) % align) == 0) {
 +	if (m->m_len >= len &&
 +	    ((uintptr_t)(mtod(m, uint8_t *) + off) % align) == 0) {
  		rv = mtod(m, uint8_t *) + off;
  	} else {
  		m_copydata(m, off, reqlen, buf);
 
 ------- =_aaaaaaaaaa0--
 


Home | Main Index | Thread Index | Old Index