[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131127145634.GG32267@pd.tnic>
Date: Wed, 27 Nov 2013 15:56:34 +0100
From: Borislav Petkov <bp@...en8.de>
To: Dave Young <dyoung@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-efi@...r.kernel.org,
x86@...nel.org, mjg59@...f.ucam.org, hpa@...or.com,
James.Bottomley@...senPartnership.com, vgoyal@...hat.com,
ebiederm@...ssion.com, horms@...ge.net.au,
kexec@...ts.infradead.org, greg@...ah.com, matt@...sole-pimps.org,
toshi.kani@...com
Subject: Re: [PATCH v4 10/12] x86: export x86 boot_params to sysfs
On Tue, Nov 26, 2013 at 01:57:55PM +0800, Dave Young wrote:
> kexec-tools use boot_params for getting the 1st kernel hardware_subarch,
> the kexec kernel efi runtime support also need read the old efi_info from
> boot_params. Currently it exists in debugfs which is not a good place for
> such infomation. Per HPA, we should avoid of "sploit debugfs".
>
> In this patch /sys/kernel/boot_params are exported, also the setup_data
> is exported as a subdirectory. For original debugfs since it's already
> there for long time and kexec-tools is using it for hardware_subarch so
> let's do not remove them for now.
"kexec-tools is using debugfs for hardware_subarch for a long time now
so we're not removing it yet."
> Structure are like below:
is
>
> /sys/kernel/boot_params
> ├── data /* binary data for boot_params */
You mean "boot_params in binary"?
> ├── setup_data /* subdirectory for setup_data if there's any */
no need for that comment
> │ ├── 0 /* the first setup_data node */
> │ │ ├── data /* binary data for setup_data node 0 */
"setup_data node 0 in binary"
> │ │ └── type /* setup_data type of setup_data node 0, hex string */
> | [snip] /* other setup_data nodes ... */
> └── version /* hex string for boot protocal version */
"boot protocol version (in hex, "0x" prefixed)"
>
> Changelog:
> Greg: use __ATTR_RO() and group attr.
>
> Signed-off-by: Dave Young <dyoung@...hat.com>
> ---
> Documentation/ABI/testing/sysfs-kernel-boot_params | 40 +++
> arch/x86/kernel/Makefile | 2 +-
> arch/x86/kernel/ksysfs.c | 339 +++++++++++++++++++++
> 3 files changed, 380 insertions(+), 1 deletion(-)
> create mode 100644 Documentation/ABI/testing/sysfs-kernel-boot_params
> create mode 100644 arch/x86/kernel/ksysfs.c
>
> diff --git a/Documentation/ABI/testing/sysfs-kernel-boot_params b/Documentation/ABI/testing/sysfs-kernel-boot_params
> new file mode 100644
> index 0000000..8014a93
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-kernel-boot_params
> @@ -0,0 +1,40 @@
> +What: /sys/kernel/boot_params
> +Date: November 2013
> +Contact: Dave Young <dyoung@...hat.com>
> +Description:
> + The /sys/kernel/boot_params directory contains two
> + files: "data" and "version" and one subdirectory "setup_data".
> + It is used to export the kernel boot parameters of x86
"... of an x86 platform to userspace for kexec and debugging purposes."
> + platform to user space for kexec and debugging purpose.
> +
> + If there's no setup_data in boot_params the subdirectory will
> + not be created.
> +
> + "data" file is the binary representation of struct boot_params.
> +
> + "version" file is the string representation of boot
> + protocol version.
> +
> + "setup_data" subdirectory contains the setup_data data
> + structure in boot_params. setup_data is maintained in kernel
> + as a link list. In "setup_data" subdirectory there's one
> + subdirectory for each link list node named with the number
> + of the list nodes. The list node subdirectory contains two
> + files "type" and "data". "type" file is the string
> + representation of setup_data type.
string or int?
> + "data" file is the binary
> + representation of setup_data payload.
> +
> + The whole boot_params directory structure is like below:
> + /sys/kernel/boot_params
> + ├── data
> + ├── setup_data
> + │ ├── 0
> + │ │ ├── data
> + │ │ └── type
> + │ └── 1
> + │ ├── data
> + │ └── type
> + └── version
> +
> +Users:
> + Kexec Mailing List <kexec@...ts.infradead.org>
> diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
> index a5408b9..473a4bb 100644
> --- a/arch/x86/kernel/Makefile
> +++ b/arch/x86/kernel/Makefile
> @@ -35,7 +35,7 @@ obj-y += alternative.o i8253.o pci-nommu.o hw_breakpoint.o
> obj-y += tsc.o io_delay.o rtc.o
> obj-y += pci-iommu_table.o
> obj-y += resource.o
> -
> +obj-$(CONFIG_SYSFS) += ksysfs.o
> obj-y += process.o
> obj-y += i387.o xsave.o
> obj-y += ptrace.o
Conflict with upstream, it should be:
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 9b0a34e2cd79..851dcd1218fc 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -35,6 +35,7 @@ obj-y += alternative.o i8253.o pci-nommu.o hw_breakpoint.o
obj-y += tsc.o io_delay.o rtc.o
obj-y += pci-iommu_table.o
obj-y += resource.o
+obj-$(CONFIG_SYSFS) += ksysfs.o
obj-$(CONFIG_PREEMPT) += preempt.o
> diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
> new file mode 100644
> index 0000000..3f91207
> --- /dev/null
> +++ b/arch/x86/kernel/ksysfs.c
> @@ -0,0 +1,339 @@
> +/*
> + * Architecture specific sysfs attributes in /sys/kernel
Architecture-specific
...
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists