All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC
       [not found] <4FEC8931.5020001@dell.com>
@ 2012-06-28 16:45 ` Srinivas_G_Gowda
  2012-06-29  0:01   ` Andi Kleen
  0 siblings, 1 reply; 8+ messages in thread
From: Srinivas_G_Gowda @ 2012-06-28 16:45 UTC (permalink / raw)
  To: tcminyard, linux-kernel, openipmi


functions that will send the Set System Info command
and its corresponding handler

Signed-off-by: Srinivas Gowda G <Srinivas_G_Gowda@Dell.com>
---
 drivers/char/ipmi/ipmi_msghandler.c |   73 +++++++++++++++++++++++++++++++++++
 include/linux/ipmi_msgdefs.h        |    1 +
 2 files changed, 74 insertions(+), 0 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index d0abb3a..b1a98b5 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -2709,6 +2709,79 @@ get_guid(ipmi_smi_t intf)
 	intf->null_user_handler = NULL;
 }
 
+static int 
+send_set_os_name_cmd(ipmi_smi_t intf)
+{
+	unsigned char param_select;
+	unsigned char set_selector;
+	unsigned char string_encode;
+	unsigned char str_len;
+	unsigned char data[9];
+
+	struct kernel_ipmi_msg            msg;
+	struct ipmi_system_interface_addr si;
+
+	si.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
+	si.channel = IPMI_BMC_CHANNEL;
+	si.lun = 0;
+	
+	param_select  = 4;	/* parameter number for volatile OS name */
+	set_selector  = 0;	/* set selector, block 0 */
+	string_encode = 0;	/* ASCII Encoding */
+	str_len = 5;		/* length of ASCII string - "Linux" */
+	
+	data[0] = param_select;
+	data[1] = set_selector;
+	data[2] = string_encode;
+	data[3] = str_len;
+	data[4] = 'L';
+	data[5] = 'i';
+	data[6] = 'n';
+	data[7] = 'u';
+	data[8] = 'x';
+
+	msg.netfn = IPMI_NETFN_APP_REQUEST;
+	msg.cmd = IPMI_SET_SYSTEM_INFO;
+	msg.data = data;
+	msg.data_len = 9;
+	return i_ipmi_request(NULL,
+			      intf,
+			      (struct ipmi_addr *) &si,
+			      0,
+			      &msg,
+			      intf,
+			      NULL,
+			      NULL,
+			      0,
+			      intf->channels[0].address,
+			      intf->channels[0].lun,
+			      -1, 0);
+}
+
+/*
+ * msg handler for Set_System_Info cmd - set OS name 
+ */
+static void
+set_os_name_handler(ipmi_smi_t intf, struct ipmi_recv_msg *msg)
+{
+	if ((msg->addr.addr_type != IPMI_SYSTEM_INTERFACE_ADDR_TYPE)
+	    || (msg->msg.netfn != IPMI_NETFN_APP_RESPONSE)
+	    || (msg->msg.cmd != IPMI_SET_SYSTEM_INFO))
+		/* Not for me */
+		return;
+
+	if (msg->msg.data[0] != 0) 
+		/* Error  setting OS name as Linux in BMC. */
+		printk(KERN_WARNING PFX 
+			"Failed to set OS name as Linux: 0x%X\n", msg->msg.data[0]);
+	else
+		printk(KERN_INFO PFX 
+			"OS Name successfully set as Linux\n");		
+
+	os_name_set = 1;
+	wake_up(&intf->waitq);
+}
+
 /*
  *   Set the Operating System Name as "Linux" in BMC 
  *   using "Set System Info" command.
diff --git a/include/linux/ipmi_msgdefs.h b/include/linux/ipmi_msgdefs.h
index df97e6e..b5ea664 100644
--- a/include/linux/ipmi_msgdefs.h
+++ b/include/linux/ipmi_msgdefs.h
@@ -57,6 +57,7 @@
 #define IPMI_GET_BMC_GLOBAL_ENABLES_CMD	0x2f
 #define IPMI_READ_EVENT_MSG_BUFFER_CMD	0x35
 #define IPMI_GET_CHANNEL_INFO_CMD	0x42
+#define IPMI_SET_SYSTEM_INFO		0x58
 
 /* Bit for BMC global enables. */
 #define IPMI_BMC_RCV_MSG_INTR     0x01
-- 
1.7.1


Thanks,
G

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC
  2012-06-28 16:45 ` [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC Srinivas_G_Gowda
@ 2012-06-29  0:01   ` Andi Kleen
  2012-06-29  3:06     ` Corey Minyard
  2012-06-29 12:30     ` Matthew Garrett
  0 siblings, 2 replies; 8+ messages in thread
From: Andi Kleen @ 2012-06-29  0:01 UTC (permalink / raw)
  To: Srinivas_G_Gowda; +Cc: tcminyard, linux-kernel, openipmi

