NetBSD Problem Report #48962

From www@NetBSD.org  Thu Jul  3 19:51:16 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 65EADA654B
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  3 Jul 2014 19:51:16 +0000 (UTC)
Message-Id: <20140703195115.23C08A654C@mollari.NetBSD.org>
Date: Thu,  3 Jul 2014 19:51:15 +0000 (UTC)
From: yanegomi@gmail.com
Reply-To: yanegomi@gmail.com
To: gnats-bugs@NetBSD.org
Subject: NetBSD doesn't conform to POSIX with mlock(2) and per-process limits; returns EAGAIN instead of ENOMEM
X-Send-Pr-Version: www-1.0

>Number:         48962
>Category:       kern
>Synopsis:       NetBSD doesn't conform to POSIX with mlock(2) and per-process limits; returns EAGAIN instead of ENOMEM
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 03 19:55:00 +0000 2014
>Originator:     Garrett Cooper
>Release:        6.0-RELEASE
>Organization:
EMC / Isilon Storage Division
>Environment:
n/a
>Description:
mlock(2) in NetBSD states that per-process limits should return EAGAIN whereas mlock(2) in POSIX states that per-process limits may (note, not a hard requirement) return ENOMEM.

This was caught after closely examining the tests/lib/libc/sys/t_mlock.c port to FreeBSD ( https://github.com/yaneurabeya/freebsd/commit/04792995a548a9f5dc3d70791a88625d1e831082#diff-c2edb8c374a36673ab235f51ebf706feR203 ).

From NetBSD's mlock(2):

     [EAGAIN]           Locking the indicated range would exceed either the
                        system or per-process limit for locked memory.

From POSIX:

The mlock() function may fail if:

[ENOMEM]
    Locking the pages mapped by the specified range would exceed an implementation-defined limit on the amount of memory that the process may lock.
>How-To-Repeat:
- Change the EAGAIN check in tests/lib/libc/sys/t_mlock.c to ENOMEM.
- Compile and re-run the tests with ATF/Kyua.
>Fix:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.