From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 16 21:13:21 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 9844376D for ; Tue, 16 Apr 2013 21:13:21 +0000 (UTC) (envelope-from carl.shapiro@gmail.com) Received: from mail-qe0-f43.google.com (mail-qe0-f43.google.com [209.85.128.43]) by mx1.freebsd.org (Postfix) with ESMTP id 5FC0C179C for ; Tue, 16 Apr 2013 21:13:20 +0000 (UTC) Received: by mail-qe0-f43.google.com with SMTP id f6so554760qej.30 for ; Tue, 16 Apr 2013 14:13:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:from:date:message-id:subject:to :content-type; bh=u3AM3QBxTC6+TF2mVPpMuhkJHG1juHwEdvKXFt9pxRc=; b=mhrlg1jVtCyGu0JwZv+TNd3cki5xb93YrrKRqvgCxJFHnp+IvBsPXXE8bhIJVocNFR 38a+lPLlxRQOdgl00bpQnbSTvIAE3SBb+Yx2F9nAI1vplhrBtJ8OqW9ojOeD5XH30ugl 7hlWAC7w3werF7oYQVQXZkVYc1jGd8I5mqpdTc4v9Ag//A6K+eFAIKgmYv3YvVDMZPdK Lxsb44eRyZBvOpVhLZJje/88QNDq5JfhtTjKhW+NwVGAcWR7xU0eVJwNsBnpmbXLxeDA 3pwd8TLhtMU9pMaRnwF5kQLKhSZwqkUlZ1/v1o6jZdSL6rbzuAU4ttmpNesi8XmC/FoD dLEg== X-Received: by 10.224.41.200 with SMTP id p8mr4498082qae.99.1366146794692; Tue, 16 Apr 2013 14:13:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.49.130.225 with HTTP; Tue, 16 Apr 2013 14:12:54 -0700 (PDT) From: Carl Shapiro Date: Tue, 16 Apr 2013 14:12:54 -0700 Message-ID: Subject: MADV_FREE and wait4 EFAULT To: FreeBSD Hackers Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 21:13:21 -0000 I am seeing wait4 system calls failing with an EFAULT and I am trying to understand what might be going wrong. An inspection of the wait4 implementation suggests the opportunity for EFAULT is within its invocations of copyout. In my situation, the status and rusage pointer arguments contain addresses to mmaped pages which have been madvised as MADV_FREE. Is it permissible to pass pages which have been madvised MADV_FREE to wait4 or any other system call for that matter? Might there be another opportunity for a wait4 to EFAULT?