<Srinivas_G_Gowda@Dell.com> writes:
> +	
> +	data[0] = param_select;
> +	data[1] = set_selector;
> +	data[2] = string_encode;
> +	data[3] = str_len;
> +	data[4] = 'L';
> +	data[5] = 'i';
> +	data[6] = 'n';
> +	data[7] = 'u';
> +	data[8] = 'x';

Not sure that's all that useful. I can just see BMC's making the ACPI
mistake of trying to work around specific issues, by checking for
Linux.

But since there are so many different Linux that will never work
because "Linux" does not describe a fixed release or code base.

Probably dangerous.

-Andi


-- 
ak@linux.intel.com -- Speaking for myself only

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC
  2012-06-29  0:01   ` Andi Kleen
@ 2012-06-29  3:06     ` Corey Minyard
  2012-06-29 12:30     ` Matthew Garrett
  1 sibling, 0 replies; 8+ messages in thread
From: Corey Minyard @ 2012-06-29  3:06 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Srinivas_G_Gowda, tcminyard, linux-kernel, openipmi-developer

Srinivas, what is your use case?

-corey

On 06/28/2012 07:01 PM, Andi Kleen wrote:
> <Srinivas_G_Gowda@Dell.com> writes:
>> +	
>> +	data[0] = param_select;
>> +	data[1] = set_selector;
>> +	data[2] = string_encode;
>> +	data[3] = str_len;
>> +	data[4] = 'L';
>> +	data[5] = 'i';
>> +	data[6] = 'n';
>> +	data[7] = 'u';
>> +	data[8] = 'x';
> Not sure that's all that useful. I can just see BMC's making the ACPI
> mistake of trying to work around specific issues, by checking for
> Linux.
>
> But since there are so many different Linux that will never work
> because "Linux" does not describe a fixed release or code base.
>
> Probably dangerous.
>
> -Andi
>
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC
  2012-06-29  0:01   ` Andi Kleen
  2012-06-29  3:06     ` Corey Minyard
@ 2012-06-29 12:30     ` Matthew Garrett
  2012-06-29 14:27       ` Corey Minyard
  1 sibling, 1 reply; 8+ messages in thread
From: Matthew Garrett @ 2012-06-29 12:30 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Srinivas_G_Gowda, tcminyard, linux-kernel, openipmi

On Thu, Jun 28, 2012 at 05:01:54PM -0700, Andi Kleen wrote:
> Not sure that's all that useful. I can just see BMC's making the ACPI
> mistake of trying to work around specific issues, by checking for
> Linux.
> 
> But since there are so many different Linux that will never work
> because "Linux" does not describe a fixed release or code base.
> 
> Probably dangerous.

Agreed. Linux doesn't make interface guarantees to hardware, and where 
we've implied that we do it's ended up breaking things.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC
  2012-06-29 12:30     ` Matthew Garrett
@ 2012-06-29 14:27       ` Corey Minyard
  2012-07-04  5:11         ` Srinivas_G_Gowda
  0 siblings, 1 reply; 8+ messages in thread
From: Corey Minyard @ 2012-06-29 14:27 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: Andi Kleen, Srinivas_G_Gowda, tcminyard, linux-kernel,
	openipmi-developer, jharg93

On 06/29/2012 07:30 AM, Matthew Garrett wrote:
> On Thu, Jun 28, 2012 at 05:01:54PM -0700, Andi Kleen wrote:
>> Not sure that's all that useful. I can just see BMC's making the ACPI
>> mistake of trying to work around specific issues, by checking for
>> Linux.

I'm not sure I see that happening, but I suppose you never know.

>>
>> But since there are so many different Linux that will never work
>> because "Linux" does not describe a fixed release or code base.
>>
>> Probably dangerous.
> Agreed. Linux doesn't make interface guarantees to hardware, and where
> we've implied that we do it's ended up breaking things.
>

This is not really about making interface guarantees to hardware. This 
is more of a management discovery thing, so that system management 
software talking to the BMC can know what is running on the target.  
Something where management software can say "Hey, why is Linux running 
on that box? It's supposed to be BSD." or "That box has booted Linux but 
hasn't started its maintenance software". According to the spec, the 
information is supposed to be cleared if the system powers down or resets.

It seems to me that it's better to directly query what is running on the 
target to know what is running on it, but perhaps that's a security 
problem waiting to happen.  And perhaps it's better to have a small 
program set this at startup, since this operation will currently fail on 
the majority of systems out there.

