tarickb / sasl-xoauth2

SASL plugin for XOAUTH2
Other
75 stars 21 forks source link

Segmentation fault on systems with 16k page size #91

Closed aikrahguzar closed 2 months ago

aikrahguzar commented 2 months ago

Hi, I think the plugin provided by this package use 4k page size. E.g. with

readelf -l /usr/lib64/sasl2/libsasl-xoauth2.so

I obtain,

Elf file type is DYN (Shared object file)
Entry point 0x0
There are 11 program headers, starting at offset 64

Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
  LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x00000000000030d8 0x00000000000030d8  R      0x10000
  LOAD           0x0000000000010000 0x0000000000010000 0x0000000000010000
                 0x0000000000008bf0 0x0000000000008bf0  R E    0x10000
  LOAD           0x0000000000020000 0x0000000000020000 0x0000000000020000
                 0x00000000000025b4 0x00000000000025b4  R      0x10000
  LOAD           0x000000000002f8d0 0x000000000003f8d0 0x000000000003f8d0
                 0x0000000000000750 0x00000000000007f8  RW     0x10000
  DYNAMIC        0x000000000002fa20 0x000000000003fa20 0x000000000003fa20
                 0x0000000000000250 0x0000000000000250  RW     0x8
  NOTE           0x00000000000002a8 0x00000000000002a8 0x00000000000002a8
                 0x0000000000000020 0x0000000000000020  R      0x8
  NOTE           0x00000000000002c8 0x00000000000002c8 0x00000000000002c8
                 0x00000000000000b4 0x00000000000000b4  R      0x4
  GNU_PROPERTY   0x00000000000002a8 0x00000000000002a8 0x00000000000002a8
                 0x0000000000000020 0x0000000000000020  R      0x8
  GNU_EH_FRAME   0x0000000000020ecc 0x0000000000020ecc 0x0000000000020ecc
                 0x0000000000000204 0x0000000000000204  R      0x4
  GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
                 0x0000000000000000 0x0000000000000000  RW     0x10
  GNU_RELRO      0x00000000I think the plugin provided by this package use 4k page size. E.g. with0002f8d0 0x000000000003f8d0 0x000000000003f8d0
                 0x0000000000000730 0x0000000000000730  R      0x1

 Section to Segment mapping:
  Segment Sections...
   00     .note.gnu.property .note.gnu.build-id .note.package .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt 
   01     .init .plt .text .fini 
   02     .rodata .eh_frame_hdr .eh_frame .gcc_except_table 
   03     .init_array .fini_array .data.rel.ro .dynamic .got .data .bss 
   04     .dynamic 
   05     .note.gnu.property 
   06     .note.gnu.build-id .note.package 
   07     .note.gnu.property 
   08     .eh_frame_hdr 
   09     
   10     .init_array .fini_array .data.rel.ro .dynamic .got 

As far as I know this means that (see https://github.com/AsahiLinux/docs/wiki/Broken-Software#why-does-not-work-sometimes-mean-instantly-segfault) the library is using a 4k pagesize.

Is it possible to use this package on a 16k system?

Thanks in advance!

tarickb commented 2 months ago

Can you provide a little more information here? What Linux distribution and what architecture? Please also include logs and any stack traces you're seeing.

aikrahguzar commented 2 months ago

Can you provide a little more information here? What Linux distribution and what architecture? Please also include logs and any stack traces you're seeing.

I am using fedora asahi remix on a Macbook M2 air. I haven't figured out a way to produce any logs. The only thing I see is segmentation fault (core dumped).

The asahi linux page https://github.com/AsahiLinux/docs/wiki/Broken-Software#why-does-not-work-sometimes-mean-instantly-segfault has this,

If an ELF executable or library has sections which are not aligned to 16K pages, the loader will be unable to map the binary into memory and will signal this failure by causing a segmentation fault before the program even technically starts execution.

and I think this is what is happening.

I know almost nothing about c so if you can provide me with instructions to produce some logs and stack traces, I will follow them. I am using the package provided by fedora but if need be I can compile it myself.

Thanks again

tarickb commented 2 months ago

Where do you see "segmentation fault (core dumped)"? What command are you executing to trigger that? Is it Postfix that's crashing, or one of the sasl-xoauth2 command-line tools?

Also how are you using sasl-xoauth2? Did you compile it from source or are you using a pre-built package somewhere? If the former, how are you compiling it? Include the commands you ran and the full output. If the latter, what pre-built package are you using and how are you installing it?

aikrahguzar commented 2 months ago

Sorry, the alignment is not the issue, I was missing the last zero in the output of readelf I posted above. In any case, here are the answers to your questions.

I am using mbsync (part of isync package) for email and trying to sync an office365 account. I think this is a problem with mbsync so I will close this.

Sorry again!