From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5BA7C43441 for ; Mon, 19 Nov 2018 15:52:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8C44020831 for ; Mon, 19 Nov 2018 15:52:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C44020831 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arndb.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729919AbeKTCQB (ORCPT ); Mon, 19 Nov 2018 21:16:01 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:41081 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729762AbeKTCQB (ORCPT ); Mon, 19 Nov 2018 21:16:01 -0500 Received: by mail-qk1-f194.google.com with SMTP id 189so49304113qkj.8; Mon, 19 Nov 2018 07:52:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=o+5bJn4B66njPBzARi8LUL9emGuyKZAzXJwIQjlDvtM=; b=lBeuZt+b4+fODvHY8iGs0U4C4EIwr4Lm9tMlPin/V7HgBrvtq34amWwfcT6bAP6ybC eECS8GYuWJFes6cgMdgO0DNgq/FcpdZ8g7uNFP0rPiw5C3Mi7A1FbGfun/DBAGZ0PFUh KxhyGsmvcBvGYfOtIZuT9O95NVbX+ny4aCtlZgkauSaV2WIeoziFOMkXh1tQTSQT6t1u a/FeIlQ51k/Lse8jQHgj6U+yVII+GzhrHCwwcMRIcPMeyC9uVxmajAXQoMMVKKXCb+UZ f+dgnXN2m69KvXEhGTyGGYnyZU6ShCVf4UxWE27eQjqt49wWhWMQkkkGKts+n0T39Gj2 cHSw== X-Gm-Message-State: AGRZ1gIvZ/q8TwZl2i4uuux6WCiNlZhX860X8/xSSxXfhwAKfcqYbUQZ LsgdirbZDLtRe8toUM2RbpR3rFZ3mXEP/8fOO5g= X-Google-Smtp-Source: AJdET5cHmp/1dPcEYWWI7tbPZ6Do3MOei8PyXIbAgc68MwufxSav+3VqTvU3aV64CpGFlwtyfyVVC8eiHkrFWwRpg40= X-Received: by 2002:a0c:dc0f:: with SMTP id s15mr21441655qvk.40.1542642721554; Mon, 19 Nov 2018 07:52:01 -0800 (PST) MIME-Version: 1.0 References: <1542262461-29024-1-git-send-email-firoz.khan@linaro.org> <1542262461-29024-2-git-send-email-firoz.khan@linaro.org> In-Reply-To: <1542262461-29024-2-git-send-email-firoz.khan@linaro.org> From: Arnd Bergmann Date: Mon, 19 Nov 2018 16:51:44 +0100 Message-ID: Subject: Re: [PATCH v2 1/5] mips: add __NR_syscalls along with __NR_Linux_syscalls To: Firoz Khan Cc: Ralf Baechle , Paul Burton , James Hogan , "open list:RALINK MIPS ARCHITECTURE" , Thomas Gleixner , gregkh , Philippe Ombredanne , Kate Stewart , y2038 Mailman List , Linux Kernel Mailing List , linux-arch , Deepa Dinamani , Marcin Juszkiewicz Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 15, 2018 at 7:14 AM Firoz Khan wrote: > > The 2nd option will be the recommended one. For that, I > added the __NR_syscalls macro in uapi/asm/unistd.h along > with __NR_Linux_syscalls. The macro __NR_syscalls also > added for making the name convention same across all > architecture. While __NR_syscalls isn't strictly part of > the uapi, having it as part of the generated header to > simplifies the implementation. We also need to enclose > this macro with #ifdef __KERNEL__ to avoid side effects. I fear this doesn't work the way you hoped: > --- a/arch/mips/include/uapi/asm/unistd.h > +++ b/arch/mips/include/uapi/asm/unistd.h > @@ -391,16 +391,19 @@ > #define __NR_rseq (__NR_Linux + 367) > #define __NR_io_pgetevents (__NR_Linux + 368) > > +#ifdef __KERNEL__ > +#define __NR_syscalls 368 > +#endif We now have three different definitions of __NR_syscalls, one for each ABI. User space previously saw the correct one (now it doesn't see any, but that's ok). > /* > * Offset of the last Linux o32 flavoured syscall > */ > -#define __NR_Linux_syscalls 368 > +#define __NR_Linux_syscalls __NR_syscalls so this part part again is ok. > #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ > > #define __NR_O32_Linux 4000 > -#define __NR_O32_Linux_syscalls 368 > +#define __NR_O32_Linux_syscalls __NR_syscalls but this part is not: Now __NR_O32_Linux_syscalls is defined to __NR_syscalls, which may be one of the three values. Any usage of __NR_O32_Linux_syscalls in a 64-bit kernel is then clearly wrong. > #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ > > #define __NR_N32_Linux 6000 > -#define __NR_N32_Linux_syscalls 332 > +#define __NR_N32_Linux_syscalls __NR_syscalls Same for this one. Arnd