Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1419944imm; Wed, 17 Oct 2018 20:27:18 -0700 (PDT) X-Google-Smtp-Source: ACcGV61cFEbMMdAjKs3zhP0rsCk5vqqUfr9YRmAcD2o0TZisi+M5yVsTMPv/5xtYzfhdiYJtyzbH X-Received: by 2002:a17:902:2e81:: with SMTP id r1-v6mr22370371plb.212.1539833237902; Wed, 17 Oct 2018 20:27:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539833237; cv=none; d=google.com; s=arc-20160816; b=NfBkqpjbbkvaQPS+2Np6zZkKWbgdcIMePXjfDDkZ+Sgwg0mhC4oKmO/bgY5EIfUMIA u896FjXXZzMSNZHh7JpVtyz9omIWU3EjpjlCD28MtQPnmhcqOsCunvV69GMkOUOg8NyK FMuhsNnMPqDI9eUOTkqfmA75/P0mhAZlOgUOB8owa65CvZNGe6HKVDsOKRZvx1InHSyV C1DQHJTcQFthqZihtSD6AXwiPPGPAMbJ3xZ1uA92ajQ+Hm6SmM6wxKgciH+/nhhIGB48 gBFybyqM462gSPoMe0KW+wKxRlTzgSoxilB0sKB+Co0Y7x2NPxCcR0ptUSf30e/CV7mO 71Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:mime-version:user-agent:date:message-id :subject:from:to; bh=y0ypRPDFqvNqv228G/GNZfFxMceZVd4B9LJVk7UIrxA=; b=WmZ7lJkzp099cwYTu66GszB2+lCtvevaU70rpj6N91VMhSXqE196K6we5t8zuKfpDE y7bcXKM5z1qSDDueX7WPvOttycgvYY8JUea6qU5Fdc02OOZ4lYUrmnWBr2qrCo+Ii87B RNVtgh0whrQ5nkmcb30ULmF5k8Avwsg6htL8SzJbr/Pm2ZtCeUU/x3O5wHT5qRxugsEk 2OjxvR/sphlNFY2gVjRcTGIRORU29121oJ1kjA+VH3qjOsDkkfuLzuRgKNk5yVPOEwy/ y2fnD+O5LqneRbWMAID6ZDcUoxYflkuIL8X6BIhIuiBVeUGE1BDU2w5jEwmcKhq6cWE1 oKgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p10-v6si10452935plk.77.2018.10.17.20.27.01; Wed, 17 Oct 2018 20:27:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727497AbeJRLZC (ORCPT + 99 others); Thu, 18 Oct 2018 07:25:02 -0400 Received: from mail.windriver.com ([147.11.1.11]:63334 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727304AbeJRLZC (ORCPT ); Thu, 18 Oct 2018 07:25:02 -0400 Received: from ALA-HCA.corp.ad.wrs.com ([147.11.189.40]) by mail.windriver.com (8.15.2/8.15.1) with ESMTPS id w9I3Q9Fn023280 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 17 Oct 2018 20:26:09 -0700 (PDT) Received: from [128.224.162.153] (128.224.162.153) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 17 Oct 2018 20:26:08 -0700 To: , From: "Hongzhi, Song" Subject: Question about mmap syscall and POSIX standard on mips arch Message-ID: Date: Thu, 18 Oct 2018 11:26:02 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [128.224.162.153] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, Ltp has a POSIX teatcase about mmap, 24-2.c. https://github.com/linux-test-project/ltp/blob/e816127e5d8efbff5ae53e9c2292fae22f36838b/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c#L94 -----part of code-----     pa = mmap(addr, len, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, fd, 0);     if (pa == MAP_FAILED && errno == ENOMEM) {         printf("Got ENOMEM: %s\nTest PASSED\n", strerror(errno)); exit(PTS_PASS);     } -----end---------------- Under POSIX standard, the expected errno should be ENOMEM when the specific [addr+len] exceeds the bound of memory. But mips returns EINVAL. https://github.com/torvalds/linux/blob/bab5c80b211035739997ebd361a679fa85b39465/arch/mips/mm/mmap.c#L69 -------part of code-------     if (flags & MAP_FIXED) {         /* Even MAP_FIXED mappings must reside within TASK_SIZE */         if (TASK_SIZE - len < addr)             return -EINVAL; -------end------------------ So, can we change EINVAL to ENOMEM to follow POSIX standard? --Hongzhi