Bug 245102

Summary: jail(8) fails to parse ipv6 addr correctly
Product: Base System Reporter: Sean Bruno <sbruno>
Component: armAssignee: Andrew Turner <Andrew>
Status: Closed FIXED    
Severity: Affects Some People CC: Andrew, emaste
Priority: ---    
Version: CURRENT   
Hardware: arm64   
OS: Any   
Attachments:
Description Flags
Jail configuration that manifests the error.
none
Remove comments and command line faff. none

Description Sean Bruno freebsd_committer freebsd_triage 2020-03-27 15:15:45 UTC
Created attachment 212755 [details]
Jail configuration that manifests the error.

Using the following jail.conf on a jail in the freebsd cluster, jail(8) fails to parse the ipv6 addr and refuses to start the jail.  This is a correct configuration and doesn't appear to fail anywhere else.  I'm unsure if this is some strange ARCH specific bug or jail(8) itself.


error in question:
root@thunderx2.nyi:/home/sbruno # /usr/sbin/jail -i -f /var/run/jail.ref13-aarch64.conf -c ref13-aarch64
jail: ref13-aarch64: ip6.addr: not an IPv6 address: 2610:1c1:1:16:96
Comment 1 Sean Bruno freebsd_committer freebsd_triage 2020-03-27 15:17:00 UTC
Created attachment 212756 [details]
Remove comments and command line faff.
Comment 2 Sean Bruno freebsd_committer freebsd_triage 2020-03-28 17:31:07 UTC
Andy created a patch that fixes this issue.  I have tested and verified it on thunderx2 in the freebsd cluster.

It was also tested/verifed on several other ARM devices in #bsdmips.

https://people.freebsd.org/~andrew/0001-Use-memmove-to-copy-within-a-buffer.patch
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-04-01 09:52:18 UTC
A commit references this bug:

Author: andrew
Date: Wed Apr  1 09:51:30 UTC 2020
New revision: 359505
URL: https://svnweb.freebsd.org/changeset/base/359505

Log:
  Use memmove to copy within a buffer

  jail(8) would try to use strcpy to remove the interface from the start of
  an IP address. This is undefined, and on arm64 will result in unexpected
  IPv6 addresses.

  Fix this by using memmove top move the string.

  PR:		245102
  Reported by:	sbruno
  MFC after:	2 weeks
  Sponsored by:	Innovate UK

Changes:
  head/usr.sbin/jail/config.c
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2024-01-19 14:37:19 UTC
^Triage: committed back in 2020.