Bug 189415 - [patch] mount_smbfs missing from arm
Summary: [patch] mount_smbfs missing from arm
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: CURRENT
Hardware: Any Any
: Normal Affects Some People
Assignee: Ian Lepore
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-07 12:40 UTC by Keith White
Modified: 2016-01-19 23:37 UTC (History)
3 users (show)

See Also:


Attachments
file.diff (1.98 KB, patch)
2014-05-07 12:40 UTC, Keith White
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith White 2014-05-07 12:40:00 UTC
mount_smbfs is not included with base arm builds since libsmb uses
casts to u_short that result in unaligned access to memory.

Patch attached.

Fix: The following patch replaces potential unaligned access in libsmb
with a function call to the internal function memsetw(), and adds
libsmb and mount_smbfs to the base build.
Comment 1 Ian Lepore freebsd_committer freebsd_triage 2015-12-19 01:31:05 UTC
I just stumbled across this PR while researching an old mail thread related to the fix I just did for the same problem, so I'll take this.  My solution is different than the one submitted with this PR, in that it avoids dealing with 16-bit values at all.  It's available for review/testing at

https://reviews.freebsd.org/D4622
Comment 2 commit-hook freebsd_committer freebsd_triage 2015-12-21 17:17:47 UTC
A commit references this bug:

Author: ian
Date: Mon Dec 21 17:17:00 UTC 2015
New revision: 292552
URL: https://svnweb.freebsd.org/changeset/base/292552

Log:
  Avoid unaligned memory accesses when encoding netbios names in libsmb.

  The current code for encoding a netbios name converts each byte to a 16-bit
  value and stores the result by casting a char* to u_short*, resulting in
  alignment faults on strict-alignment platforms.

  This change reimplements the encoding routine using only byte accesses to
  memory. There is no particular reason to work with 16-bit values just
  because the encoding process creates two bytes of output for every byte of
  input. Working a byte at at time also avoids endian problems for big-endian
  platforms.

  PR:		180438
  PR:		189415
  Differential Revision:	https://reviews.freebsd.org/D4622

Changes:
  head/contrib/smbfs/lib/smb/nb_name.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-12-21 17:41:52 UTC
A commit references this bug:

Author: ian
Date: Mon Dec 21 17:41:09 UTC 2015
New revision: 292553
URL: https://svnweb.freebsd.org/changeset/base/292553

Log:
  Make the building of libsmb and mount_smbfs unconditional, now that r292552
  has eliminated alignment and endian problems that were making it fail on
  some platforms.

  PR:        180438
  PR:        189415

Changes:
  head/lib/Makefile
  head/usr.sbin/Makefile
  head/usr.sbin/Makefile.amd64
  head/usr.sbin/Makefile.arm
  head/usr.sbin/Makefile.i386
  head/usr.sbin/Makefile.powerpc
  head/usr.sbin/Makefile.sparc64
Comment 4 commit-hook freebsd_committer freebsd_triage 2016-01-19 23:37:33 UTC
A commit references this bug:

Author: ian
Date: Tue Jan 19 23:36:50 UTC 2016
New revision: 294364
URL: https://svnweb.freebsd.org/changeset/base/294364

Log:
  MFC r292337, r292552, r292553:

    Build mount_smbfs for arm.  Also sort the subdirs.

    Avoid unaligned memory accesses when encoding netbios names in libsmb.

    The current code for encoding a netbios name converts each byte to a 16-bit
    value and stores the result by casting a char* to u_short*, resulting in
    alignment faults on strict-alignment platforms.

    This change reimplements the encoding routine using only byte accesses to
    memory. There is no particular reason to work with 16-bit values just
    because the encoding process creates two bytes of output for every byte of
    input. Working a byte at at time also avoids endian problems for big-endian
    platforms.

    Make the building of libsmb and mount_smbfs unconditional, now that r292552
    has eliminated alignment and endian problems that were making it fail on
    some platforms.

  PR:           180438
  PR:           189415
  Relnotes:	Yes

Changes:
_U  stable/10/
  stable/10/contrib/smbfs/lib/smb/nb_name.c
  stable/10/lib/Makefile
  stable/10/usr.sbin/Makefile
  stable/10/usr.sbin/Makefile.amd64
  stable/10/usr.sbin/Makefile.arm
  stable/10/usr.sbin/Makefile.i386
  stable/10/usr.sbin/Makefile.ia64
  stable/10/usr.sbin/Makefile.powerpc
  stable/10/usr.sbin/Makefile.sparc64