Linux-Security-Module Archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Linus Torvalds" <torvalds@linux-foundation.org>,
	"Guenter Roeck" <linux@roeck-us.net>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Rich Felker" <dalias@libc.org>,
	"John Paul Adrian Glaubitz" <glaubitz@physik.fu-berlin.de>
Cc: "Miklos Szeredi" <mszeredi@redhat.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-api@vger.kernel.org, linux-man@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	"Karel Zak" <kzak@redhat.com>, "Ian Kent" <raven@themaw.net>,
	"David Howells" <dhowells@redhat.com>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Christian Brauner" <christian@brauner.io>,
	"Amir Goldstein" <amir73il@gmail.com>,
	"Matthew House" <mattlloydhouse@gmail.com>,
	"Florian Weimer" <fweimer@redhat.com>
Subject: Re: [PATCH v4 5/6] add listmount(2) syscall
Date: Fri, 12 Jan 2024 00:01:34 +0100	[thread overview]
Message-ID: <07d8877b-d933-46f4-8ca4-c10ed602f37e@app.fastmail.com> (raw)
In-Reply-To: <CAHk-=wjh6Cypo8WC-McXgSzCaou3UXccxB+7PVeSuGR8AjCphg@mail.gmail.com>

On Thu, Jan 11, 2024, at 21:14, Linus Torvalds wrote:

> The SH put_user64() needs to be looked at too, but in the meantime,
> maybe something like this fixes the problems with listmount?

I tried changing it to use the generic memcpy() based uaccess
that m68k-nommu and riscv-nommu use, which also avoids the
build failure. I still run into other unrelated build issues
on arch/sh, so I'm not sure if this is a sufficient fix.

     Arnd

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 7500521b2b98..2cc3a541e231 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -73,6 +73,7 @@ config SUPERH
        select PERF_USE_VMALLOC
        select RTC_LIB
        select SPARSE_IRQ
+       select UACCESS_MEMCPY if !MMU
        select TRACE_IRQFLAGS_SUPPORT
        help
          The SuperH is a RISC processor targeted for use in embedded systems
diff --git a/arch/sh/include/asm/uaccess.h b/arch/sh/include/asm/uaccess.h
index a79609eb14be..b42764d55901 100644
--- a/arch/sh/include/asm/uaccess.h
+++ b/arch/sh/include/asm/uaccess.h
@@ -2,6 +2,7 @@
 #ifndef __ASM_SH_UACCESS_H
 #define __ASM_SH_UACCESS_H
 
+#ifdef CONFIG_MMU
 #include <asm/extable.h>
 #include <asm-generic/access_ok.h>
 
@@ -130,4 +131,8 @@ struct mem_access {
 int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
                            struct mem_access *ma, int, unsigned long address);
 
+#else
+#include <asm-generic/uaccess.h>
+#endif
+
 #endif /* __ASM_SH_UACCESS_H */
diff --git a/arch/sh/include/asm/uaccess_32.h b/arch/sh/include/asm/uaccess_32.h
index 5d7ddc092afd..e053f2fd245c 100644
--- a/arch/sh/include/asm/uaccess_32.h
+++ b/arch/sh/include/asm/uaccess_32.h
@@ -35,7 +35,6 @@ do {                                                          \
        }                                                       \
 } while (0)
 
-#ifdef CONFIG_MMU
 #define __get_user_asm(x, addr, err, insn) \
 ({ \
 __asm__ __volatile__( \
@@ -56,16 +55,6 @@ __asm__ __volatile__( \
        ".previous" \
        :"=&r" (err), "=&r" (x) \
        :"m" (__m(addr)), "i" (-EFAULT), "0" (err)); })
-#else
-#define __get_user_asm(x, addr, err, insn)             \
-do {                                                   \
-       __asm__ __volatile__ (                          \
-               "mov." insn "   %1, %0\n\t"             \
-               : "=&r" (x)                             \
-               : "m" (__m(addr))                       \
-       );                                              \
-} while (0)
-#endif /* CONFIG_MMU */
 
 extern void __get_user_unknown(void);
 
@@ -140,7 +129,6 @@ do {                                                        \
        }                                               \
 } while (0)
 
