Bug 14503 - s3 configure script fails to detect fcntl hint support for linux
Summary: s3 configure script fails to detect fcntl hint support for linux
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-20 21:45 UTC by Pierre Langlois
Modified: 2021-03-09 11:02 UTC (History)
0 users

See Also:


Attachments
backported fix for 4.13 (1.58 KB, patch)
2021-02-25 19:12 UTC, Björn Jacke
bjacke: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre Langlois 2020-09-20 21:45:07 UTC
Hi there,

Building the samba package on AArch64 for the Guix distribution fails because the configure script leaves a stale "hinttest.fcntl" file behind, and the package recipe doesn't like it.

Digging into it, it looks like the C program that checks if the feature is available crashes on AArch64 while it runs OK on x86_64. The test code is as follows:

```
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>

#define DATA "hinttest.fcntl"

int main(void)
{
        uint64_t *hint, get_hint;
        int fd;

        fd = open(DATA, O_RDONLY | O_CREAT | O_EXCL);
        if (fd == -1) {
            goto err;
        }

        *hint = RWH_WRITE_LIFE_SHORT;
        int ret = fcntl(fd, F_SET_RW_HINT, hint);
        if (ret == -1) {
            goto err;
        }
...
...
}
```

It seems we're just lucky on x86 and the `hint` pointer just happens to be initialised with a valid address.  It should be quite trivial to fix this by keeping `hint` on the stack and get its address when calling `fcntl`.

This test was introduced with https://gitlab.com/samba-team/samba/-/commit/5084a69de14f24e9d804998580eefcba773fdd5a#e8f66f9cd3a87b4632d92dff7ac45138d5a832d2_1122_1180, and I could find another commit that tries to fix leaving a stale file behind, presumably because of a crash: https://gitlab.com/samba-team/samba/-/merge_requests/1253.

Thanks! Hopefully I'm filing this bug under the correct component, apologies if not! I'm not very familiar with samba itself.

Pierre
Comment 1 Samba QA Contact 2020-09-21 07:27:10 UTC
This bug was referenced in samba master:

454ccd986b61799908a6898a55d0480911f15306
Comment 2 Björn Jacke 2021-02-25 19:12:56 UTC
Created attachment 16471 [details]
backported fix for 4.13
Comment 3 Karolin Seeger 2021-02-26 10:00:46 UTC
Pushed to autobuild-v4-13-test.
Comment 4 Samba QA Contact 2021-02-26 10:58:03 UTC
This bug was referenced in samba v4-13-test:

9806b67ee4c2dd4e1ef42b03517c0ffda40f2ace
Comment 5 Karolin Seeger 2021-03-01 09:29:15 UTC
Pushed to v4-13-test and already included in v4-14-test.
Closing out bug report.

Thanks!
Comment 6 Samba QA Contact 2021-03-09 11:02:17 UTC
This bug was referenced in samba v4-13-stable (Release samba-4.13.5):

9806b67ee4c2dd4e1ef42b03517c0ffda40f2ace