-corey

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC
  2012-06-29 14:27       ` Corey Minyard
@ 2012-07-04  5:11         ` Srinivas_G_Gowda
  2012-07-04 12:17           ` Andi Kleen
  0 siblings, 1 reply; 8+ messages in thread
From: Srinivas_G_Gowda @ 2012-07-04  5:11 UTC (permalink / raw)
  To: minyard; +Cc: tcminyard, mjg59, andi, linux-kernel, openipmi-developer, jharg93

On 06/29/2012 07:57 PM, Corey Minyard wrote:
>  seems to me that it's better to directly query what is running on the 
> target to know what is running on it, but perhaps that's a security 
> problem waiting to happen.  And perhaps it's better to have a small 
> program set this at startup, since this operation will currently fail on 
> the majority of systems out there.

Hi All,
The intend of this patch was not to really workaround any issues, the aim was for the management software to use this data. I think Corey summed it up pretty well in his previous comment. Management software associated with BMC usually use this information to let the users know about the OS that is using the BMC. Generally there are 3rd party application software that goes and pretty much fills up the OS env information and the management software uses this. My intend was why don't we get this information loaded by the driver itself. If there are applications that wants to rewrite it, so be it..! 
Rather than just have a static entry such as 'Linux' I could probably write the version number and more(distro name etc.. ) 

Thoughts.. ? 


I know there were some concerns with the security aspect, Can you please let me know what kind of security holes we could be looking at ? 




Thanks,
G


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC
  2012-07-04  5:11         ` Srinivas_G_Gowda
@ 2012-07-04 12:17           ` Andi Kleen
  2012-07-04 17:41             ` Corey Minyard
  0 siblings, 1 reply; 8+ messages in thread
From: Andi Kleen @ 2012-07-04 12:17 UTC (permalink / raw)
  To: Srinivas_G_Gowda
  Cc: minyard, tcminyard, mjg59, andi, linux-kernel,
	openipmi-developer, jharg93

> The intend of this patch was not to really workaround any issues, the aim was for the management software to use this data. 

.. use it to do something "Linux" specific right?

I think Corey summed it up pretty well in his previous comment. Management software associated with BMC usually use this information to let the users know about the OS that is using the BMC. Generally there are 3rd party application software that goes and pretty much fills up the OS env information and the management software uses this. My intend was why don't we get this information loaded by the driver itself. If there are applications that wants to rewrite it, so be it..! 
> Rather than just have a static entry such as 'Linux' I could probably write the version number and more(distro name etc.. ) 
> 
> Thoughts.. ? 

I still think "Linux" means nothing even to the management software.
What should it do with that?

If you provide some way for a distro to fill in "foobar linux 1.2.3.4"
maybe. But just Linux or even Linux x.y.z would be wrong because the same kernel 
version can behave very differently.

But it would be  better to define specific feature flags for
specific needs that actually mean something.

> I know there were some concerns with the security aspect, Can you please let me know what kind of security holes we could be looking at ? 

I don't think there are any security problems. just forward/backward
compatibility problems, as the ACPI experience shows.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC
  2012-07-04 12:17           ` Andi Kleen
@ 2012-07-04 17:41             ` Corey Minyard
  0 siblings, 0 replies; 8+ messages in thread
From: Corey Minyard @ 2012-07-04 17:41 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Srinivas_G_Gowda, tcminyard, mjg59, linux-kernel,
	openipmi-developer, jharg93

On 07/04/2012 07:17 AM, Andi Kleen wrote:
>> Rather than just have a static entry such as 'Linux' I could probably write the version number and more(distro name etc.. )
>>
>> Thoughts.. ?
> I still think "Linux" means nothing even to the management software.
> What should it do with that?
>
> If you provide some way for a distro to fill in "foobar linux 1.2.3.4"
> maybe. But just Linux or even Linux x.y.z would be wrong because the same kernel
> version can behave very differently.
>
> But it would be  better to define specific feature flags for
> specific needs that actually mean something.

I think the conclusion I have come to is that this really belongs as a 
small program that runs at startup.  That's not significantly different 
than having it done in the driver.  I can help you write it, if you like.

I think Andi is right here.  "Linux" may mean something to your 
management software.  Some other management software may want "Linux 
x.y.z".  Another may want "SuSE Enterprise Linux x.y".  It's impossible 
to be general enough in the kernel.

>
>> I know there were some concerns with the security aspect, Can you please let me know what kind of security holes we could be looking at ?
> I don't think there are any security problems. just forward/backward
> compatibility problems, as the ACPI experience shows.

I had mentioned possible security issues with having some daemon that 
identified the system directly over IP.  I don't think there are any 
issues with IPMI, at least not any more than you already have with IPMI, 
and it's reasonably secure for what it does.

-corey

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-07-04 17:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4FEC8931.5020001@dell.com>
2012-06-28 16:45 ` [PATCH 1/1 v2 ] ipmi: Setting OS name as Linux in BMC Srinivas_G_Gowda
2012-06-29  0:01   ` Andi Kleen
2012-06-29  3:06     ` Corey Minyard
2012-06-29 12:30     ` Matthew Garrett
2012-06-29 14:27       ` Corey Minyard
2012-07-04  5:11         ` Srinivas_G_Gowda
2012-07-04 12:17           ` Andi Kleen
2012-07-04 17:41             ` Corey Minyard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.