← Back to team overview

kernel-packages team mailing list archive

[Bug 1593657] Re: ControlPath unix socket is created in a weird way

 

I gave misc.c a quick skim before looking into the kernel:

int
unix_listener(const char *path, int backlog, int unlink_first)
{
        struct sockaddr_un sunaddr;
        int saved_errno, sock;

        memset(&sunaddr, 0, sizeof(sunaddr));
        sunaddr.sun_family = AF_UNIX;
        if (strlcpy(sunaddr.sun_path, path, sizeof(sunaddr.sun_path)) >= sizeof(sunaddr.sun_path)) {
                error("%s: \"%s\" too long for Unix domain socket", __func__,
                    path);
                errno = ENAMETOOLONG;
                return -1;
        }

        sock = socket(PF_UNIX, SOCK_STREAM, 0);
        ...
        if (bind(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) < 0) {


They memset 0 the struct, and pass the size of the struct. So I suspect OpenSSH is fine.

Thanks

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1593657

Title:
  ControlPath unix socket is created in a weird way

Status in linux package in Ubuntu:
  Confirmed
Status in openssh package in Ubuntu:
  Invalid

Bug description:
  STEPS.

  1. Create a ControlPath socket with something like "-o ControlPath=/tmp/sshcontrol-%C" during an SSH connection.
  2. Check with ls the socket is there. I am getting

  srw------- 1 enzo enzo  0 2016-06-17 10:17:21 sshcontrol-
  369d1187d3900c559f063f947218528001d0e705

  3. Ask lsof who's that socket belonging to:

  lsof /tmp/sshcontrol-369d1187d3900c559f063f947218528001d0e705

  4. Ask lsof the same but with grep

  lsof | grep /tmp/sshcontrol-369d1187d3900c559f063f947218528001d0e705

  ACTUAL RESULTS.
  For step no. 3 I am getting nothing (but the WARNING about /sys/kernel/debug/tracing)
  For step no. 4 I am getting:

  [enzo@Feynman ~] lsof | grep /tmp/sshcontrol-369d1187d3900c559f063f947218528001d0e705
  lsof: WARNING: can't stat() tracefs file system /sys/kernel/debug/tracing
        Output information may be incomplete.
  ssh       10667             enzo    4u     unix 0x0000000000000000       0t0     173813 /tmp/sshcontrol-369d1187d3900c559f063f947218528001d0e705.NDScoG3mgs0mWc4q type=STREAM

  Where you can see clearly that the socket name has a trailing part
  ".NDScoG3mgs0mWc4q".

  EXTRA STEP.
  5. Ask lsof about the socket with the extended name

  EXTRA RESULT

  [enzo@Feynman ~] lsof /tmp/sshcontrol-369d1187d3900c559f063f947218528001d0e705.NDScoG3mgs0mWc4q
  lsof: WARNING: can't stat() tracefs file system /sys/kernel/debug/tracing
        Output information may be incomplete.
  lsof: status error on /tmp/sshcontrol-369d1187d3900c559f063f947218528001d0e705.NDScoG3mgs0mWc4q: No such file or directory
  lsof 4.89
   latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
   latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
   latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
   usage: [-?abhKlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-E] [+|-e s] [+|-f[gG]]
   [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+m [m]] [+|-M] [-o [o]] [-p s]
   [+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
  Use the ``-h'' option to get more help information.

  
  EXPECTED RESULT
  A reasonable output from lsof detailing the real and actual unix socket.

  SOURCES

  man 5 ssh_config at the section "ControlPath"

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: openssh-client 1:7.2p2-4ubuntu1
  Uname: Linux 4.4.13-040413-lowlatency x86_64
  NonfreeKernelModules: rfcomm ipt_REJECT nf_reject_ipv4 pci_stub vboxpci vboxnetadp vboxnetflt vboxdrv bnep btusb btrtl btbcm btintel xt_multiport iptable_filter ip_tables x_tables 8812au ath3k cfg80211 bluetooth uas usb_storage input_leds hp_wmi sparse_keymap snd_hda_codec_realtek snd_hda_codec_generic intel_rapl x86_pkg_temp_thermal intel_powerclamp snd_hda_intel coretemp snd_hda_codec kvm_intel snd_hda_core kvm snd_hwdep snd_pcm irqbypass crct10dif_pclmul crc32_pclmul aesni_intel snd_seq_midi aes_x86_64 snd_seq_midi_event lrw snd_rawmidi gf128mul glue_helper ablk_helper cryptd snd_seq snd_seq_device serio_raw snd_timer mei_me snd mei soundcore shpchp lpc_ich 8250_fintek mac_hid parport_pc ppdev lp parport autofs4 xfs raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 multipath linear hid_generic usbhid hid raid0 i915 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt psmouse ahci fb_sys_fops libahci drm r8169 mii wmi fjes video
  ApportVersion: 2.20.1-0ubuntu2.1
  Architecture: amd64
  CurrentDesktop: KDE
  Date: Fri Jun 17 11:49:04 2016
  InstallationDate: Installed on 2016-04-22 (55 days ago)
  InstallationMedia: Kubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
  RelatedPackageVersions:
   ssh-askpass       N/A
   libpam-ssh        N/A
   keychain          N/A
   ssh-askpass-gnome N/A
  SSHClientVersion: OpenSSH_7.2p2 Ubuntu-4ubuntu1, OpenSSL 1.0.2g-fips  1 Mar 2016
  SourcePackage: openssh
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1593657/+subscriptions