Is there any error checking on swap?

John-Mark Gurney jmg at funkthat.com
Mon Jul 13 01:09:56 UTC 2020


Xin Li wrote this message on Sun, Jul 12, 2020 at 15:06 -0700:
> 
> 
> On 7/12/20 12:29 AM, John-Mark Gurney wrote:
> > bob prohaska wrote this message on Sat, Jul 11, 2020 at 20:33 -0700:
> >> Is there any error checking on swap traffic, along the lines of
> >> a checksum or parity test? 
> >>
> >> Just curious what happens if a page written out is corrupted  when
> >> it comes back.
> > 
> > Looks like it doesn't:
> > https://svnweb.freebsd.org/base/head/sys/vm/swap_pager.c?annotate=361965#l1389
> 
> Technically one can enable checks with e.g. geli(8), but note that the
> geli(8) provider will not "prime" the HMAC data so attaching the device
> will immediately spam the system log with some authentication errors due
> to GEOM tasting (because the kernel would try to read locations that
> potentially contain metadata for other GEOM providers).

Yeah, and enabling auth w/ geli(8) is problematic, as it creates a
disconnect between layers, as it expands 4096 byte writes to 9 512
byte sector writes, if you're using a 4k drive (which is pretty much
the only thing sold these days), the performance is likely to be
pretty terrible...

see:
https://svnweb.freebsd.org/base/head/sys/geom/eli/g_eli_integrity.c?annotate=361481#l56

So, it'd be doable, but less than ideal...

> For the case of swap, since the write is always page sized, it's
> probably optimal to implement something in the swap layer itself and
> store the expected checksums in memory.

+1

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20200712/4fd9cdd5/attachment.sig>


More information about the freebsd-current mailing list