title: How to get readable pwd in kernel
body: <p>I want to get the current directory, here is my attempt</p>
  
  <pre><code>asmlinkage ssize_t fake_read(int __fd, void *__buf, size_t __nbytes){
  
      struct path pwd;
      get_fs_pwd(current-&gt;fs,&amp;pwd);
      char x[1000];
      dentry_path_raw(pwd.dentry,x,999);
      fm_alert("read:%s\n",x);
      return real_read(__fd,__buf,__nbytes);
  }
  </code></pre>
  
  <p>However, the output I get is like</p>
  
  <pre><code>[ 2170.293439] fsmonko.fake_read: read:ػ\xffffffaf\xffffff80
  [ 2170.293466] fsmonko.fake_read: read:ػ\xffffffaf\xffffff80
  [ 2170.293483] fsmonko.fake_read: read:\xffffffd8;\xffffff9b\xffffff84
  [ 2170.293500] fsmonko.fake_read: read:ػ\xffffffaf\xffffff80
  [ 2170.293524] fsmonko.fake_read: read:ػ\xffffffaf\xffffff80
  [ 2170.293550] fsmonko.fake_read: read:ػ\xffffffaf\xffffff80
  [ 2170.293556] fsmonko.fake_read: read:\xffffffd8;\xffffff9b\xffffff84
  </code></pre>
  
  <p>It's supposed to print the readable pwd, what's wrong?</p>
  
  <p>My kernel version is <code>4.13.0-36-generic</code> Ubuntu 16.04.</p>