-#ifdef CONFIG_MMU
 #define __put_user_asm(x, addr, err, insn)                     \
 do {                                                           \
        __asm__ __volatile__ (                                  \
@@ -164,17 +152,6 @@ do {                                                               \
                : "memory"                                      \
        );                                                      \
 } while (0)
-#else
-#define __put_user_asm(x, addr, err, insn)             \
-do {                                                   \
-       __asm__ __volatile__ (                          \
-               "mov." insn "   %0, %1\n\t"             \
-               : /* no outputs */                      \
-               : "r" (x), "m" (__m(addr))              \
-               : "memory"                              \
-       );                                              \
-} while (0)
-#endif /* CONFIG_MMU */
 
 #if defined(CONFIG_CPU_LITTLE_ENDIAN)
 #define __put_user_u64(val,addr,retval) \

  reply	other threads:[~2024-01-11 23:01 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25 14:01 [PATCH v4 0/6] querying mount attributes Miklos Szeredi
2023-10-25 14:01 ` [PATCH v4 1/6] add unique mount ID Miklos Szeredi
2023-10-25 14:02 ` [PATCH v4 2/6] mounts: keep list of mounts in an rbtree Miklos Szeredi
2023-10-27  3:11   ` Ian Kent
2023-10-27  8:17     ` Miklos Szeredi
2023-10-28  1:36       ` Ian Kent
2023-10-30  5:37         ` Ian Kent
2023-10-30  5:45           ` Ian Kent
2023-10-30  9:06             ` Miklos Szeredi
2023-10-31  1:23               ` Ian Kent
2023-10-25 14:02 ` [PATCH v4 3/6] namespace: extract show_path() helper Miklos Szeredi
2023-10-25 14:02 ` [PATCH v4 4/6] add statmount(2) syscall Miklos Szeredi
2023-11-08  2:58   ` Paul Moore
2023-11-08  7:58     ` Christian Brauner
2023-11-08 20:10       ` Paul Moore
2023-11-10 17:00         ` Paul Moore
2023-11-12 13:05           ` Christian Brauner
2023-11-12 20:29             ` Paul Moore
2023-10-25 14:02 ` [PATCH v4 5/6] add listmount(2) syscall Miklos Szeredi
2023-11-07 21:23   ` Jonathan Corbet
2023-11-08  7:53     ` Christian Brauner
2023-11-08 16:20       ` Jonathan Corbet
2023-11-08 16:23         ` Christian Brauner
2023-11-08  2:58   ` Paul Moore
2024-01-10 22:23   ` Guenter Roeck
2024-01-11  0:32     ` Linus Torvalds
2024-01-11  5:12       ` Guenter Roeck
2024-01-11 18:57       ` Guenter Roeck
2024-01-11 20:14         ` Linus Torvalds
2024-01-11 23:01           ` Arnd Bergmann [this message]
2024-01-11 23:57           ` Guenter Roeck
2024-01-12  3:40             ` Linus Torvalds
2024-01-12  5:24               ` Guenter Roeck
2024-01-12  9:00           ` Christian Brauner
2024-01-23 14:14     ` John Paul Adrian Glaubitz
2024-01-23 15:31       ` Guenter Roeck
2024-01-23 14:14     ` John Paul Adrian Glaubitz
2023-10-25 14:02 ` [PATCH v4 6/6] wire up syscalls for statmount/listmount Miklos Szeredi
2024-01-09  1:11   ` Florian Fainelli
2023-11-01 11:13 ` [PATCH v4 0/6] querying mount attributes Christian Brauner
2023-11-01 13:18   ` Miklos Szeredi
2023-11-01 15:54     ` Christian Brauner
2023-11-01 11:52 ` Ian Kent
2023-11-06 12:10   ` Karel Zak
2023-11-06 13:33     ` Amir Goldstein
2023-11-07  0:47       ` Ian Kent
2023-11-06 23:54     ` Ian Kent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07d8877b-d933-46f4-8ca4-c10ed602f37e@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=amir73il@gmail.com \
    --cc=christian@brauner.io \
    --cc=dalias@libc.org \
    --cc=dhowells@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=kzak@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mattlloydhouse@gmail.com \
    --cc=mszeredi@redhat.com \
    --cc=raven@themaw.net \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).