Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Sep 2017 07:34:18 -0700
From:      Conrad Meyer <cem@freebsd.org>
To:        Kirk McKusick <mckusick@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r323923 - in head: lib/libufs sbin/dumpfs sbin/fsck_ffs sbin/fsdb sbin/newfs sys/kern sys/libkern sys/sys sys/ufs/ffs
Message-ID:  <CAG6CVpWhboGPkg7XKdJ71aaN4vfWM5NSzmXNq9SHD_=8L9zHkQ@mail.gmail.com>
In-Reply-To: <201709221245.v8MCjFPv043387@repo.freebsd.org>
References:  <201709221245.v8MCjFPv043387@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Sep 22, 2017 at 5:45 AM, Kirk McKusick <mckusick@freebsd.org> wrote:
> Author: mckusick
> Date: Fri Sep 22 12:45:15 2017
> New Revision: 323923
> URL: https://svnweb.freebsd.org/changeset/base/323923
>
> Log:
>   Continuing efforts to provide hardening of FFS, this change adds a
>   check hash to cylinder groups. If a check hash fails when a cylinder
>   group is read, no further allocations are attempted in that cylinder
>   group until it has been fixed by fsck. This avoids a class of
>   filesystem panics related to corrupted cylinder group maps. The
>   hash is done using crc32c.
>
> ...
>
> Modified: head/sys/libkern/crc32.c
> ==============================================================================
> --- head/sys/libkern/crc32.c    Fri Sep 22 12:07:03 2017        (r323922)
> +++ head/sys/libkern/crc32.c    Fri Sep 22 12:45:15 2017        (r323923)
> @@ -759,6 +762,7 @@ calculate_crc32c(uint32_t crc32c,
>      const unsigned char *buffer,
>      unsigned int length)
>  {
> +#ifdef _KERNEL
>  #if defined(__amd64__) || defined(__i386__)
>         if ((cpu_feature2 & CPUID2_SSE42) != 0) {
>                 return (sse42_crc32c(crc32c, buffer, length));
> @@ -776,6 +780,7 @@ calculate_crc32c(uint32_t crc32c,
>                 return (armv8_crc32c(crc32c, buffer, length));
>         } else
>  #endif
> +#endif /* _KERNEL */
>         if (length < 4) {
>                 return (singletable_crc32c(crc32c, buffer, length));
>         } else {

Userspace x86 ought to be able to use the SSE-enhanced implementation,
too.  It will just need a cpuid check, and can skip the FPU context
manipulation.

Best,
Conrad



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpWhboGPkg7XKdJ71aaN4vfWM5NSzmXNq9SHD_=8L9zHkQ>