Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1261818 > unrolled thread
| Started by | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| First post | 2015-11-03 20:50 +0100 |
| Last post | 2015-11-10 02:40 +0100 |
| Articles | 16 on this page of 36 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v4] Remove #ifdef CONFIG_* from all userspace headers Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
[PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
Re: [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c kbuild test robot <lkp@intel.com> - 2015-11-03 22:30 +0100
Re: [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c kbuild test robot <lkp@intel.com> - 2015-11-03 22:40 +0100
Re: [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c Peter Zijlstra <peterz@infradead.org> - 2015-11-04 12:50 +0100
Re: [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c Peter Zijlstra <peterz@infradead.org> - 2015-11-04 13:30 +0100
Re: [PATCH 09/13] Move bp_type_idx to kernel/event/hw_breakpoint.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-07 07:50 +0100
[PATCH 03/13] Move COMPAT_ATM_ADDPARTY to net/atm/svc.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
[PATCH 11/13] Always define MAX_RAW_MINORS as 2**20 in userspace Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
Re: [PATCH 11/13] Always define MAX_RAW_MINORS as 2**20 in userspace kbuild test robot <lkp@intel.com> - 2015-11-03 21:20 +0100
[PATCH 13/13] Re-enable and clean up "check_config()" in headers_check.pl Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
Re: [PATCH 13/13] Re-enable and clean up "check_config()" in headers_check.pl kbuild test robot <lkp@intel.com> - 2015-11-03 21:30 +0100
Re: [PATCH 13/13] Re-enable and clean up "check_config()" in headers_check.pl kbuild test robot <lkp@intel.com> - 2015-11-03 21:30 +0100
[PATCH 07/13] Make FB_BACKLIGHT_{LEVELS,MAX} always visible Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
[PATCH 02/13] Use sys_ni.c instead of #ifdef to disable fork on CONFIG_NOMMU Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
[PATCH 01/13] Remove #ifdef CONFIG_64BIT from all asm-generic/fcntl.h Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
[PATCH 12/13] Remove AT_VECTOR_SIZE_ARCH on x86 Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
[PATCH 08/13] Move MAX_SHARED_LIBS to fs/binfmt_flat.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 20:50 +0100
[PATCH 06/13] Move ep_take_care_of_epollwakeup() to fs/eventpoll.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 21:00 +0100
[PATCH 04/13] Always expose MAP_UNINITIALIZED to userspace Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 21:00 +0100
[PATCH 05/13] Split FDPIC "struct elf_prstatus" to "struct elf_fdpic_prstatus" Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-03 21:00 +0100
[PATCH 10/14] Move USE_WCACHING to drivers/block/pktcdvd.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 07/14] Make FB_BACKLIGHT_{LEVELS,MAX} always visible Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 08/14] Move MAX_SHARED_LIBS to fs/binfmt_flat.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 05/14] Split FDPIC "struct elf_prstatus" to "struct elf_fdpic_prstatus" Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 02/14] Use sys_ni.c instead of #ifdef to disable fork on CONFIG_NOMMU Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 11/14] Always define MAX_RAW_MINORS as 2**20 in userspace Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 09/14] Move bp_type_idx to include/linux/hw_breakpoint.h Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 04/14] Always expose MAP_UNINITIALIZED to userspace Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 14/14] Re-enable and clean up "check_config()" in headers_check.pl Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 01/14] Remove #ifdef CONFIG_64BIT from all asm-generic/fcntl.h Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 13/14] Hide CONFIG_PHY_RAM_BASE_ADDRESS from userspace Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 12/14] Remove AT_VECTOR_SIZE_ARCH on x86 Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 03/14] Move COMPAT_ATM_ADDPARTY to net/atm/svc.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH 06/14] Move ep_take_care_of_epollwakeup() to fs/eventpoll.c Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
[PATCH v5] Remove #ifdef CONFIG_* from all userspace headers Palmer Dabbelt <palmer@dabbelt.com> - 2015-11-10 02:40 +0100
Page 2 of 2 — ← Prev page 1 [2]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-03 21:00 +0100 |
| Subject | [PATCH 05/13] Split FDPIC "struct elf_prstatus" to "struct elf_fdpic_prstatus" |
| Message-ID | <qqPUn-79Z-39@gated-at.bofh.it> |
| In reply to | #1261818 |
This is a pretty big change that I haven't tested any, which worries
me a lot. The general idea here is that "struct elf_prstatus" can be
visible to userspace (from <linux/ptrace.h>)
"
Generic ptrace interface that exports the architecture specific
regsets using the corresponding NT_* types (which are also used in
the core dump). Please note that the NT_PRSTATUS note type in a
core dump contains a full 'struct elf_prstatus'. But the
user_regset for NT_PRSTATUS contains just the elf_gregset_t that is
the pr_reg field of 'struct elf_prstatus'. For all the other
user_regset flavors, the user_regset layout and the ELF core dump
note payload are exactly the same layout.
"
so it shouldn't have an "#ifdef CONFIG_" in there.
This splits the structure into two different structures, one still
named "struct elf_prstatus", and one for ELF FDPIC that is named
"struct elf_fdpic_prstatus" -- the idea here is that most users are
standard ELF, so that's the name that didn't change.
I tried to fix all the users of "struct elf_prstatus" that should now
be using "struct elf_fdpic_prstatus". The only testing I did here was
to build a Blackfin defconfig with "struct elf_prstatus" not defined,
and to build an x86 defconfig with "struct elf_fdpic_prstatus" not
defined.
Note that this fails checkpatch.pl with a complaint about wanting open
braces on the same line as struct definitions. The existing struct
definitions in this file have the brace a line afterwards, so I'm
going to leave this alone.
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu>
Reviewed-by: Albert Ou <aou@eecs.berkeley.edu>
---
fs/binfmt_elf_fdpic.c | 6 +++---
fs/proc/kcore.c | 16 ++++++++++++++++
include/linux/kexec.h | 4 ++++
include/uapi/linux/elfcore.h | 37 +++++++++++++++++++++++++++++++++++--
kernel/kexec_core.c | 4 ++++
5 files changed, 62 insertions(+), 5 deletions(-)
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index d3634bf..587bf04 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -1323,7 +1323,7 @@ static inline void fill_note(struct memelfnote *note, const char *name, int type
* fill up all the fields in prstatus from the given task struct, except
* registers which need to be filled up separately.
*/
-static void fill_prstatus(struct elf_prstatus *prstatus,
+static void fill_prstatus(struct elf_fdpic_prstatus *prstatus,
struct task_struct *p, long signr)
{
prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
@@ -1406,7 +1406,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
struct elf_thread_status
{
struct list_head list;
- struct elf_prstatus prstatus; /* NT_PRSTATUS */
+ struct elf_fdpic_prstatus prstatus; /* NT_PRSTATUS */
elf_fpregset_t fpu; /* NT_PRFPREG */
struct task_struct *thread;
#ifdef ELF_CORE_COPY_XFPREGS
@@ -1539,7 +1539,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
loff_t offset = 0, dataoff;
int numnote;
struct memelfnote *notes = NULL;
- struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */
+ struct elf_fdpic_prstatus *prstatus = NULL; /* NT_PRSTATUS */
struct elf_prpsinfo *psinfo = NULL; /* NT_PRPSINFO */
LIST_HEAD(thread_list);
struct list_head *t;
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 92e6726..b1edd77e 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -90,7 +90,11 @@ static size_t get_kcore_size(int *nphdr, size_t *elf_buflen)
(*nphdr + 2)*sizeof(struct elf_phdr) +
3 * ((sizeof(struct elf_note)) +
roundup(sizeof(CORE_STR), 4)) +
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+ roundup(sizeof(struct elf_fdpic_prstatus), 4) +
+#else
roundup(sizeof(struct elf_prstatus), 4) +
+#endif
roundup(sizeof(struct elf_prpsinfo), 4) +
roundup(arch_task_struct_size, 4);
*elf_buflen = PAGE_ALIGN(*elf_buflen);
@@ -318,7 +322,11 @@ static char *storenote(struct memelfnote *men, char *bufp)
*/
static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
{
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+ struct elf_fdpic_prstatus prstatus; /* NT_PRSTATUS */
+#else
struct elf_prstatus prstatus; /* NT_PRSTATUS */
+#endif
struct elf_prpsinfo prpsinfo; /* NT_PRPSINFO */
struct elf_phdr *nhdr, *phdr;
struct elfhdr *elf;
@@ -387,10 +395,18 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
/* set up the process status */
notes[0].name = CORE_STR;
notes[0].type = NT_PRSTATUS;
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+ notes[0].datasz = sizeof(struct elf_fdpic_prstatus);
+#else
notes[0].datasz = sizeof(struct elf_prstatus);
+#endif
notes[0].data = &prstatus;
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+ memset(&prstatus, 0, sizeof(struct elf_fdpic_prstatus));
+#else
memset(&prstatus, 0, sizeof(struct elf_prstatus));
+#endif
nhdr->p_filesz = notesize(¬es[0]);
bufp = storenote(¬es[0], bufp);
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index d140b1e..d9196cc 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -63,7 +63,11 @@
#define KEXEC_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
#define KEXEC_CORE_NOTE_NAME "CORE"
#define KEXEC_CORE_NOTE_NAME_BYTES ALIGN(sizeof(KEXEC_CORE_NOTE_NAME), 4)
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+#define KEXEC_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_fdpic_prstatus), 4)
+#else
#define KEXEC_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
+#endif
/*
* The per-cpu notes area is a list of notes terminated by a "NULL"
* note header. For kdump, the code in vmcore.c runs in the context
diff --git a/include/uapi/linux/elfcore.h b/include/uapi/linux/elfcore.h
index 569737c..697c52d 100644
--- a/include/uapi/linux/elfcore.h
+++ b/include/uapi/linux/elfcore.h
@@ -60,7 +60,40 @@ struct elf_prstatus
long pr_instr; /* Current instruction */
#endif
elf_gregset_t pr_reg; /* GP registers */
-#ifdef CONFIG_BINFMT_ELF_FDPIC
+ int pr_fpvalid; /* True if math co-processor being used. */
+};
+
+/* Architectures that set CONFIG_BINFMT_ELF_FDPIC use this instead of
+ * "struct elf_prstatus".
+ */
+struct elf_fdpic_prstatus
+{
+#if 0
+ long pr_flags; /* XXX Process flags */
+ short pr_why; /* XXX Reason for process halt */
+ short pr_what; /* XXX More detailed reason */
+#endif
+ struct elf_siginfo pr_info; /* Info associated with signal */
+ short pr_cursig; /* Current signal */
+ unsigned long pr_sigpend; /* Set of pending signals */
+ unsigned long pr_sighold; /* Set of held signals */
+#if 0
+ struct sigaltstack pr_altstack; /* Alternate stack info */
+ struct sigaction pr_action; /* Signal action for current sig */
+#endif
+ pid_t pr_pid;
+ pid_t pr_ppid;
+ pid_t pr_pgrp;
+ pid_t pr_sid;
+ struct timeval pr_utime; /* User time */
+ struct timeval pr_stime; /* System time */
+ struct timeval pr_cutime; /* Cumulative user time */
+ struct timeval pr_cstime; /* Cumulative system time */
+#if 0
+ long pr_instr; /* Current instruction */
+#endif
+ elf_gregset_t pr_reg; /* GP registers */
+
/* When using FDPIC, the loadmap addresses need to be communicated
* to GDB in order for GDB to do the necessary relocations. The
* fields (below) used to communicate this information are placed
@@ -69,7 +102,7 @@ struct elf_prstatus
*/
unsigned long pr_exec_fdpic_loadmap;
unsigned long pr_interp_fdpic_loadmap;
-#endif
+
int pr_fpvalid; /* True if math co-processor being used. */
};
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 201b453..8d2fc70 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -977,7 +977,11 @@ static void final_note(u32 *buf)
void crash_save_cpu(struct pt_regs *regs, int cpu)
{
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+ struct elf_fdpic_prstatus prstatus;
+#else
struct elf_prstatus prstatus;
+#endif
u32 *buf;
if ((cpu < 0) || (cpu >= nr_cpu_ids))
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 10/14] Move USE_WCACHING to drivers/block/pktcdvd.c |
| Message-ID | <qt64G-6NO-5@gated-at.bofh.it> |
| In reply to | #1261818 |
I don't think this was ever intended to be exposed to userspace, but
it did require an "#ifdef CONFIG_*". Since the name is kind of
generic and was only used in one place, I've moved the definition to
the one user.
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu>
Reviewed-by: Albert Ou <aou@eecs.berkeley.edu>
---
drivers/block/pktcdvd.c | 11 +++++++++++
include/uapi/linux/pktcdvd.h | 11 -----------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 2f477d4..55f0df3 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -90,6 +90,17 @@ do { \
#define MAX_SPEED 0xffff
+/*
+ * use drive write caching -- we need deferred error handling to be
+ * able to successfully recover with this option (drive will return good
+ * status as soon as the cdb is validated).
+ */
+#if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
+#define USE_WCACHING 1
+#else
+#define USE_WCACHING 0
+#endif
+
static DEFINE_MUTEX(pktcdvd_mutex);
static struct pktcdvd_device *pkt_devs[MAX_WRITERS];
static struct proc_dir_entry *pkt_proc;
diff --git a/include/uapi/linux/pktcdvd.h b/include/uapi/linux/pktcdvd.h
index 2640b9d..05c2bee 100644
--- a/include/uapi/linux/pktcdvd.h
+++ b/include/uapi/linux/pktcdvd.h
@@ -29,17 +29,6 @@
#define PACKET_WAIT_TIME (HZ * 5 / 1000)
/*
- * use drive write caching -- we need deferred error handling to be
- * able to successfully recover with this option (drive will return good
- * status as soon as the cdb is validated).
- */
-#if defined(CONFIG_CDROM_PKTCDVD_WCACHE)
-#define USE_WCACHING 1
-#else
-#define USE_WCACHING 0
-#endif
-
-/*
* No user-servicable parts beyond this point ->
*/
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 07/14] Make FB_BACKLIGHT_{LEVELS,MAX} always visible |
| Message-ID | <qt64G-6NO-7@gated-at.bofh.it> |
| In reply to | #1261818 |
Nothing else in the kernel defines this, and this header is visible to
userspace. Rather than hiding it in an #ifdef, I think it's sane to
just make this visible to userspace.
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu>
Reviewed-by: Albert Ou <aou@eecs.berkeley.edu>
---
include/uapi/linux/fb.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h
index fb795c3..8926f13 100644
--- a/include/uapi/linux/fb.h
+++ b/include/uapi/linux/fb.h
@@ -392,11 +392,8 @@ struct fb_cursor {
struct fb_image image; /* Cursor image */
};
-#ifdef CONFIG_FB_BACKLIGHT
/* Settings for the generic backlight code */
#define FB_BACKLIGHT_LEVELS 128
#define FB_BACKLIGHT_MAX 0xFF
-#endif
-
#endif /* _UAPI_LINUX_FB_H */
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 08/14] Move MAX_SHARED_LIBS to fs/binfmt_flat.c |
| Message-ID | <qt64G-6NO-1@gated-at.bofh.it> |
| In reply to | #1261818 |
I'm not sure what this is, but it doesn't feel like something that
should be exposed to userspace here. I'm assuming this file was
exposed for the structure in it, which doesn't depend on
MAX_SHARED_LIBS.
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu>
Reviewed-by: Albert Ou <aou@eecs.berkeley.edu>
---
fs/binfmt_flat.c | 6 ++++++
include/uapi/linux/flat.h | 6 ------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index f723cd3..e89fb43 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -72,6 +72,12 @@
#define RELOC_FAILED 0xff00ff01 /* Relocation incorrect somewhere */
#define UNLOADED_LIB 0x7ff000ff /* Placeholder for unused library */
+#ifdef CONFIG_BINFMT_SHARED_FLAT
+#define MAX_SHARED_LIBS (4)
+#else
+#define MAX_SHARED_LIBS (1)
+#endif
+
struct lib_info {
struct {
unsigned long start_code; /* Start of text segment */
diff --git a/include/uapi/linux/flat.h b/include/uapi/linux/flat.h
index 88cd6ba..1b177c7 100644
--- a/include/uapi/linux/flat.h
+++ b/include/uapi/linux/flat.h
@@ -13,12 +13,6 @@
#define FLAT_VERSION 0x00000004L
-#ifdef CONFIG_BINFMT_SHARED_FLAT
-#define MAX_SHARED_LIBS (4)
-#else
-#define MAX_SHARED_LIBS (1)
-#endif
-
/*
* To make everything easier to port and manage cross platform
* development, all fields are in network byte order.
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 05/14] Split FDPIC "struct elf_prstatus" to "struct elf_fdpic_prstatus" |
| Message-ID | <qt64G-6NO-17@gated-at.bofh.it> |
| In reply to | #1261818 |
This is a pretty big change that I haven't tested any, which worries
me a lot. The general idea here is that "struct elf_prstatus" can be
visible to userspace (from <linux/ptrace.h>)
"
Generic ptrace interface that exports the architecture specific
regsets using the corresponding NT_* types (which are also used in
the core dump). Please note that the NT_PRSTATUS note type in a
core dump contains a full 'struct elf_prstatus'. But the
user_regset for NT_PRSTATUS contains just the elf_gregset_t that is
the pr_reg field of 'struct elf_prstatus'. For all the other
user_regset flavors, the user_regset layout and the ELF core dump
note payload are exactly the same layout.
"
so it shouldn't have an "#ifdef CONFIG_" in there.
This splits the structure into two different structures, one still
named "struct elf_prstatus", and one for ELF FDPIC that is named
"struct elf_fdpic_prstatus" -- the idea here is that most users are
standard ELF, so that's the name that didn't change.
I tried to fix all the users of "struct elf_prstatus" that should now
be using "struct elf_fdpic_prstatus". The only testing I did here was
to build a Blackfin defconfig with "struct elf_prstatus" not defined,
and to build an x86 defconfig with "struct elf_fdpic_prstatus" not
defined.
Note that this fails checkpatch.pl with a complaint about wanting open
braces on the same line as struct definitions. The existing struct
definitions in this file have the brace a line afterwards, so I'm
going to leave this alone.
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu>
Reviewed-by: Albert Ou <aou@eecs.berkeley.edu>
---
fs/binfmt_elf_fdpic.c | 6 +++---
fs/proc/kcore.c | 16 ++++++++++++++++
include/linux/kexec.h | 4 ++++
include/uapi/linux/elfcore.h | 37 +++++++++++++++++++++++++++++++++++--
kernel/kexec_core.c | 4 ++++
5 files changed, 62 insertions(+), 5 deletions(-)
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index d3634bf..587bf04 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -1323,7 +1323,7 @@ static inline void fill_note(struct memelfnote *note, const char *name, int type
* fill up all the fields in prstatus from the given task struct, except
* registers which need to be filled up separately.
*/
-static void fill_prstatus(struct elf_prstatus *prstatus,
+static void fill_prstatus(struct elf_fdpic_prstatus *prstatus,
struct task_struct *p, long signr)
{
prstatus->pr_info.si_signo = prstatus->pr_cursig = signr;
@@ -1406,7 +1406,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
struct elf_thread_status
{
struct list_head list;
- struct elf_prstatus prstatus; /* NT_PRSTATUS */
+ struct elf_fdpic_prstatus prstatus; /* NT_PRSTATUS */
elf_fpregset_t fpu; /* NT_PRFPREG */
struct task_struct *thread;
#ifdef ELF_CORE_COPY_XFPREGS
@@ -1539,7 +1539,7 @@ static int elf_fdpic_core_dump(struct coredump_params *cprm)
loff_t offset = 0, dataoff;
int numnote;
struct memelfnote *notes = NULL;
- struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */
+ struct elf_fdpic_prstatus *prstatus = NULL; /* NT_PRSTATUS */
struct elf_prpsinfo *psinfo = NULL; /* NT_PRPSINFO */
LIST_HEAD(thread_list);
struct list_head *t;
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 92e6726..b1edd77e 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -90,7 +90,11 @@ static size_t get_kcore_size(int *nphdr, size_t *elf_buflen)
(*nphdr + 2)*sizeof(struct elf_phdr) +
3 * ((sizeof(struct elf_note)) +
roundup(sizeof(CORE_STR), 4)) +
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+ roundup(sizeof(struct elf_fdpic_prstatus), 4) +
+#else
roundup(sizeof(struct elf_prstatus), 4) +
+#endif
roundup(sizeof(struct elf_prpsinfo), 4) +
roundup(arch_task_struct_size, 4);
*elf_buflen = PAGE_ALIGN(*elf_buflen);
@@ -318,7 +322,11 @@ static char *storenote(struct memelfnote *men, char *bufp)
*/
static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
{
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+ struct elf_fdpic_prstatus prstatus; /* NT_PRSTATUS */
+#else
struct elf_prstatus prstatus; /* NT_PRSTATUS */
+#endif
struct elf_prpsinfo prpsinfo; /* NT_PRPSINFO */
struct elf_phdr *nhdr, *phdr;
struct elfhdr *elf;
@@ -387,10 +395,18 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
/* set up the process status */
notes[0].name = CORE_STR;
notes[0].type = NT_PRSTATUS;
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+ notes[0].datasz = sizeof(struct elf_fdpic_prstatus);
+#else
notes[0].datasz = sizeof(struct elf_prstatus);
+#endif
notes[0].data = &prstatus;
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+ memset(&prstatus, 0, sizeof(struct elf_fdpic_prstatus));
+#else
memset(&prstatus, 0, sizeof(struct elf_prstatus));
+#endif
nhdr->p_filesz = notesize(¬es[0]);
bufp = storenote(¬es[0], bufp);
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index d140b1e..d9196cc 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -63,7 +63,11 @@
#define KEXEC_NOTE_HEAD_BYTES ALIGN(sizeof(struct elf_note), 4)
#define KEXEC_CORE_NOTE_NAME "CORE"
#define KEXEC_CORE_NOTE_NAME_BYTES ALIGN(sizeof(KEXEC_CORE_NOTE_NAME), 4)
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+#define KEXEC_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_fdpic_prstatus), 4)
+#else
#define KEXEC_CORE_NOTE_DESC_BYTES ALIGN(sizeof(struct elf_prstatus), 4)
+#endif
/*
* The per-cpu notes area is a list of notes terminated by a "NULL"
* note header. For kdump, the code in vmcore.c runs in the context
diff --git a/include/uapi/linux/elfcore.h b/include/uapi/linux/elfcore.h
index 569737c..697c52d 100644
--- a/include/uapi/linux/elfcore.h
+++ b/include/uapi/linux/elfcore.h
@@ -60,7 +60,40 @@ struct elf_prstatus
long pr_instr; /* Current instruction */
#endif
elf_gregset_t pr_reg; /* GP registers */
-#ifdef CONFIG_BINFMT_ELF_FDPIC
+ int pr_fpvalid; /* True if math co-processor being used. */
+};
+
+/* Architectures that set CONFIG_BINFMT_ELF_FDPIC use this instead of
+ * "struct elf_prstatus".
+ */
+struct elf_fdpic_prstatus
+{
+#if 0
+ long pr_flags; /* XXX Process flags */
+ short pr_why; /* XXX Reason for process halt */
+ short pr_what; /* XXX More detailed reason */
+#endif
+ struct elf_siginfo pr_info; /* Info associated with signal */
+ short pr_cursig; /* Current signal */
+ unsigned long pr_sigpend; /* Set of pending signals */
+ unsigned long pr_sighold; /* Set of held signals */
+#if 0
+ struct sigaltstack pr_altstack; /* Alternate stack info */
+ struct sigaction pr_action; /* Signal action for current sig */
+#endif
+ pid_t pr_pid;
+ pid_t pr_ppid;
+ pid_t pr_pgrp;
+ pid_t pr_sid;
+ struct timeval pr_utime; /* User time */
+ struct timeval pr_stime; /* System time */
+ struct timeval pr_cutime; /* Cumulative user time */
+ struct timeval pr_cstime; /* Cumulative system time */
+#if 0
+ long pr_instr; /* Current instruction */
+#endif
+ elf_gregset_t pr_reg; /* GP registers */
+
/* When using FDPIC, the loadmap addresses need to be communicated
* to GDB in order for GDB to do the necessary relocations. The
* fields (below) used to communicate this information are placed
@@ -69,7 +102,7 @@ struct elf_prstatus
*/
unsigned long pr_exec_fdpic_loadmap;
unsigned long pr_interp_fdpic_loadmap;
-#endif
+
int pr_fpvalid; /* True if math co-processor being used. */
};
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 11b64a6..9cb496b 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -977,7 +977,11 @@ static void final_note(u32 *buf)
void crash_save_cpu(struct pt_regs *regs, int cpu)
{
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+ struct elf_fdpic_prstatus prstatus;
+#else
struct elf_prstatus prstatus;
+#endif
u32 *buf;
if ((cpu < 0) || (cpu >= nr_cpu_ids))
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 02/14] Use sys_ni.c instead of #ifdef to disable fork on CONFIG_NOMMU |
| Message-ID | <qt64G-6NO-19@gated-at.bofh.it> |
| In reply to | #1261818 |
I think this change actually doesn't do anything: __NR_fork was still being defined either way, and on my machine fork() in <unistd.h> comes from libc. This just moves to the standard mechanism for defining syscalls that aren't implemented instead, which has the side-effect of no longer having an #ifdef CONFIG_* in a user-visible header. Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com> Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu> Reviewed-by: Albert Ou <aou@eecs.berkeley.edu> --- include/uapi/asm-generic/unistd.h | 4 ---- kernel/sys_ni.c | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h index 1324b02..9a95912 100644 --- a/include/uapi/asm-generic/unistd.h +++ b/include/uapi/asm-generic/unistd.h @@ -871,11 +871,7 @@ __SYSCALL(__NR_uselib, sys_uselib) __SYSCALL(__NR__sysctl, sys_sysctl) #define __NR_fork 1079 -#ifdef CONFIG_MMU __SYSCALL(__NR_fork, sys_fork) -#else -__SYSCALL(__NR_fork, sys_ni_syscall) -#endif /* CONFIG_MMU */ #undef __NR_syscalls #define __NR_syscalls (__NR_fork+1) diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index 0623787..e251b30 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -174,6 +174,7 @@ cond_syscall(sys_setfsuid); cond_syscall(sys_setfsgid); cond_syscall(sys_capget); cond_syscall(sys_capset); +cond_syscall(sys_fork); /* arch-specific weak syscall entries */ cond_syscall(sys_pciconfig_read); -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 11/14] Always define MAX_RAW_MINORS as 2**20 in userspace |
| Message-ID | <qt64G-6NO-9@gated-at.bofh.it> |
| In reply to | #1261818 |
While I don't think this was ever meant to be exposed to userspace, if
anyone is using it then this will at least provide a correct (if
unlikely) definition.
MAX_RAW_MINORS used to be used in the kernel, where it's been replaced
with CONFIG_MAX_RAW_MINORS.
Note that there's a checkpatch.pl warning about a split config string
here, but I've left that alone.
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu>
Reviewed-by: Albert Ou <aou@eecs.berkeley.edu>
---
drivers/char/raw.c | 7 ++++---
include/uapi/linux/raw.h | 2 +-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index 60316fb..2a69117 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -36,7 +36,7 @@ static struct raw_device_data *raw_devices;
static DEFINE_MUTEX(raw_mutex);
static const struct file_operations raw_ctl_fops; /* forward declaration */
-static int max_raw_minors = MAX_RAW_MINORS;
+static int max_raw_minors = CONFIG_MAX_RAW_DEVS;
module_param(max_raw_minors, int, 0);
MODULE_PARM_DESC(max_raw_minors, "Maximum number of raw devices (1-65536)");
@@ -317,8 +317,9 @@ static int __init raw_init(void)
if (max_raw_minors < 1 || max_raw_minors > 65536) {
printk(KERN_WARNING "raw: invalid max_raw_minors (must be"
- " between 1 and 65536), using %d\n", MAX_RAW_MINORS);
- max_raw_minors = MAX_RAW_MINORS;
+ " between 1 and 65536), using %d\n",
+ max_raw_minors);
+ max_raw_minors = 65536;
}
raw_devices = vzalloc(sizeof(struct raw_device_data) * max_raw_minors);
diff --git a/include/uapi/linux/raw.h b/include/uapi/linux/raw.h
index 62d543e..f3d009b 100644
--- a/include/uapi/linux/raw.h
+++ b/include/uapi/linux/raw.h
@@ -13,6 +13,6 @@ struct raw_config_request
__u64 block_minor;
};
-#define MAX_RAW_MINORS CONFIG_MAX_RAW_DEVS
+#define MAX_RAW_MINORS (1 << 20)
#endif /* __LINUX_RAW_H */
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 09/14] Move bp_type_idx to include/linux/hw_breakpoint.h |
| Message-ID | <qt64G-6NO-15@gated-at.bofh.it> |
| In reply to | #1261818 |
This has a "#ifdef CONFIG_*" that used to be exposed to userspace.
The names in here are so generic that I don't think it's a good idea
to expose them to userspace (or even the rest of the kernel). There are
multiple in-kernel users, so it's been moved to a kernel header file.
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu>
Reviewed-by: Albert Ou <aou@eecs.berkeley.edu>
---
include/linux/hw_breakpoint.h | 10 ++++++++++
include/uapi/linux/hw_breakpoint.h | 10 ----------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/linux/hw_breakpoint.h b/include/linux/hw_breakpoint.h
index 0464c85..dfe0376 100644
--- a/include/linux/hw_breakpoint.h
+++ b/include/linux/hw_breakpoint.h
@@ -6,6 +6,16 @@
#ifdef CONFIG_HAVE_HW_BREAKPOINT
+enum bp_type_idx {
+ TYPE_INST = 0,
+#if defined(CONFIG_HAVE_MIXED_BREAKPOINTS_REGS)
+ TYPE_DATA = 0,
+#else
+ TYPE_DATA = 1,
+#endif
+ TYPE_MAX
+};
+
extern int __init init_hw_breakpoint(void);
static inline void hw_breakpoint_init(struct perf_event_attr *attr)
diff --git a/include/uapi/linux/hw_breakpoint.h b/include/uapi/linux/hw_breakpoint.h
index b04000a..7a6a5a7 100644
--- a/include/uapi/linux/hw_breakpoint.h
+++ b/include/uapi/linux/hw_breakpoint.h
@@ -17,14 +17,4 @@ enum {
HW_BREAKPOINT_INVALID = HW_BREAKPOINT_RW | HW_BREAKPOINT_X,
};
-enum bp_type_idx {
- TYPE_INST = 0,
-#ifdef CONFIG_HAVE_MIXED_BREAKPOINTS_REGS
- TYPE_DATA = 0,
-#else
- TYPE_DATA = 1,
-#endif
- TYPE_MAX
-};
-
#endif /* _UAPI_LINUX_HW_BREAKPOINT_H */
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 04/14] Always expose MAP_UNINITIALIZED to userspace |
| Message-ID | <qt64H-6NO-35@gated-at.bofh.it> |
| In reply to | #1261818 |
This used to be hidden behind CONFIG_MMAP_ALLOW_UNINITIALIZED, so userspace wouldn't actually ever see it be non-zero. While I had originally hoped to avoid hiding it, it looks like this conflicts with MAP_HUGE_SHIFT so I think it's safer to just keep this 0. Architectures that want to define this can still override it. In fact, the Xtensa port already overrides it in a very similar manner to the previously broken one (but due to lots of conflicting opinions on how to solve this correctly, I'm just taking the easy way out and letting their arch maintainers deal with it -- sorry). Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com> Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu> Reviewed-by: Albert Ou <aou@eecs.berkeley.edu> --- include/uapi/asm-generic/mman-common.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h index a74dd84..25ca92c 100644 --- a/include/uapi/asm-generic/mman-common.h +++ b/include/uapi/asm-generic/mman-common.h @@ -19,9 +19,7 @@ #define MAP_TYPE 0x0f /* Mask for type of mapping */ #define MAP_FIXED 0x10 /* Interpret addr exactly */ #define MAP_ANONYMOUS 0x20 /* don't use a file */ -#ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED -# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */ -#else +#ifndef MAP_UNINITIALIZED # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */ #endif -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 14/14] Re-enable and clean up "check_config()" in headers_check.pl |
| Message-ID | <qt64H-6NO-41@gated-at.bofh.it> |
| In reply to | #1261818 |
I recently got bit by a CONFIG_ in userspace bug. This has apparently
happened before, but the check got disabled for triggering too much.
In order to reduce false positives, I added some hueristics to avoid
detecting comments.
Since these tests all pass, I've now re-enabled them.
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu>
Reviewed-by: Albert Ou <aou@eecs.berkeley.edu>
---
scripts/headers_check.pl | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl
index 62320f9..1634b51 100755
--- a/scripts/headers_check.pl
+++ b/scripts/headers_check.pl
@@ -27,6 +27,7 @@ my $ret = 0;
my $line;
my $lineno = 0;
my $filename;
+my $check_config_in_multiline_comment = 0;
foreach my $file (@files) {
$filename = $file;
@@ -40,7 +41,7 @@ foreach my $file (@files) {
&check_asm_types();
&check_sizetypes();
&check_declarations();
- # Dropped for now. Too much noise &check_config();
+ &check_config();
}
close $fh;
}
@@ -78,7 +79,21 @@ sub check_declarations
sub check_config
{
- if ($line =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9_]+)[^a-zA-Z0-9_]/) {
+ my $nocomments = $line;
+ $nocomments =~ s/\/\*.*\*\///; # Remove ANSI-style comments (/* to */)
+ $nocomments =~ s/\/\/.*//; # Remove C99-style comments (// to EOL)
+
+ # Check to see if we're within a multiline comment, and if so
+ # just remove the whole line. I tried matching on '^ * ', but
+ # there's one header that doesn't prepend multi-line comments
+ # with * so that won't work.
+ if ($nocomments =~ m/\/\*/) { $check_config_in_multiline_comment = 1; }
+ if ($nocomments =~ m/\*\//) { $check_config_in_multiline_comment = 0; }
+ if ($check_config_in_multiline_comment == 1) { $nocomments = "" }
+
+ # Check to see if there is something that looks like CONFIG_
+ # inside a userspace-accessible header file and if so, print that out.
+ if ($nocomments =~ m/[^a-zA-Z0-9_]+CONFIG_([a-zA-Z0-9_]+)[^a-zA-Z0-9_]/) {
printf STDERR "$filename:$lineno: leaks CONFIG_$1 to userspace where it is not valid\n";
}
}
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 01/14] Remove #ifdef CONFIG_64BIT from all asm-generic/fcntl.h |
| Message-ID | <qt64H-6NO-43@gated-at.bofh.it> |
| In reply to | #1261818 |
When working on the RISC-V port I noticed that F_SETLK64 was being defined on our 64-bit platform, despite our port being so new that we've only ever had the 64-bit file ops. Since there's not compat layer for these, this causes fcntl to bail out. It turns out that one of the ways in with F_SETLK64 was being defined (there's some more in glibc, but that's a whole different story... :)) is the result of CONFIG_64BIT showing up in this user-visible header. <asm-generic/bitsperlong.h> confirms this isn't sane, so I replaced it with a __BITS_PER_LONG check. Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com> Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu> Reviewed-by: Albert Ou <aou@eecs.berkeley.edu> Reviewed-by: Arnd Bergmann <arnd@arndb.de> --- include/uapi/asm-generic/fcntl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h index e063eff..14a5c82 100644 --- a/include/uapi/asm-generic/fcntl.h +++ b/include/uapi/asm-generic/fcntl.h @@ -1,6 +1,7 @@ #ifndef _ASM_GENERIC_FCNTL_H #define _ASM_GENERIC_FCNTL_H +#include <asm/bitsperlong.h> #include <linux/types.h> /* @@ -115,7 +116,7 @@ #define F_GETSIG 11 /* for sockets. */ #endif -#ifndef CONFIG_64BIT +#if (__BITS_PER_LONG == 32) #ifndef F_GETLK64 #define F_GETLK64 12 /* using 'struct flock64' */ #define F_SETLK64 13 -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 13/14] Hide CONFIG_PHY_RAM_BASE_ADDRESS from userspace |
| Message-ID | <qt64H-6NO-45@gated-at.bofh.it> |
| In reply to | #1261818 |
This feels a bit odd, but I couldn't really come up with a better way to do it. There already appears to be a workaround for this macro not being defined in userspace, so I figured I'd better leave that in place, since someone is probably using it. The result is that unless you include <asm/fixed_code.h> before <uapi/asm/fixed_code.h> then you'll get the wrong offsets. The only user of <uapi/asm/fixed_code.h> is currently <asm/fixed_code.h>, so it's at least safe for now. There's a CPP error in there to check for this. --- arch/blackfin/include/asm/fixed_code.h | 6 +++++ arch/blackfin/include/uapi/asm/fixed_code.h | 35 ++++++++++++++++------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/arch/blackfin/include/asm/fixed_code.h b/arch/blackfin/include/asm/fixed_code.h index bc330f0..7e03b9b 100644 --- a/arch/blackfin/include/asm/fixed_code.h +++ b/arch/blackfin/include/asm/fixed_code.h @@ -9,6 +9,12 @@ #ifndef __BFIN_ASM_FIXED_CODE_H__ #define __BFIN_ASM_FIXED_CODE_H__ +#ifdef CONFIG_PHY_RAM_BASE_ADDRESS +#define CONFIG_PHY_RAM_BASE_ADDRESS 0x0 +#endif + +#define PHY_RAM_BASE_ADDRESS CONFIG_PHY_RAM_BASE_ADDRESS + #include <uapi/asm/fixed_code.h> #ifndef __ASSEMBLY__ diff --git a/arch/blackfin/include/uapi/asm/fixed_code.h b/arch/blackfin/include/uapi/asm/fixed_code.h index 3bef1dc..50b70a0 100644 --- a/arch/blackfin/include/uapi/asm/fixed_code.h +++ b/arch/blackfin/include/uapi/asm/fixed_code.h @@ -10,29 +10,32 @@ #ifndef _UAPI__BFIN_ASM_FIXED_CODE_H__ #define _UAPI__BFIN_ASM_FIXED_CODE_H__ - -#ifndef CONFIG_PHY_RAM_BASE_ADDRESS -#define CONFIG_PHY_RAM_BASE_ADDRESS 0x0 +#ifndef PHY_RAM_BASE_ADDRESS +#ifdef __KERNEL__ +#error "Don't include <uapi/asm/fixed_code.h>, include <asm/fixed_code.h>" +#else +#define PHY_RAM_BASE_ADDRESS 0x0 +#endif #endif -#define FIXED_CODE_START (CONFIG_PHY_RAM_BASE_ADDRESS + 0x400) +#define FIXED_CODE_START (PHY_RAM_BASE_ADDRESS + 0x400) -#define SIGRETURN_STUB (CONFIG_PHY_RAM_BASE_ADDRESS + 0x400) +#define SIGRETURN_STUB (PHY_RAM_BASE_ADDRESS + 0x400) -#define ATOMIC_SEQS_START (CONFIG_PHY_RAM_BASE_ADDRESS + 0x410) +#define ATOMIC_SEQS_START (PHY_RAM_BASE_ADDRESS + 0x410) -#define ATOMIC_XCHG32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x410) -#define ATOMIC_CAS32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x420) -#define ATOMIC_ADD32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x430) -#define ATOMIC_SUB32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x440) -#define ATOMIC_IOR32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x450) -#define ATOMIC_AND32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x460) -#define ATOMIC_XOR32 (CONFIG_PHY_RAM_BASE_ADDRESS + 0x470) +#define ATOMIC_XCHG32 (PHY_RAM_BASE_ADDRESS + 0x410) +#define ATOMIC_CAS32 (PHY_RAM_BASE_ADDRESS + 0x420) +#define ATOMIC_ADD32 (PHY_RAM_BASE_ADDRESS + 0x430) +#define ATOMIC_SUB32 (PHY_RAM_BASE_ADDRESS + 0x440) +#define ATOMIC_IOR32 (PHY_RAM_BASE_ADDRESS + 0x450) +#define ATOMIC_AND32 (PHY_RAM_BASE_ADDRESS + 0x460) +#define ATOMIC_XOR32 (PHY_RAM_BASE_ADDRESS + 0x470) -#define ATOMIC_SEQS_END (CONFIG_PHY_RAM_BASE_ADDRESS + 0x480) +#define ATOMIC_SEQS_END (PHY_RAM_BASE_ADDRESS + 0x480) -#define SAFE_USER_INSTRUCTION (CONFIG_PHY_RAM_BASE_ADDRESS + 0x480) +#define SAFE_USER_INSTRUCTION (PHY_RAM_BASE_ADDRESS + 0x480) -#define FIXED_CODE_END (CONFIG_PHY_RAM_BASE_ADDRESS + 0x490) +#define FIXED_CODE_END (PHY_RAM_BASE_ADDRESS + 0x490) #endif /* _UAPI__BFIN_ASM_FIXED_CODE_H__ */ -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 12/14] Remove AT_VECTOR_SIZE_ARCH on x86 |
| Message-ID | <qt64H-6NO-51@gated-at.bofh.it> |
| In reply to | #1261818 |
It looks like there aren't actually users of this macro anywhere: * The kernel doesn't use it on x86 because we don't suppor ELF FDPIC. * The only Google results point to LMKL patches, both the one that wrote this (from 2010) and my patch to hide it behind __KERNEL__. * I grep'd through all the source tarballs on my machine, and the only packages that matched were the kernel and crui (which copied a PPC kernel header). Since I'm not sure how to actually provide the right answer (if I understand correctly, CONFIG_IA32_EMULATION is not __i386__), the only thing I can think of to do is to just remove the definition. Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com> Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu> Reviewed-by: Albert Ou <aou@eecs.berkeley.edu> --- arch/x86/include/uapi/asm/auxvec.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/arch/x86/include/uapi/asm/auxvec.h b/arch/x86/include/uapi/asm/auxvec.h index 77203ac..1316b4c 100644 --- a/arch/x86/include/uapi/asm/auxvec.h +++ b/arch/x86/include/uapi/asm/auxvec.h @@ -9,11 +9,4 @@ #endif #define AT_SYSINFO_EHDR 33 -/* entries in ARCH_DLINFO: */ -#if defined(CONFIG_IA32_EMULATION) || !defined(CONFIG_X86_64) -# define AT_VECTOR_SIZE_ARCH 2 -#else /* else it's non-compat x86-64 */ -# define AT_VECTOR_SIZE_ARCH 1 -#endif - #endif /* _ASM_X86_AUXVEC_H */ -- 2.4.10 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 03/14] Move COMPAT_ATM_ADDPARTY to net/atm/svc.c |
| Message-ID | <qt64I-6NO-59@gated-at.bofh.it> |
| In reply to | #1261818 |
This used to be behind an #ifdef COMPAT_COMPAT, so most of userspace
wouldn't have seen the definition before. Unfortunately this header
file became visible to userspace, so the definition has instead been
moved to net/atm/svc.c (the only user).
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu>
Reviewed-by: Albert Ou <aou@eecs.berkeley.edu>
---
include/uapi/linux/atmdev.h | 4 ----
net/atm/svc.c | 5 +++++
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/include/uapi/linux/atmdev.h b/include/uapi/linux/atmdev.h
index 93e0ec0..3dcec70 100644
--- a/include/uapi/linux/atmdev.h
+++ b/include/uapi/linux/atmdev.h
@@ -100,10 +100,6 @@ struct atm_dev_stats {
/* use backend to make new if */
#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
/* add party to p2mp call */
-#ifdef CONFIG_COMPAT
-/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
-#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
-#endif
#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int)
/* drop party from p2mp call */
diff --git a/net/atm/svc.c b/net/atm/svc.c
index 3fa0a9e..9e2e6ef 100644
--- a/net/atm/svc.c
+++ b/net/atm/svc.c
@@ -27,6 +27,11 @@
#include "signaling.h"
#include "addr.h"
+#ifdef CONFIG_COMPAT
+/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
+#define COMPAT_ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4, struct compat_atm_iobuf)
+#endif
+
static int svc_create(struct net *net, struct socket *sock, int protocol,
int kern);
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH 06/14] Move ep_take_care_of_epollwakeup() to fs/eventpoll.c |
| Message-ID | <qt64I-6NO-61@gated-at.bofh.it> |
| In reply to | #1261818 |
This doesn't make any sense to expose to userspace, so it's been moved
to the one user. This was introduced by commit 95f19f658ce1 ("epoll:
drop EPOLLWAKEUP if PM_SLEEP is disabled").
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Reviewed-by: Andrew Waterman <waterman@eecs.berkeley.edu>
Reviewed-by: Albert Ou <aou@eecs.berkeley.edu>
---
fs/eventpoll.c | 13 +++++++++++++
include/uapi/linux/eventpoll.h | 12 ------------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 1e009ca..aadee3d 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1812,6 +1812,19 @@ SYSCALL_DEFINE1(epoll_create, int, size)
return sys_epoll_create1(0);
}
+#ifdef CONFIG_PM_SLEEP
+static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
+{
+ if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND))
+ epev->events &= ~EPOLLWAKEUP;
+}
+#else
+static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
+{
+ epev->events &= ~EPOLLWAKEUP;
+}
+#endif
+
/*
* The following function implements the controller interface for
* the eventpoll file that enables the insertion/removal/change of
diff --git a/include/uapi/linux/eventpoll.h b/include/uapi/linux/eventpoll.h
index bc81fb2..7850373 100644
--- a/include/uapi/linux/eventpoll.h
+++ b/include/uapi/linux/eventpoll.h
@@ -61,16 +61,4 @@ struct epoll_event {
__u64 data;
} EPOLL_PACKED;
-#ifdef CONFIG_PM_SLEEP
-static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
-{
- if ((epev->events & EPOLLWAKEUP) && !capable(CAP_BLOCK_SUSPEND))
- epev->events &= ~EPOLLWAKEUP;
-}
-#else
-static inline void ep_take_care_of_epollwakeup(struct epoll_event *epev)
-{
- epev->events &= ~EPOLLWAKEUP;
-}
-#endif
#endif /* _UAPI_LINUX_EVENTPOLL_H */
--
2.4.10
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Palmer Dabbelt <palmer@dabbelt.com> |
|---|---|
| Date | 2015-11-10 02:40 +0100 |
| Subject | [PATCH v5] Remove #ifdef CONFIG_* from all userspace headers |
| Message-ID | <qt64G-6NO-3@gated-at.bofh.it> |
| In reply to | #1261818 |
I think this should _actually_ be ready to go this time, the buildbot found some errors in arches that I didn't test for. Changes since v4 (<1446579994-9937-1-git-send-email-palmer@dabbelt.com>) * #9 was changed to work on arm by moving the enum to an in-kernel header file. * #13 was added, this fixes a problem on blackfin. Changes since v3 (<1442271047-4908-1-git-send-email-palmer@dabbelt.com>) * #4 is very different: rather than defining a canonical value for MAP_UNINITIALIZED, it just punts on the problem and lets arch maintainers deal with it. There's still an #ifndef MAP_UNINITIALIZED in there, but that shouldn't get triggered by anything because the arch headers should set it to whatever they actually want. * #11 defines MAX_RAW_MINORS to 2^20 instead of 2^16. * #13 moves the variable around a bit so it gets initialized. I forgot I was in perl and not C :). Changes since v2 (<1441832902-28993-1-git-send-email-palmer@dabbelt.com>) * Patch set renamed. * #2 is rewritten to use sys_ni.c instead of an #ifdef * #3, #6, #8, #9, #10, and #11 no longer use "#ifdef __KERNEL__" but have instead moved the offending lines to the correct, kernel-only files. * #4 has been rewritten to always define MAP_UNINITIALIZED to non-zero, rather than defining it to zero when in userspace. * #5 got a whole lot longer -- rather than just always hiding these fields from userspace, there is now a second "struct elf_fdpic_prstatus" structure. This should allow userspace to parse core dumps correctly. * Rebased onto 9c488de24f7264f08d341024bffdd637b4d04c96. Changes since v1 (<1441152610-22566-1-git-send-email-palmer@dabbelt.com>) * All patches but #1 were added. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | linux.kernel
csiph-web