Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1594397

Summary: Unable to use mlock() when building
Product: [Fedora] Fedora Reporter: Omair Majid <omajid>
Component: mockAssignee: Miroslav Suchý <msuchy>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: jdisnard, jkeating, mebrown, msimacek, msuchy, praiskup, rjanekov, scx.mail, williams
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-25 07:21:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Omair Majid 2018-06-22 20:29:23 UTC
I am trying to build a project in copr. This project runs some code that does an mlock() as part of the build. mlock is no longer supported in copr.

mlock() is supported in koji, but not copr. This seems surprising, since official Fedora packages can use it, but not those trying to be official packages. Also, mlock() was previously supported in copr; I have built older versions of this project before, but those versions can no longer be rebuilt.

Here is an example build log: https://copr-be.cloud.fedoraproject.org/results/omajid/dotnet-2.1/fedora-28-x86_64/00770214-dotnet/build.log.gz

And here is the relevant part of the strace:

34    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff796f9c000
34    mlock(0x7ff796f9c000, 4096)       = -1 EPERM (Operation not permitted)
34    write(2, "Failed to initialize CoreCLR, HR"..., 49) = 49

This SRPM is available here: https://omajid.fedorapeople.org/dotnet/dotnet-2.1.301-1.fc27.src.rpm

Here is an older build of the same project: https://copr-be.cloud.fedoraproject.org/results/@dotnet-sig/dotnet/fedora-rawhide-x86_64/00749817-dotnet/dotnet-2.0.7-1.fc29.src.rpm

This was built as: https://copr.fedorainfracloud.org/coprs/g/dotnet-sig/dotnet/build/749817/ but can no longer be re-built.

Here is another package. It was built in koji: https://koji.fedoraproject.org/koji/taskinfo?taskID=27568635, but failed to build in copr: https://copr.fedorainfracloud.org/coprs/g/dotnet-sig/dotnet/build/766937/

To summarize, my issue really is two fold:
- mlock was usable in copr, but is no longer, so older packages can no longer be rebuilt
- koji allows using mlock(), copr doesn't.

Comment 1 Omair Majid 2018-06-22 21:20:08 UTC
Thanks to help from clime over on #fedora-buildsys, I can also reproduce this issue locally using `fedpkg mockbuild`. I had been using `fedpkg local` which was working without any issues.

I have:

$ mock --version
1.4.11
$ rpm -q mock
mock-1.4.11-1.fc28.noarch

$ fedpkg mockbuild
....
34    mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbd542bb000
34    mlock(0x7fbd542bb000, 4096)       = -1 EPERM (Operation not permitted)
34    write(2, "Failed to initialize CoreCLR, HR"..., 49) = 49
....

Comment 2 Omair Majid 2018-06-22 22:48:53 UTC
Adding the following line to a mock-config file makes this work locally:

config_opts['nspawn_args'] = ['--capability=CAP_IPC_LOCK']


So, while that works for my local use case, it still doesn't work out of the box. And it doesn't work on copr where I build my packages.

Comment 3 Miroslav Suchý 2018-06-25 07:21:44 UTC

*** This bug has been marked as a duplicate of bug 1580435 ***