Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-20461

Redefining the posix_acl_to_xattr might confuse the compiler.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • None
    • None
    • None
    • 3
    • 9223372036854775807

      When we test with some customer's kernel. The crash has been hit:

      [  215.684912] RIP: 0010:memcpy_orig+0x115/0x140
      [  215.689371] Code: 0f 1f 44 00 00 83 fa 04 72 1b 8b 0e 44 8b 44 16 fc 89 0f 44 89 44 17 fc c3 cc cc cc cc 0f 1f 84 00 00 00 00 00 83 ea 01 72 19 <0f> b6 0e 74 12 4c 0f b6 46 01 4c 0f b6 0c 16 44 88 47 01 44 88 0c
      [  215.708244] RSP: 0018:ffffbb9080d63b48 EFLAGS: 00010202
      [  215.713569] RAX: ffffa0501e52e998 RBX: 0000000000000002 RCX: ffffffffc0824385
      [  215.720802] RDX: 0000000000000001 RSI: 000000000000001c RDI: ffffa0501e52e998
      [  215.728039] RBP: ffffbb9080d63bb8 R08: 0000000000000007 R09: 6c63615f7869736f
      [  215.735272] R10: 6c63615f7869736f R11: ffffffffc071e030 R12: ffffbb9080d63ce8
      [  215.742508] R13: 0000000000000000 R14: 0000000000000018 R15: ffffa04f55091608
      [  215.749742] FS:  00007b209ddad740(0000) GS:ffffa0522fd00000(0000) knlGS:0000000000000000
      [  215.757931] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  215.763775] CR2: 000000000000001c CR3: 000000021eaaa001 CR4: 00000000003706f0
      [  215.771015] Call Trace:
      [  215.773578]  <TASK>
      [  215.775779]  mdc_xattr_common+0x4c2/0x5d0 [mdc]
      [  215.780434]  mdc_setxattr+0xb3/0xd0 [mdc]
      [  215.784555]  lmv_setxattr+0x2c3/0x310 [lmv]
      [  215.788853]  ll_set_acl+0x301/0x3e0 [lustre]
      [  215.793265]  vfs_set_acl+0x2a6/0x380
      [  215.796954]  do_set_acl+0x7d/0xd0
      [  215.800463]  path_setxattr+0x1ec/0x310
      [  215.804327]  __x64_sys_setxattr+0x2f/0x40
      [  215.808529]  do_syscall_64+0x61/0x140
      [  215.812310]  ? clear_bhb_loop+0x40/0x90
      [  215.816250]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
      [  215.821405] RIP: 0033:0x7b209deb0fba
      [  215.825084] Code: 48 8b 0d 71 0e 0c 00 f7 d8 64 89 01 4
      

      The RSI is source address map to:

              ....
              if (input_size) {
                      tmp = req_capsule_client_get(&req->rq_pill, &RMF_EADATA);
                      memcpy(tmp, input, input_size);
              }
       ...........
      

      But it is 0x1c. Look into the binary:

      crash> posix_acl_to_xattr
      posix_acl_to_xattr = $1 = 
       {int (user_namespace *, const posix_acl *, void *, size_t)} 0xffffffffa24eb450 <posix_acl_to_xattr>
      
      ---- the kernel api is old style
      
      0xffffffffc09febfc <ll_set_acl+204>:    and    $0xf000,%eax
      0xffffffffc09fec01 <ll_set_acl+209>:    mov    $0xffffffffc0ada5ef,%r15
      0xffffffffc09fec08 <ll_set_acl+216>:    cmp    $0x4000,%eax
      0xffffffffc09fec0d <ll_set_acl+221>:    je     0xffffffffc09fec33 <ll_set_acl+259>
      0xffffffffc09fec0f <ll_set_acl+223>:    mov    $0xfffffff3,%r15d
      0xffffffffc09fec15 <ll_set_acl+229>:    test   %r13,%r13
      0xffffffffc09fec18 <ll_set_acl+232>:    jne    0xffffffffc09feea1 <ll_set_acl+881>
      0xffffffffc09fec1e <ll_set_acl+238>:    mov    %r13,-0x58(%rbp)
      0xffffffffc09fec22 <ll_set_acl+242>:    movq   $0xffffffffc0ada5ef,-0x50(%rbp)
      0xffffffffc09fec2a <ll_set_acl+250>:    jmp    0xffffffffc09fec6d <ll_set_acl+317>
      0xffffffffc09fec2c <ll_set_acl+252>:    mov    $0xffffffffc0ad58bb,%r15
      0xffffffffc09fec33 <ll_set_acl+259>:    test   %r13,%r13
      0xffffffffc09fec36 <ll_set_acl+262>:    je     0xffffffffc09fec65 <ll_set_acl+309>
      0xffffffffc09fec38 <ll_set_acl+264>:    lea    -0x40(%rbp),%rdx
      0xffffffffc09fec3c <ll_set_acl+268>:    mov    $0xc40,%ecx
      0xffffffffc09fec41 <ll_set_acl+273>:    mov    $0xffffffffa3e5fc20,%rdi
      0xffffffffc09fec48 <ll_set_acl+280>:    mov    %r13,%rsi
      0xffffffffc09fec4b <ll_set_acl+283>:    call   0xffffffffa24eb450 <posix_acl_to_xattr>
      0xffffffffc09fec50 <ll_set_acl+288>:    test   %eax,%eax
      ----- calling it without kmalloc
      

      So I think we should add a prefix to remind people that we redefine it, and also to keep the call chain clear.

            wc-triage WC Triage
            ys Yang Sheng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: