All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] fix oops in ext4_mb_release_group_pa tracing
From: Eric Sandeen @ 2010-10-07 16:47 UTC (permalink / raw)
  To: ext4 development; +Cc: Josef Bacik
In-Reply-To: <4C6D7116.2080905@redhat.com>

On 08/19/2010 12:59 PM, Eric Sandeen wrote:
> Our QA reported an oops in the ext4_mb_release_group_pa tracing,
> and Josef Bacik pointed out that it was because we may have a
> non-null but uninitialized ac_inode in the allocation context.
> 
> I can reproduce it when running xfstests with ext4 tracepoints on, 
> on a CONFIG_SLAB_DEBUG kernel.
> 
> We call trace_ext4_mb_release_group_pa from 2 places, 
> ext4_mb_discard_group_preallocations and 
> ext4_mb_discard_lg_preallocations
> 
> In both cases we allocate an ac as a container just for tracing (!)
> and never fill in the ac_inode.  There's no reason to be assigning,
> testing, or printing it as far as I can see, so just remove it from
> the tracepoint.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

ping on this one too, oopsing while tracing is bad ... ;)

-Eric

> ---
> 
> diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
> index 01e9e00..e352c77 100644
> --- a/include/trace/events/ext4.h
> +++ b/include/trace/events/ext4.h
> @@ -432,7 +432,6 @@ TRACE_EVENT(ext4_mb_release_group_pa,
>  
>  	TP_STRUCT__entry(
>  		__field(	dev_t,	dev			)
> -		__field(	ino_t,	ino			)
>  		__field(	__u64,	pa_pstart		)
>  		__field(	__u32,	pa_len			)
>  
> @@ -440,8 +439,6 @@ TRACE_EVENT(ext4_mb_release_group_pa,
>  
>  	TP_fast_assign(
>  		__entry->dev		= sb->s_dev;
> -		__entry->ino		= (ac && ac->ac_inode) ?
> -						ac->ac_inode->i_ino : 0;
>  		__entry->pa_pstart	= pa->pa_pstart;
>  		__entry->pa_len		= pa->pa_len;
>  	),
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply

* [U-Boot] packed attribute problem
From: Scott Wood @ 2010-10-07 16:46 UTC (permalink / raw)
  To: u-boot
In-Reply-To: <m2k4lujpck.fsf@ohwell.denx.de>

On Thu, 7 Oct 2010 11:59:07 +0200
Detlev Zundel <dzu@denx.de> wrote:

> Hi Scott,
> 
> > So instead of the code breaking in the obvious situation where the
> > unaligned address is assigned to a pointer type that implies alignment,
> > it breaks when sufficient barriers to optimization are added that the
> > compiler can no longer keep track of where the value came from?
> 
> This is getting somewhat theoretical here, but I do not believe that "a
> pointer type implies alignment" in C.

I think this gets down to how such pointers are generated -- if you
stick with well-defined C, the compiler/ABI should be able to avoid
generating an unaligned pointer.

> I may be wrong here, but I cannot
> think of any statement in the standards in this regard - it's only data
> types that imply alignments.

Pointers point to typed data...

>  So if this is true, then for pointers gcc
> will always have to reason from actual values assigned to them.

That's not always possible.  How will GCC reason about this pointer,
where foo is called from a different compilation unit?

int foo(int *ptr)
{
	return *ptr;
}

> 
> > Seems like the right thing is for GCC to warn about the assignment to a
> > plain "u32 *", and allow a warningless assignment to something like
> > "u32 __attribute__((packed)) *".
> 
> Somehow I still feel that gcc should _always_ generate 32-bit accesses
> when I dereference a u32 pointer in code.

C doesn't guarantee this, and it would be broken on certain chips
when unaligned, e.g. old ARM chips that do weird rotaty things rather
than trap when you do an unaligned access.

This is why MMIO accessors should be done with inline assembly rather
than a volatile pointer, although it's usually just a theoretical
concern.

> If such an access traps the machine, then so be it.  Then the code has
> to be changed to reflect this in the source code level which will _make
> programmers ware of it_.

There is something at the source code level triggering this:
__attribute__((packed)).

That said, I don't think a lack of alignment of certain fields within
the struct ought to imply a lack of alignment of the start of the
struct.  There should have been two separate attributes for that, but
changing it now would probably not be a good thing (unless two entirely
new names are introduced).

-Scott

^ permalink raw reply

* Re: [PATCH] fix oops in ext4_mb_release_group_pa tracing
From: Eric Sandeen @ 2010-10-07 16:45 UTC (permalink / raw)
  To: ext4 development; +Cc: Josef Bacik
In-Reply-To: <4C6D7116.2080905@redhat.com>

On 08/19/2010 12:59 PM, Eric Sandeen wrote:
> Our QA reported an oops in the ext4_mb_release_group_pa tracing,
> and Josef Bacik pointed out that it was because we may have a
> non-null but uninitialized ac_inode in the allocation context.
> 
> I can reproduce it when running xfstests with ext4 tracepoints on, 
> on a CONFIG_SLAB_DEBUG kernel.
> 
> We call trace_ext4_mb_release_group_pa from 2 places, 
> ext4_mb_discard_group_preallocations and 
> ext4_mb_discard_lg_preallocations
> 
> In both cases we allocate an ac as a container just for tracing (!)
> and never fill in the ac_inode.  There's no reason to be assigning,
> testing, or printing it as far as I can see, so just remove it from
> the tracepoint.

Ping on this one at least?

avoid-null-dereference-in-trace_ext4_mballoc_discard is in the
patch queue, this one is similar and should go with it.

I'd really like to see
[PATCH] don't use ext4_allocation_contexts for tracing
go soon as well so we stop abusing the slab cache all day long...

Thanks,
-Eric

> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
> 
> diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
> index 01e9e00..e352c77 100644
> --- a/include/trace/events/ext4.h
> +++ b/include/trace/events/ext4.h
> @@ -432,7 +432,6 @@ TRACE_EVENT(ext4_mb_release_group_pa,
>  
>  	TP_STRUCT__entry(
>  		__field(	dev_t,	dev			)
> -		__field(	ino_t,	ino			)
>  		__field(	__u64,	pa_pstart		)
>  		__field(	__u32,	pa_len			)
>  
> @@ -440,8 +439,6 @@ TRACE_EVENT(ext4_mb_release_group_pa,
>  
>  	TP_fast_assign(
>  		__entry->dev		= sb->s_dev;
> -		__entry->ino		= (ac && ac->ac_inode) ?
> -						ac->ac_inode->i_ino : 0;
>  		__entry->pa_pstart	= pa->pa_pstart;
>  		__entry->pa_len		= pa->pa_len;
>  	),
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply

* Re: [PATCH 05/16] go7007: Don't use module names to load I2C modules
From: Pete Eberlein @ 2010-10-07 16:33 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media
In-Reply-To: <1285337654-5044-6-git-send-email-laurent.pinchart@ideasonboard.com>

Acked-by: Pete Eberlein <pete@sensoray.com>

On Fri, 2010-09-24 at 16:14 +0200, Laurent Pinchart wrote:
> With the v4l2_i2c_new_subdev* functions now supporting loading modules
> based on modaliases, replace the hardcoded module name passed to those
> functions by NULL.
> 
> All corresponding I2C modules have been checked, and all of them include
> a module aliases table with names corresponding to what the go7007
> driver uses.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/staging/go7007/go7007-driver.c |   43 ++-----------------------------
>  1 files changed, 3 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/staging/go7007/go7007-driver.c b/drivers/staging/go7007/go7007-driver.c
> index 372a7c6..0a1d925 100644
> --- a/drivers/staging/go7007/go7007-driver.c
> +++ b/drivers/staging/go7007/go7007-driver.c
> @@ -194,51 +194,15 @@ int go7007_reset_encoder(struct go7007 *go)
>   * Attempt to instantiate an I2C client by ID, probably loading a module.
>   */
>  static int init_i2c_module(struct i2c_adapter *adapter, const char *type,
> -			   int id, int addr)
> +			   int addr)
>  {
>  	struct go7007 *go = i2c_get_adapdata(adapter);
>  	struct v4l2_device *v4l2_dev = &go->v4l2_dev;
> -	char *modname;
>  
> -	switch (id) {
> -	case I2C_DRIVERID_WIS_SAA7115:
> -		modname = "wis-saa7115";
> -		break;
> -	case I2C_DRIVERID_WIS_SAA7113:
> -		modname = "wis-saa7113";
> -		break;
> -	case I2C_DRIVERID_WIS_UDA1342:
> -		modname = "wis-uda1342";
> -		break;
> -	case I2C_DRIVERID_WIS_SONY_TUNER:
> -		modname = "wis-sony-tuner";
> -		break;
> -	case I2C_DRIVERID_WIS_TW9903:
> -		modname = "wis-tw9903";
> -		break;
> -	case I2C_DRIVERID_WIS_TW2804:
> -		modname = "wis-tw2804";
> -		break;
> -	case I2C_DRIVERID_WIS_OV7640:
> -		modname = "wis-ov7640";
> -		break;
> -	case I2C_DRIVERID_S2250:
> -		modname = "s2250";
> -		break;
> -	default:
> -		modname = NULL;
> -		break;
> -	}
> -
> -	if (v4l2_i2c_new_subdev(v4l2_dev, adapter, modname, type, addr, NULL))
> +	if (v4l2_i2c_new_subdev(v4l2_dev, adapter, NULL, type, addr, NULL))
>  		return 0;
>  
> -	if (modname != NULL)
> -		printk(KERN_INFO
> -			"go7007: probing for module %s failed\n", modname);
> -	else
> -		printk(KERN_INFO
> -			"go7007: sensor %u seems to be unsupported!\n", id);
> +	printk(KERN_INFO "go7007: probing for module i2c:%s failed\n", type);
>  	return -1;
>  }
>  
> @@ -277,7 +241,6 @@ int go7007_register_encoder(struct go7007 *go)
>  		for (i = 0; i < go->board_info->num_i2c_devs; ++i)
>  			init_i2c_module(&go->i2c_adapter,
>  					go->board_info->i2c_devs[i].type,
> -					go->board_info->i2c_devs[i].id,
>  					go->board_info->i2c_devs[i].addr);
>  		if (go->board_id == GO7007_BOARDID_ADLINK_MPG24)
>  			i2c_clients_command(&go->i2c_adapter,



^ permalink raw reply

* Re: [PATCH 04/16] go7007: Fix the TW2804 I2C type name
From: Pete Eberlein @ 2010-10-07 16:33 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media
In-Reply-To: <1285337654-5044-5-git-send-email-laurent.pinchart@ideasonboard.com>

Acked-by: Pete Eberlein <pete@sensoray.com>

On Fri, 2010-09-24 at 16:14 +0200, Laurent Pinchart wrote:
> The TW2804 I2C sub-device type name was incorrectly set to wis_twTW2804
> for the adlink mpg24 board. Rename it to wis_tw2804.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/staging/go7007/go7007-usb.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/go7007/go7007-usb.c b/drivers/staging/go7007/go7007-usb.c
> index 20ed930..bea9f4d 100644
> --- a/drivers/staging/go7007/go7007-usb.c
> +++ b/drivers/staging/go7007/go7007-usb.c
> @@ -394,7 +394,7 @@ static struct go7007_usb_board board_adlink_mpg24 = {
>  		.num_i2c_devs	 = 1,
>  		.i2c_devs	 = {
>  			{
> -				.type	= "wis_twTW2804",
> +				.type	= "wis_tw2804",
>  				.id	= I2C_DRIVERID_WIS_TW2804,
>  				.addr	= 0x00, /* yes, really */
>  			},



^ permalink raw reply

* Re: RFC: btusb firmware load help
From: Marcel Holtmann @ 2010-10-07 16:42 UTC (permalink / raw)
  To: Bala Shanmugam
  Cc: Shanmugamkamatchi Balashanmugam, Luis Rodriguez, Johannes Berg,
	linux-bluetooth, linux-kernel@vger.kernel.org,
	linux-wireless@vger.kernel.org, Deepak Dhamdhere, Sree Durbha
In-Reply-To: <4CADF6BF.6070305@atheros.com>

Hi Bala,

> >> Thanks Johannes.  This would be better option to change PID in firmware
> >> as blacklisting 3002 might create problems for 3011 chipsets.
> >> Will try and let you people know.
> > The misbehaving 3002 needs to be blacklisted in btusb.c anyway. However
> > after loading the firmware to 3002 device, it should change its PID to
> > something else.
> >
> > I am still trying to figure out if this is one stage firmware loading or
> > a two stage firmware loading. This is all pretty unclear and nobody has
> > answered this clearly so far.
>
> eeprom based 3011 chips comes up with PID 3000 giving control to DFU 
> driver [ath3k].  ath3k downloads the
> firmware changing PID to 3002.  Now btusb gets control.
> 
> In sflash based devices to reduce windows suspend/resume time we had a 
> small firmware in flash which
> enables the device to get detected as Generic Bluetooth USB device with 
> PID 3002.  So control reaches btusb when device is plugged in, leaving 
> no option for us to load the actual firmware.
> 
> Solution would be to blacklist 3002 in btusb, enable ath3k to get 
> control for both the devices, download the firmware and change PID to 
> 3003 so that control with come to btusb.

so here is the thing that needs to be done.

a) Get a firmware for PID 3000 devices that change the firmware to some
other PID. Since 3003 is already in use as well, using 3004 or later is
better approach.

b) Blacklist PID 3002 in btusb.c.

c) Handle special firmware loading case for PID 3002 sflash devices. If
firmware is loaded changed to 3005 or other.

And as a general note, I prefer that the PID after loading firmware is
different if you don't happen to actually load the same firmware.

So please sort out your USB PID assignment for Bluetooth in general.
This seems to be a mess that is not thought through properly.

Regards

Marcel



^ permalink raw reply

* [PATCH] MAKEALL: allow CROSS_COMPILE*=""
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-07 16:38 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 MAKEALL |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/MAKEALL b/MAKEALL
index 9353cd8..e987de2 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -97,10 +97,12 @@ do_build_target() {
 	printf "Building ${arch} ${target} \n" >&2 | tee -a "${log_report}"
 
 	cross_compile=`eval echo '$CROSS_COMPILE_'${target}`
-	if [ ! "${cross_compile}" ]
+	cross_compile_set=`eval echo '${CROSS_COMPILE_'${target}'+set}'`
+	if [ "${cross_compile_set}" = "" ]
 	then
 		cross_compile=`eval echo '$CROSS_COMPILE_'${arch}`
-		if [ ! "${cross_compile}" ]
+		cross_compile_set=`eval echo '${CROSS_COMPILE_'${arch}'+set}'`
+		if [ "${cross_compile_set}" = "" ]
 		then
 			cross_compile=${CROSS_COMPILE}
 		fi
@@ -237,7 +239,7 @@ fi
 
 [ -d "${LOGDIR}" ] || mkdir ${LOGDIR} || exit 1
 
-if [ ! "${CONFIG}" ] && [ ! "${CROSS_COMPILE}" ]
+if [ ! "${CONFIG}" ] && [ ! "${CROSS_COMPILE+set}" ]
 then
 	echo "You need to specify a CONFIG or a CROSS_COMPILE"
 	usage
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] jsm: Remove the uart port on errors
From: Breno Leitao @ 2010-10-07 16:40 UTC (permalink / raw)
  To: greg; +Cc: linux-serial, Breno Leitao

If kzmalloc fails, the uart port is not removed causing a leak.
This patch just add another label that removes the uart when the
kzmalloc fails.

Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
---
 drivers/serial/jsm/jsm_driver.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
index eaf5450..18f5484 100644
--- a/drivers/serial/jsm/jsm_driver.c
+++ b/drivers/serial/jsm/jsm_driver.c
@@ -172,13 +172,15 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_device
 		 	jsm_uart_port_init here! */
 		dev_err(&pdev->dev, "memory allocation for flipbuf failed\n");
 		rc = -ENOMEM;
-		goto out_free_irq;
+		goto out_free_uart;
 	}
 
 	pci_set_drvdata(pdev, brd);
 	pci_save_state(pdev);
 
 	return 0;
+ out_free_uart:
+	jsm_remove_uart_port(brd);
  out_free_irq:
 	jsm_remove_uart_port(brd);
 	free_irq(brd->irq, brd);
-- 
1.7.2.3


^ permalink raw reply related

* RE: Handling of Fixed Dialing
From: Jeevaka.Badrappan @ 2010-10-07 16:40 UTC (permalink / raw)
  To: ofono
In-Reply-To: <201010071828.04248.petteri.tikander@ixonos.com>

[-- Attachment #1: Type: text/plain, Size: 1854 bytes --]

 
Hi Petteri,

> and thanks for the comments.

> I checked the invalidated-flag of EFadn (from file status-byte of GET
RESPONSE) and it actually changed according to FDN-enabling/disabling.
But for some reason I didn't 
> got any change in EFsst for FDN/ADN-services. Could it be a good idea
to add also reading of EFadn in the SIM-initialization routine, check
invalidated-flag, and make 
> decision of continuing initialization routine based on that?

  Exactly, thats what the specification also says. EFsst will inform 2
things: SIM's capabilty to support the service and service's
availability for the card holder. EFadn's file status is the one we need
to depend on for FDN enabled/disabled status. 

> The other issue was that selection of service table (SIM/USIM) based
on EFphase. So SIM returns '3' in my tests. But the SIM-card seems to be
of type SIM (not USIM), 
> because I accessed some USIM-type elementary files (EFest,
> EFpbr) and those returned only error-codes. Like phase (3g) wouldn't
actually be exactly the same thing than USIM-type. What about doing the
next change in the SIM-init 
> routine (not trusting to EFphase response when accessing the correct
service tables):

> - read first EFest
> - if EFest-access gives a valid response, read EFust
> - if EFest-access doesn't give a valid response, read EFsst

EFphase information is not the correct way to determine the SIM card
type(SIM/USIM). 

In most of the message based modems(eg: isimodem), there exists a
mechanism to get the type of the card. 

AT based modem is the issue. Since most of the AT based modems doesn't
support AT+CSIM, its difficult to determine the card type.

I still believe that we need to determine the card type during the SIM
initialization itself for reading the right SIM files.

Regards,
jeevaka


^ permalink raw reply

* Re: [PATCH 03/16] go7007: Add MODULE_DEVICE_TABLE to the go7007 I2C modules
From: Pete Eberlein @ 2010-10-07 16:33 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media
In-Reply-To: <1285337654-5044-4-git-send-email-laurent.pinchart@ideasonboard.com>

Acked-by: Pete Eberlein <pete@sensoray.com>

On Fri, 2010-09-24 at 16:14 +0200, Laurent Pinchart wrote:
> The device table is required to load modules based on modaliases.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/staging/go7007/wis-ov7640.c     |    1 +
>  drivers/staging/go7007/wis-saa7113.c    |    1 +
>  drivers/staging/go7007/wis-saa7115.c    |    1 +
>  drivers/staging/go7007/wis-sony-tuner.c |    1 +
>  drivers/staging/go7007/wis-tw2804.c     |    1 +
>  drivers/staging/go7007/wis-tw9903.c     |    1 +
>  drivers/staging/go7007/wis-uda1342.c    |    1 +
>  7 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/staging/go7007/wis-ov7640.c b/drivers/staging/go7007/wis-ov7640.c
> index 4f0cbdd..6bc9470 100644
> --- a/drivers/staging/go7007/wis-ov7640.c
> +++ b/drivers/staging/go7007/wis-ov7640.c
> @@ -81,6 +81,7 @@ static const struct i2c_device_id wis_ov7640_id[] = {
>  	{ "wis_ov7640", 0 },
>  	{ }
>  };
> +MODULE_DEVICE_TABLE(i2c, wis_ov7640_id);
>  
>  static struct i2c_driver wis_ov7640_driver = {
>  	.driver = {
> diff --git a/drivers/staging/go7007/wis-saa7113.c b/drivers/staging/go7007/wis-saa7113.c
> index 72f5c1f..05e0e10 100644
> --- a/drivers/staging/go7007/wis-saa7113.c
> +++ b/drivers/staging/go7007/wis-saa7113.c
> @@ -308,6 +308,7 @@ static const struct i2c_device_id wis_saa7113_id[] = {
>  	{ "wis_saa7113", 0 },
>  	{ }
>  };
> +MODULE_DEVICE_TABLE(i2c, wis_saa7113_id);
>  
>  static struct i2c_driver wis_saa7113_driver = {
>  	.driver = {
> diff --git a/drivers/staging/go7007/wis-saa7115.c b/drivers/staging/go7007/wis-saa7115.c
> index cd950b6..46cff59 100644
> --- a/drivers/staging/go7007/wis-saa7115.c
> +++ b/drivers/staging/go7007/wis-saa7115.c
> @@ -441,6 +441,7 @@ static const struct i2c_device_id wis_saa7115_id[] = {
>  	{ "wis_saa7115", 0 },
>  	{ }
>  };
> +MODULE_DEVICE_TABLE(i2c, wis_saa7115_id);
>  
>  static struct i2c_driver wis_saa7115_driver = {
>  	.driver = {
> diff --git a/drivers/staging/go7007/wis-sony-tuner.c b/drivers/staging/go7007/wis-sony-tuner.c
> index 981c9b3..8f1b7d4 100644
> --- a/drivers/staging/go7007/wis-sony-tuner.c
> +++ b/drivers/staging/go7007/wis-sony-tuner.c
> @@ -692,6 +692,7 @@ static const struct i2c_device_id wis_sony_tuner_id[] = {
>  	{ "wis_sony_tuner", 0 },
>  	{ }
>  };
> +MODULE_DEVICE_TABLE(i2c, wis_sony_tuner_id);
>  
>  static struct i2c_driver wis_sony_tuner_driver = {
>  	.driver = {
> diff --git a/drivers/staging/go7007/wis-tw2804.c b/drivers/staging/go7007/wis-tw2804.c
> index ee28a99..5b218c5 100644
> --- a/drivers/staging/go7007/wis-tw2804.c
> +++ b/drivers/staging/go7007/wis-tw2804.c
> @@ -331,6 +331,7 @@ static const struct i2c_device_id wis_tw2804_id[] = {
>  	{ "wis_tw2804", 0 },
>  	{ }
>  };
> +MODULE_DEVICE_TABLE(i2c, wis_tw2804_id);
>  
>  static struct i2c_driver wis_tw2804_driver = {
>  	.driver = {
> diff --git a/drivers/staging/go7007/wis-tw9903.c b/drivers/staging/go7007/wis-tw9903.c
> index 80d4726..9230f4a 100644
> --- a/drivers/staging/go7007/wis-tw9903.c
> +++ b/drivers/staging/go7007/wis-tw9903.c
> @@ -313,6 +313,7 @@ static const struct i2c_device_id wis_tw9903_id[] = {
>  	{ "wis_tw9903", 0 },
>  	{ }
>  };
> +MODULE_DEVICE_TABLE(i2c, wis_tw9903_id);
>  
>  static struct i2c_driver wis_tw9903_driver = {
>  	.driver = {
> diff --git a/drivers/staging/go7007/wis-uda1342.c b/drivers/staging/go7007/wis-uda1342.c
> index 5c4eb49..0127be2 100644
> --- a/drivers/staging/go7007/wis-uda1342.c
> +++ b/drivers/staging/go7007/wis-uda1342.c
> @@ -86,6 +86,7 @@ static const struct i2c_device_id wis_uda1342_id[] = {
>  	{ "wis_uda1342", 0 },
>  	{ }
>  };
> +MODULE_DEVICE_TABLE(i2c, wis_uda1342_id);
>  
>  static struct i2c_driver wis_uda1342_driver = {
>  	.driver = {



^ permalink raw reply

* [PATCH 5/5] nhk8815: use defaultenv
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-07 16:37 UTC (permalink / raw)
  To: barebox
In-Reply-To: <1286469458-11362-1-git-send-email-plagnioj@jcrosoft.com>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/boards/nhk8815/env/bin/_update            |   36 ----------------
 arch/arm/boards/nhk8815/env/bin/boot               |   38 -----------------
 arch/arm/boards/nhk8815/env/bin/init               |   28 ------------
 .../boards/nhk8815/env/bin/update_barebox_xmodem   |   19 --------
 arch/arm/boards/nhk8815/env/bin/update_kernel      |    8 ----
 arch/arm/boards/nhk8815/env/bin/update_root        |    8 ----
 arch/arm/boards/nhk8815/env/config                 |   44 +++++++++++++------
 arch/arm/configs/nhk8815_defconfig                 |    1 +
 8 files changed, 31 insertions(+), 151 deletions(-)
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/_update
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/boot
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/init
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/update_kernel
 delete mode 100644 arch/arm/boards/nhk8815/env/bin/update_root

diff --git a/arch/arm/boards/nhk8815/env/bin/_update b/arch/arm/boards/nhk8815/env/bin/_update
deleted file mode 100644
index fb7cbe8..0000000
--- a/arch/arm/boards/nhk8815/env/bin/_update
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-
-if [ -z "$part" -o -z "$image" ]; then
-	echo "define \$part and \$image"
-	exit 1
-fi
-
-if [ \! -e "$part" ]; then
-	echo "Partition $part does not exist"
-	exit 1
-fi
-
-if [ $# = 1 ]; then
-	image=$1
-fi
-
-if [ x$ip = xdhcp ]; then
-	dhcp
-fi
-
-ping $eth0.serverip
-if [ $? -ne 0 ] ; then
-	echo "update aborted"
-	exit 1
-fi
-
-unprotect $part
-
-echo
-echo "erasing partition $part"
-erase $part
-
-echo
-echo "flashing $image to $part"
-echo
-tftp $image $part
diff --git a/arch/arm/boards/nhk8815/env/bin/boot b/arch/arm/boards/nhk8815/env/bin/boot
deleted file mode 100644
index fd8d957..0000000
--- a/arch/arm/boards/nhk8815/env/bin/boot
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-. /env/config
-
-if [ x$1 = xflash ]; then
-	root=flash
-	kernel=flash
-fi
-
-if [ x$1 = xnet ]; then
-	root=net
-	kernel=net
-fi
-
-if [ x$ip = xdhcp ]; then
-	bootargs="$bootargs ip=dhcp"
-else
-	bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::"
-fi
-
-if [ x$root = xflash ]; then
-	bootargs="$bootargs root=$rootpart rootfstype=jffs2"
-else
-	bootargs="$bootargs root=/dev/nfs nfsroot=192.168.23.111:$nfsroot"
-fi
-
-bootargs="$bootargs"
-
-if [ $kernel = net ]; then
-	if [ x$ip = xdhcp ]; then
-		dhcp
-	fi
-	tftp $uimage uImage
-	bootm uImage
-else
-	bootm /dev/nor0.kernel
-fi
-
diff --git a/arch/arm/boards/nhk8815/env/bin/init b/arch/arm/boards/nhk8815/env/bin/init
deleted file mode 100644
index 5b45a70..0000000
--- a/arch/arm/boards/nhk8815/env/bin/init
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-PATH=/env/bin
-export PATH
-
-. /env/config
-
-if [ -e /dev/nand0 ]; then
-	addpart /dev/nand0 $nand_parts
-
-	# Uh, oh, hush first expands wildcards and then starts executing
-	# commands. What a bug!
-	source /env/bin/hush_hack
-fi
-
-echo
-echo -n "Hit any key to stop autoboot: "
-timeout -a $autoboot_timeout
-if [ $? != 0 ]; then
-	echo
-	echo "type update_kernel [<imagename>] to update kernel into flash"
-	echo "type udate_root [<imagename>] to update rootfs into flash"
-	echo "type update_barebox_xmodem nor to update barebox into flash"
-	echo
-	exit
-fi
-
-boot
diff --git a/arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem b/arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem
deleted file mode 100644
index 40f4ad3..0000000
--- a/arch/arm/boards/nhk8815/env/bin/update_barebox_xmodem
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-. /env/config
-
-part=/dev/nand0.barebox
-
-loadb -f barebox.bin -c
-
-unprotect $part
-echo
-echo "erasing partition $part"
-erase $part
-
-echo
-echo "flashing barebox.bin to $part"
-echo
-cp barebox.bin $part
-crc32 -f barebox.bin
-crc32 -f $part
diff --git a/arch/arm/boards/nhk8815/env/bin/update_kernel b/arch/arm/boards/nhk8815/env/bin/update_kernel
deleted file mode 100644
index db0f4c2..0000000
--- a/arch/arm/boards/nhk8815/env/bin/update_kernel
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-. /env/config
-
-image=$uimage
-part=/dev/nand0.kernel
-
-. /env/bin/_update $1
diff --git a/arch/arm/boards/nhk8815/env/bin/update_root b/arch/arm/boards/nhk8815/env/bin/update_root
deleted file mode 100644
index 9530e84..0000000
--- a/arch/arm/boards/nhk8815/env/bin/update_root
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-. /env/config
-
-image=$jffs2
-part=/dev/nand0.rootfs
-
-. /env/bin/_update $1
diff --git a/arch/arm/boards/nhk8815/env/config b/arch/arm/boards/nhk8815/env/config
index 7e7fc45..e657a76 100644
--- a/arch/arm/boards/nhk8815/env/config
+++ b/arch/arm/boards/nhk8815/env/config
@@ -1,16 +1,33 @@
 #!/bin/sh
 
-# can be either 'net' or 'flash'
-kernel=net
-root=net
-
-# use 'dhcp' todo dhcp in uboot and in kernel
+# use 'dhcp' to do dhcp in barebox and in kernel
+# use 'none' if you want to skip kernel ip autoconfiguration
 ip=dhcp
 
-#
-# setup default ethernet address
-#
-#eth0.serverip=192.168.23.108
+# or set your networking parameters here
+#eth0.ipaddr=a.b.c.d
+#eth0.netmask=a.b.c.d
+#eth0.gateway=a.b.c.d
+#eth0.serverip=a.b.c.d
+
+# can be either 'net' or 'nand'
+kernel_loc=net
+# can be either 'net', 'nand' or 'initrd'
+rootfs_loc=net
+
+# can be either 'jffs2' or 'ubifs'
+rootfs_type=ubifs
+rootfsimage=root.$rootfs_type
+
+# The image type of the kernel. Can be uimage, zimage, raw, or raw_lzo
+#kernelimage_type=zimage
+#kernelimage=zImage
+kernelimage_type=uimage
+kernelimage=uImage
+#kernelimage_type=raw
+#kernelimage=Image
+#kernelimage_type=raw_lzo
+#kernelimage=Image.lzo
 
 # Partition			Size	Start
 # XloaderTOC + X-Loader		256KB	0x00000000
@@ -22,11 +39,10 @@ ip=dhcp
 
 nand_parts="256k(xloader)ro,256k(meminit),2M(barebox),3M(kernel),22M(rootfs),100M(userfs),384k(free),128k(bareboxenv)"
 
-uimage=uImage-nhk15
-
-# use 'dhcp' to do dhcp in uboot and in kernel
-ip=dhcp
-
 autoboot_timeout=3
 
 bootargs="root=/dev/ram0 console=ttyAMA1,115200n8 init=linuxrc"
+
+# set a fancy prompt (if support is compiled in)
+PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m "
+
diff --git a/arch/arm/configs/nhk8815_defconfig b/arch/arm/configs/nhk8815_defconfig
index e3f4102..5e03d05 100644
--- a/arch/arm/configs/nhk8815_defconfig
+++ b/arch/arm/configs/nhk8815_defconfig
@@ -10,6 +10,7 @@ CONFIG_AUTO_COMPLETE=y
 CONFIG_MENU=y
 CONFIG_PASSWD_SUM_SHA1=y
 CONFIG_PARTITION=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
 CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/nhk8815/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 4/5] defaultenv: add update_barebox to update barebox easly for tftp or xmodem
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-07 16:37 UTC (permalink / raw)
  To: barebox
In-Reply-To: <1286469458-11362-1-git-send-email-plagnioj@jcrosoft.com>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/Kconfig              |    1 +
 defaultenv/bin/init           |    1 +
 defaultenv/bin/update_barebox |   21 +++++++++++++++++++++
 3 files changed, 23 insertions(+), 0 deletions(-)
 create mode 100644 defaultenv/bin/update_barebox

diff --git a/commands/Kconfig b/commands/Kconfig
index 5416073..151758b 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -204,6 +204,7 @@ config CMD_CRC
 
 config CMD_CRC_CMP
 	tristate
+	default y if DEFAULT_ENVIRONMENT_GENERIC
 	depends on CMD_CRC
 	prompt "compare 2 files crc"
 
diff --git a/defaultenv/bin/init b/defaultenv/bin/init
index db2b525..18a0c95 100644
--- a/defaultenv/bin/init
+++ b/defaultenv/bin/init
@@ -28,6 +28,7 @@ if [ $? != 0 ]; then
 	echo "default mode is net"
 	echo "type update_kernel nand|nor [<imagename>] [net|xmodem] to update kernel into flash"
 	echo "type update_rootfs nand|nor [<imagename>] [net|xmodem] to update rootfs into flash"
+	echo "type update_barebox nand|nor [<imagename>] [net|xmodem] to update barebox into flash"
 	echo
 	exit
 fi
diff --git a/defaultenv/bin/update_barebox b/defaultenv/bin/update_barebox
new file mode 100644
index 0000000..2f3b1d9
--- /dev/null
+++ b/defaultenv/bin/update_barebox
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+. /env/config
+image=barebox.bin
+mode=net
+
+if [ x$1 = xnand ]; then
+	part=/dev/nand0.barebox.bb
+elif [ x$1 = xnor ]; then
+	part=/dev/nor0.barebox
+else
+	echo "usage: $0 nor|nand [imagename] [net|xmodem]"
+	exit 1
+fi
+
+if [ x$3 != x ]; then
+	mode=$3
+fi
+
+. /env/bin/_update $2
+crc32 -f $image -F $part
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 3/5] defaultenv: add xmodem support for update
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-07 16:37 UTC (permalink / raw)
  To: barebox
In-Reply-To: <1286469458-11362-1-git-send-email-plagnioj@jcrosoft.com>

this is add as last parameter to do not change the default behavior

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 defaultenv/bin/_update       |   26 +++++++++++++++++---------
 defaultenv/bin/init          |    5 +++--
 defaultenv/bin/update_kernel |    7 ++++++-
 defaultenv/bin/update_rootfs |    7 ++++++-
 4 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/defaultenv/bin/_update b/defaultenv/bin/_update
index ddd6b84..c60ff88 100644
--- a/defaultenv/bin/_update
+++ b/defaultenv/bin/_update
@@ -14,14 +14,16 @@ if [ $# = 1 ]; then
 	image=$1
 fi
 
-if [ x$ip = xdhcp ]; then
-	dhcp
-fi
-
-ping $eth0.serverip
-if [ $? -ne 0 ] ; then
-	echo "Server did not reply! Update aborted."
-	exit 1
+if [ x$mode = xnet ]; then
+	if [ x$ip = xdhcp ]; then
+		dhcp
+	fi
+
+	ping $eth0.serverip
+	if [ $? -ne 0 ] ; then
+		echo "Server did not reply! Update aborted."
+		exit 1
+	fi
 fi
 
 unprotect $part
@@ -34,6 +36,12 @@ erase $part
 echo
 echo "flashing $image to $part"
 echo
-tftp $image $part
+
+if [ x$mode = xnet ]; then
+	tftp $image $part
+else
+	loadb -f $image -c
+	cp $image $part
+fi
 
 protect $part
diff --git a/defaultenv/bin/init b/defaultenv/bin/init
index a55e8e6..db2b525 100644
--- a/defaultenv/bin/init
+++ b/defaultenv/bin/init
@@ -25,8 +25,9 @@ echo -n "Hit any key to stop autoboot: "
 timeout -a $autoboot_timeout
 if [ $? != 0 ]; then
 	echo
-	echo "type update_kernel nand|nor [<imagename>] to update kernel into flash"
-	echo "type update_rootfs nand|nor [<imagename>] to update rootfs into flash"
+	echo "default mode is net"
+	echo "type update_kernel nand|nor [<imagename>] [net|xmodem] to update kernel into flash"
+	echo "type update_rootfs nand|nor [<imagename>] [net|xmodem] to update rootfs into flash"
 	echo
 	exit
 fi
diff --git a/defaultenv/bin/update_kernel b/defaultenv/bin/update_kernel
index 1d35ed9..b29927f 100644
--- a/defaultenv/bin/update_kernel
+++ b/defaultenv/bin/update_kernel
@@ -2,14 +2,19 @@
 
 . /env/config
 image=$kernelimage
+mode=net
 
 if [ x$1 = xnand ]; then
 	part=/dev/nand0.kernel.bb
 elif [ x$1 = xnor ]; then
 	part=/dev/nor0.kernel
 else
-	echo "usage: $0 nor|nand [imagename]"
+	echo "usage: $0 nor|nand [imagename] [net|xmodem]"
 	exit 1
 fi
 
+if [ x$3 != x ]; then
+	mode=$3
+fi
+
 . /env/bin/_update $2
diff --git a/defaultenv/bin/update_rootfs b/defaultenv/bin/update_rootfs
index 6366315..bac74ca 100644
--- a/defaultenv/bin/update_rootfs
+++ b/defaultenv/bin/update_rootfs
@@ -3,14 +3,19 @@
 . /env/config
 
 image=$rootfsimage
+mode=net
 
 if [ x$1 = xnand ]; then
 	part=/dev/nand0.root.bb
 elif [ x$1 = xnor ]; then
 	part=/dev/nor0.root
 else
-	echo "usage: $0 nor|nand [imagename]"
+	echo "usage: $0 nor|nand [imagename] [net|xmodem]"
 	exit 1
 fi
 
+if [ x$3 != x ]; then
+	mode=$3
+fi
+
 . /env/bin/_update $2
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 2/5] commands/crc32: add compare 2 files crc
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-07 16:37 UTC (permalink / raw)
  To: barebox
In-Reply-To: <1286469458-11362-1-git-send-email-plagnioj@jcrosoft.com>

add -F options to compare to file crc

it's usefull to compare what you flash in a partition

it's selectable by CONFIG_CMD_CRC_CMP

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 commands/Kconfig |    5 ++
 commands/crc.c   |  111 ++++++++++++++++++++++++++++++++++++------------------
 2 files changed, 79 insertions(+), 37 deletions(-)

diff --git a/commands/Kconfig b/commands/Kconfig
index 0fc80aa..5416073 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -202,6 +202,11 @@ config CMD_CRC
 	select CRC32
 	prompt "crc"
 
+config CMD_CRC_CMP
+	tristate
+	depends on CMD_CRC
+	prompt "compare 2 files crc"
+
 config CMD_MTEST
 	tristate
 	prompt "mtest"
diff --git a/commands/crc.c b/commands/crc.c
index 4842cdc..d3e0865 100644
--- a/commands/crc.c
+++ b/commands/crc.c
@@ -30,20 +30,80 @@
 #include <malloc.h>
 #include <linux/ctype.h>
 
+static int file_crc(char* filename, ulong start, ulong size, ulong *crc,
+		    ulong *total)
+{
+	int fd, now;
+	int ret = 0;
+	char *buf;
+
+	*total = 0;
+	*crc = 0;
+
+	fd = open(filename, O_RDONLY);
+	if (fd < 0) {
+		printf("open %s: %s\n", filename, errno_str());
+		return fd;
+	}
+
+	if (start > 0) {
+		ret = lseek(fd, start, SEEK_SET);
+		if (ret == -1) {
+			perror("lseek");
+			goto out;
+		}
+	}
+
+	buf = xmalloc(4096);
+
+	while (size) {
+		now = min((ulong)4096, size);
+		now = read(fd, buf, now);
+		if (now < 0) {
+			ret = now;
+			perror("read");
+			goto out_free;
+		}
+		if (!now)
+			break;
+		*crc = crc32(*crc, buf, now);
+		size -= now;
+		*total += now;
+	}
+
+	printf ("CRC32 for %s 0x%08lx ... 0x%08lx ==> 0x%08lx",
+			filename, start, start + *total - 1, *crc);
+
+out_free:
+	free(buf);
+out:
+	close(fd);
+
+	return ret;
+}
+
 static int do_crc(struct command *cmdtp, int argc, char *argv[])
 {
 	ulong start = 0, size = ~0, total = 0;
 	ulong crc = 0, vcrc = 0;
 	char *filename = "/dev/mem";
-	char *buf;
-	int fd, opt, err = 0, filegiven = 0, verify = 0, now;
+#ifdef CONFIG_CMD_CRC_CMP
+	char *vfilename = NULL;
+#endif
+	int opt, err = 0, filegiven = 0, verify = 0;
 
-	while((opt = getopt(argc, argv, "f:v:")) > 0) {
+	while((opt = getopt(argc, argv, "f:F:v:")) > 0) {
 		switch(opt) {
 		case 'f':
 			filename = optarg;
 			filegiven = 1;
 			break;
+#ifdef CONFIG_CMD_CRC_CMP
+		case 'F':
+			verify = 1;
+			vfilename = optarg;
+			break;
+#endif
 		case 'v':
 			verify = 1;
 			vcrc = simple_strtoul(optarg, NULL, 0);
@@ -61,38 +121,17 @@ static int do_crc(struct command *cmdtp, int argc, char *argv[])
 		}
 	}
 
-	fd = open(filename, O_RDONLY);
-	if (fd < 0) {
-		printf("open %s: %s\n", filename, errno_str());
+	if (file_crc(filename, start, size, &crc, &total) < 0)
 		return 1;
-	}
 
-	if (start > 0) {
-		if (lseek(fd, start, SEEK_SET) == -1) {
-			perror("lseek");
-			err = 1;
-			goto out;
-		}
-	}
-
-	buf = xmalloc(4096);
-
-	while (size) {
-		now = min((ulong)4096, size);
-		now = read(fd, buf, now);
-		if (now < 0) {
-			perror("read");
-			goto out_free;
-		}
-		if (!now)
-			break;
-		crc = crc32(crc, buf, now);
-		size -= now;
-		total += now;
+#ifdef CONFIG_CMD_CRC_CMP
+	if (vfilename) {
+		size = total;
+		puts("\n");
+		if (file_crc(vfilename, start, size, &vcrc, &total) < 0)
+			return 1;
 	}
-
-	printf ("CRC32 for %s 0x%08lx ... 0x%08lx ==> 0x%08lx",
-			filename, start, start + total - 1, crc);
+#endif
 
 	if (verify && crc != vcrc) {
 		printf(" != 0x%08x ** ERROR **", vcrc);
@@ -101,11 +140,6 @@ static int do_crc(struct command *cmdtp, int argc, char *argv[])
 
 	printf("\n");
 
-out_free:
-	free(buf);
-out:
-	close(fd);
-
 	return err;
 }
 
@@ -114,6 +148,9 @@ static const __maybe_unused char cmd_crc_help[] =
 "Calculate a crc32 checksum of a memory area\n"
 "Options:\n"
 "  -f <file>   Use file instead of memory\n"
+#ifdef CONFIG_CMD_CRC_CMP
+"  -F <file>   Use file to compare\n"
+#endif
 "  -v <crc>    Verfify\n";
 
 BAREBOX_CMD_START(crc32)
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 1/5] defaultenv: introduce CONFIG_DEFAULT_ENVIRONMENT_GENERIC to enable it
From: Jean-Christophe PLAGNIOL-VILLARD @ 2010-10-07 16:37 UTC (permalink / raw)
  To: barebox

this will we usefull to enable functionnality if used

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/configs/neso_defconfig   |    3 ++-
 arch/arm/configs/pca100_defconfig |    3 ++-
 arch/arm/configs/pcm037_defconfig |    3 ++-
 arch/arm/configs/pcm038_defconfig |    3 ++-
 arch/arm/configs/pcm043_defconfig |    3 ++-
 common/Kconfig                    |    7 +++++++
 common/Makefile                   |    4 ++++
 7 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/arch/arm/configs/neso_defconfig b/arch/arm/configs/neso_defconfig
index 9f6e3f4..24125f9 100644
--- a/arch/arm/configs/neso_defconfig
+++ b/arch/arm/configs/neso_defconfig
@@ -12,7 +12,8 @@ CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/guf-neso/env"
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/guf-neso/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_SAVEENV=y
diff --git a/arch/arm/configs/pca100_defconfig b/arch/arm/configs/pca100_defconfig
index d1708a6..8c72bdf 100644
--- a/arch/arm/configs/pca100_defconfig
+++ b/arch/arm/configs/pca100_defconfig
@@ -12,7 +12,8 @@ CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/phycard-i.MX27/env"
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/phycard-i.MX27/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_SAVEENV=y
diff --git a/arch/arm/configs/pcm037_defconfig b/arch/arm/configs/pcm037_defconfig
index 8e60b0a..e12f690 100644
--- a/arch/arm/configs/pcm037_defconfig
+++ b/arch/arm/configs/pcm037_defconfig
@@ -10,7 +10,8 @@ CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/pcm037/env"
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/pcm037/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_SAVEENV=y
diff --git a/arch/arm/configs/pcm038_defconfig b/arch/arm/configs/pcm038_defconfig
index eacbbc6..2038f14 100644
--- a/arch/arm/configs/pcm038_defconfig
+++ b/arch/arm/configs/pcm038_defconfig
@@ -13,7 +13,8 @@ CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/pcm038/env"
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/pcm038/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_SAVEENV=y
diff --git a/arch/arm/configs/pcm043_defconfig b/arch/arm/configs/pcm043_defconfig
index 51ca833..2dd711b 100644
--- a/arch/arm/configs/pcm043_defconfig
+++ b/arch/arm/configs/pcm043_defconfig
@@ -13,7 +13,8 @@ CONFIG_HUSH_FANCY_PROMPT=y
 CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv arch/arm/boards/pcm043/env"
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/pcm043/env"
 CONFIG_CMD_EDIT=y
 CONFIG_CMD_SLEEP=y
 CONFIG_CMD_SAVEENV=y
diff --git a/common/Kconfig b/common/Kconfig
index ad70cde..485133e 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -382,6 +382,13 @@ config DEFAULT_ENVIRONMENT
 	  Enabling this option will give you a default environment when
 	  the environment found in the environment sector is invalid
 
+config DEFAULT_ENVIRONMENT_GENERIC
+	bool
+	depends on DEFAULT_ENVIRONMENT
+	prompt "Default environment generic"
+	help
+	  Generic barebox default env
+
 config DEFAULT_ENVIRONMENT_PATH
 	string
 	depends on DEFAULT_ENVIRONMENT
diff --git a/common/Makefile b/common/Makefile
index e56dbc2..b42ab7a 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -26,6 +26,10 @@ ifdef CONFIG_DEFAULT_ENVIRONMENT
 $(obj)/startup.o: include/generated/barebox_default_env.h
 $(obj)/env.o: include/generated/barebox_default_env.h
 
+ifeq ($(CONFIG_DEFAULT_ENVIRONMENT_GENERIC),y)
+CONFIG_DEFAULT_ENVIRONMENT_PATH += defaultenv
+endif
+
 ENV_FILES := $(shell cd $(srctree); for i in $(CONFIG_DEFAULT_ENVIRONMENT_PATH); do find $${i} -type f -exec readlink -f {} \;; done)
 
 endif # ifdef CONFIG_DEFAULT_ENVIRONMENT
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* Re: [PATCH] sysctl: fix min/max handling in __do_proc_doulongvec_minmax()
From: Eric W. Biederman @ 2010-10-07 16:37 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Américo Wang, Robin Holt, Andrew Morton, linux-kernel,
	Willy Tarreau, David S. Miller, netdev, James Morris,
	Pekka Savola (ipv6), Patrick McHardy, Alexey Kuznetsov
In-Reply-To: <1286445081.2912.15.camel@edumazet-laptop>

Eric Dumazet <eric.dumazet@gmail.com> writes:

> Le jeudi 07 octobre 2010 à 17:25 +0800, Américo Wang a écrit :
>> >>
>> >
>> >Here is the final one.
>> 
>> Oops, that one is not correct. Hopefully this one
>> is correct.
>> 
>> --------------->
>> 
>> Eric D. noticed that we may trigger an OOPS if we leave ->extra{1,2}
>> to NULL when we use proc_doulongvec_minmax().
>> 
>> Actually, we don't need to store min/max values in a vector,
>> because all the elements in the vector should share the same min/max
>> value, like what proc_dointvec_minmax() does.
>> 
>
> If we assert same min/max limits are to be applied to all elements,
> a much simpler fix than yours would be :
>
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index f88552c..8e45451 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -2485,7 +2485,7 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int
>  		kbuf[left] = 0;
>  	}
>  
> -	for (; left && vleft--; i++, min++, max++, first=0) {
> +	for (; left && vleft--; i++, first=0) {
>  		unsigned long val;
>  
>  		if (write) {
>
>
> Please dont send huge patches like this to 'fix' a bug,
> especially on slow path.
>
> First we fix the bug, _then_ we can try to make code more 
> efficient or more pretty or shorter.
>
> So the _real_ question is :
>
> Should the min/max limits should be a single pair,
> shared by all elements, or a vector of limits.

The difference between long handling and int handling is a
usability issue.  I don't expect we will be exporting new
vectors via sysctl, so the conversion of a handful of vectors
from int to long is where this is most likely to be used.

I skimmed through all of what I presume are the current users
aka linux-2.6.36-rcX and there don't appear to be any users
of proc_dounlongvec_minmax that use it's vector properties there.

Which doubly tells me that incrementing the min and max pointers
is not what we want to do.

Eric



^ permalink raw reply

* [PATCH 3/3] pnfs_submit: enforce requested DS only pNFS role
From: andros @ 2010-10-07 19:37 UTC (permalink / raw)
  To: bhalevy; +Cc: linux-nfs, Andy Adamson
In-Reply-To: <1286480230-9418-2-git-send-email-andros@netapp.com>

From: Andy Adamson <andros@netapp.com>

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/nfs4filelayoutdev.c |    5 -----
 fs/nfs/nfs4state.c         |    5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index e0edf93..1f0ab62 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -183,11 +183,6 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds)
 		goto out_put;
 	}
 	/*
-	 * Mask the (possibly) returned EXCHGID4_FLAG_USE_PNFS_MDS pNFS role
-	 * The is_ds_only_session depends on this.
-	 */
-	clp->cl_exchange_flags &= ~EXCHGID4_FLAG_USE_PNFS_MDS;
-	/*
 	 * Set DS lease equal to the MDS lease, renewal is scheduled in
 	 * create_session
 	 */
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 91584ad..e2fc175 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -188,6 +188,7 @@ static int nfs4_begin_drain_session(struct nfs_client *clp)
 int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)
 {
 	int status;
+	u32 req_exchange_flags = clp->cl_exchange_flags;
 
 	nfs4_begin_drain_session(clp);
 	status = nfs4_proc_exchange_id(clp, cred);
@@ -196,6 +197,10 @@ int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)
 	status = nfs4_proc_create_session(clp);
 	if (status != 0)
 		goto out;
+	if (is_ds_only_session(req_exchange_flags))
+		/* Mask the (possibly) returned MDS and non-pNFS roles */
+		clp->cl_exchange_flags &=
+		     ~(EXCHGID4_FLAG_USE_PNFS_MDS | EXCHGID4_FLAG_USE_NON_PNFS);
 	nfs41_setup_state_renewal(clp);
 	nfs_mark_client_ready(clp, NFS_CS_READY);
 out:
-- 
1.6.6


^ permalink raw reply related

* [PATCH 2/3] pnfs_submit: fix deadlock in pnfs_clear_lseg_list
From: andros @ 2010-10-07 19:37 UTC (permalink / raw)
  To: bhalevy; +Cc: linux-nfs, Andy Adamson, Andy Adamson
In-Reply-To: <1286480230-9418-1-git-send-email-andros@netapp.com>

From: Andy Adamson <andros@rhel6-1.androsmac.org>

The file layout free_lseg i/o operation called by destroy_lseg under the
inode->i_lock can call nfs_put_client() when a data
server is no longer referenced. nfs_put_client can end up taking the
i_mutex called in rpc_unlink (called from nfs_idmap_delete from
nfs_free_client) which can result in a deadlock.

Use a temporary list to hold layout segments to be freed, and free them outside
the inode->i_lock.

Reported-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/pnfs.c |   53 ++++++++++++++++++++++++++---------------------------
 fs/nfs/pnfs.h |    1 -
 2 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 24620cf..06fcc92 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -275,6 +275,7 @@ init_lseg(struct pnfs_layout_hdr *lo, struct pnfs_layout_segment *lseg)
 	lseg->layout = lo;
 }
 
+/* Called without i_lock held */
 static void
 destroy_lseg(struct kref *kref)
 {
@@ -285,29 +286,10 @@ destroy_lseg(struct kref *kref)
 	dprintk("--> %s\n", __func__);
 	NFS_SERVER(local->inode)->pnfs_curr_ld->free_lseg(lseg);
 	/* Matched by get_layout_hdr_locked in pnfs_insert_layout */
-	put_layout_hdr_locked(local);
+	put_layout_hdr(local->inode);
 }
 
 void
-put_lseg_locked(struct pnfs_layout_segment *lseg)
-{
-	bool do_wake_up;
-	struct nfs_inode *nfsi;
-
-	if (!lseg)
-		return;
-
-	dprintk("%s: lseg %p ref %d valid %d\n", __func__, lseg,
-		atomic_read(&lseg->kref.refcount), lseg->valid);
-	do_wake_up = !lseg->valid;
-	nfsi = NFS_I(lseg->layout->inode);
-	kref_put(&lseg->kref, destroy_lseg);
-	if (do_wake_up)
-		wake_up(&nfsi->lo_waitq);
-}
-EXPORT_SYMBOL_GPL(put_lseg_locked);
-
-void
 put_lseg(struct pnfs_layout_segment *lseg)
 {
 	bool do_wake_up;
@@ -320,9 +302,7 @@ put_lseg(struct pnfs_layout_segment *lseg)
 		atomic_read(&lseg->kref.refcount), lseg->valid);
 	do_wake_up = !lseg->valid;
 	nfsi = NFS_I(lseg->layout->inode);
-	spin_lock(&nfsi->vfs_inode.i_lock);
 	kref_put(&lseg->kref, destroy_lseg);
-	spin_unlock(&nfsi->vfs_inode.i_lock);
 	if (do_wake_up)
 		wake_up(&nfsi->lo_waitq);
 }
@@ -354,10 +334,11 @@ _pnfs_can_return_lseg(struct pnfs_layout_segment *lseg)
 }
 
 static void
-pnfs_clear_lseg_list(struct pnfs_layout_hdr *lo,
+pnfs_clear_lseg_list(struct pnfs_layout_hdr *lo, struct list_head *tmp_list,
 		     struct pnfs_layout_range *range)
 {
 	struct pnfs_layout_segment *lseg, *next;
+
 	dprintk("%s:Begin lo %p offset %llu length %llu iomode %d\n",
 		__func__, lo, range->offset, range->length, range->iomode);
 
@@ -370,8 +351,7 @@ pnfs_clear_lseg_list(struct pnfs_layout_hdr *lo,
 			"offset %llu length %llu\n", __func__,
 			lseg, lseg->range.iomode, lseg->range.offset,
 			lseg->range.length);
-		list_del(&lseg->fi_list);
-		put_lseg_locked(lseg);
+		list_move(&lseg->fi_list, tmp_list);
 	}
 	if (list_empty(&lo->segs)) {
 		struct nfs_client *clp;
@@ -387,6 +367,21 @@ pnfs_clear_lseg_list(struct pnfs_layout_hdr *lo,
 	dprintk("%s:Return\n", __func__);
 }
 
+static void
+pnfs_free_lseg_list(struct list_head *tmp_list)
+{
+	struct pnfs_layout_segment *lseg;
+
+	while (!list_empty(tmp_list)) {
+		lseg = list_entry(tmp_list->next, struct pnfs_layout_segment,
+				fi_list);
+		dprintk("%s calling put_lseg on %p\n", __func__, lseg);
+		list_del(&lseg->fi_list);
+		put_lseg(lseg);
+	}
+}
+
+
 void
 pnfs_layoutget_release(struct pnfs_layout_hdr *lo)
 {
@@ -403,12 +398,14 @@ pnfs_layoutreturn_release(struct pnfs_layout_hdr *lo,
 			  struct pnfs_layout_range *range)
 {
 	struct nfs_inode *nfsi = NFS_I(lo->inode);
+	LIST_HEAD(tmp_list);
 
 	spin_lock(&nfsi->vfs_inode.i_lock);
 	if (range)
-		pnfs_clear_lseg_list(lo, range);
+		pnfs_clear_lseg_list(lo, &tmp_list, range);
 	put_layout_hdr_locked(lo); /* Matched in _pnfs_return_layout */
 	spin_unlock(&nfsi->vfs_inode.i_lock);
+	pnfs_free_lseg_list(&tmp_list);
 	wake_up_all(&nfsi->lo_waitq);
 }
 
@@ -421,11 +418,12 @@ pnfs_destroy_layout(struct nfs_inode *nfsi)
 		.offset = 0,
 		.length = NFS4_MAX_UINT64,
 	};
+	LIST_HEAD(tmp_list);
 
 	spin_lock(&nfsi->vfs_inode.i_lock);
 	lo = nfsi->layout;
 	if (lo) {
-		pnfs_clear_lseg_list(lo, &range);
+		pnfs_clear_lseg_list(lo, &tmp_list,  &range);
 		WARN_ON(!list_empty(&nfsi->layout->segs));
 		WARN_ON(!list_empty(&nfsi->layout->layouts));
 		WARN_ON(nfsi->layout->refcount != 1);
@@ -434,6 +432,7 @@ pnfs_destroy_layout(struct nfs_inode *nfsi)
 		put_layout_hdr_locked(lo);
 	}
 	spin_unlock(&nfsi->vfs_inode.i_lock);
+	pnfs_free_lseg_list(&tmp_list);
 }
 
 /*
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 1b1efcd..51f717d 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -177,7 +177,6 @@ extern int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool wait);
 
 /* pnfs.c */
 void put_lseg(struct pnfs_layout_segment *lseg);
-void put_lseg_locked(struct pnfs_layout_segment *lseg);
 struct pnfs_layout_segment *
 pnfs_has_layout(struct pnfs_layout_hdr *lo, struct pnfs_layout_range *range);
 struct pnfs_layout_segment *
-- 
1.6.6


^ permalink raw reply related

* [PATCH 1/3] pnfs_submit: move layout segment valid test
From: andros @ 2010-10-07 19:37 UTC (permalink / raw)
  To: bhalevy; +Cc: linux-nfs, Andy Adamson, Andy Adamson

From: Andy Adamson <andros@rhel6-1.androsmac.org>

Do not get_lseg for a non-valid lseg.
Prepare for calling put_lseg outside of inode i_lock.

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/pnfs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 6b2a95d..24620cf 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -845,7 +845,8 @@ pnfs_has_layout(struct pnfs_layout_hdr *lo,
 	list_for_each_entry(lseg, &lo->segs, fi_list) {
 		if (is_matching_lseg(lseg, range)) {
 			ret = lseg;
-			get_lseg(ret);
+			if (lseg->valid)
+				get_lseg(ret);
 			break;
 		}
 		if (cmp_layout(range, &lseg->range) > 0)
@@ -889,7 +890,6 @@ pnfs_update_layout(struct inode *ino,
 	/* Check to see if the layout for the given range already exists */
 	lseg = pnfs_has_layout(lo, &arg);
 	if (lseg && !lseg->valid) {
-		put_lseg_locked(lseg);
 		/* someone is cleaning the layout */
 		lseg = NULL;
 		goto out_unlock;
-- 
1.6.6


^ permalink raw reply related

* [PATCH] percpu_counter: change inaccurate comment
From: Eric Dumazet @ 2010-10-07 16:37 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

percpu_counter used to be huge objects, they are not anymore,
thanks to fine alloc_percpu() granularity.

We now consume 4 bytes per possible cpu.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 include/linux/percpu_counter.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
index 8a7d510..5e2cb5c 100644
--- a/include/linux/percpu_counter.h
+++ b/include/linux/percpu_counter.h
@@ -3,7 +3,8 @@
 /*
  * A simple "approximate counter" for use in ext2 and ext3 superblocks.
  *
- * WARNING: these things are HUGE.  4 kbytes per counter on 32-way P4.
+ * WARNING: these things are big :  4 bytes per possible cpu per counter.
+ * For a 64 cpus machine: 256 bytes + sizeof(struct percpu_counter)
  */
 
 #include <linux/spinlock.h>



^ permalink raw reply related

* Re: [GIT PULL] single block fix for 2.6.36
From: Jens Axboe @ 2010-10-07 16:36 UTC (permalink / raw)
  To: Jeff Moyer; +Cc: Linus Torvalds, linux-kernel@vger.kernel.org
In-Reply-To: <x49lj6a9i3x.fsf@segfault.boston.devel.redhat.com>

On 2010-10-07 16:45, Jeff Moyer wrote:
> Jens Axboe <jaxboe@fusionio.com> writes:
> 
>> Hi Linus,
>>
>> The API that was added for drivers to switch IO schedulers
>> when loaded does not work if the driver isn't in a fully
>> initialized state. The in-kernel ones call it right after
>> blk_init_queue(), which will result in an oops when the
>> elevator core tries to unregister unregistered kobjects.
> 
> Color me confused.  If the problem is trying to unregister unregistered
> objects, then why does your backtrace show a problem registering
> objects?

Probably mostly circumstantial, it ends up triggering deletions on
not-added kobjects. Why it triggers specifically in the addition I
haven't checked, I think it's running into a NULL parent (I noticed this
last week and got an oops, and iirc that's where it crashed in
sysfs_create_dir()).

So where it bombs does seem a bit confusing, but the reason for why is
as I outlined in the mail and in the changelog.

>     RIP: 0010:[<ffffffff8116f15e>]  [<ffffffff8116f15e>] sysfs_create_dir+0x2e/0xc0
> ...
>     Call Trace:
>      [<ffffffff8123fb77>] kobject_add_internal+0xe7/0x1f0
>      [<ffffffff8123fd98>] kobject_add_varg+0x38/0x60
>      [<ffffffff8123feb9>] kobject_add+0x69/0x90
>      [<ffffffff8116efe0>] ? sysfs_remove_dir+0x20/0xa0
>      [<ffffffff8103d48d>] ? sub_preempt_count+0x9d/0xe0
>      [<ffffffff8143de20>] ? _raw_spin_unlock+0x30/0x50
>      [<ffffffff8116efe0>] ? sysfs_remove_dir+0x20/0xa0
>      [<ffffffff8116eff4>] ? sysfs_remove_dir+0x34/0xa0
>      [<ffffffff81224204>] elv_register_queue+0x34/0xa0
>      [<ffffffff81224aad>] elevator_change+0xfd/0x250
>      [<ffffffffa007e000>] ? t_init+0x0/0x361 [t]
>      [<ffffffffa007e000>] ? t_init+0x0/0x361 [t]
>      [<ffffffffa007e0a8>] t_init+0xa8/0x361 [t]
>      [<ffffffff810001de>] do_one_initcall+0x3e/0x170
>      [<ffffffff8108c3fd>] sys_init_module+0xbd/0x220
>      [<ffffffff81002f2b>] system_call_fastpath+0x16/0x1b
> 
> I tried to track down what was going on, but I don't have your .config,
> so trying to pick things apart by guessing wasn't working out very well
> for me.  Also, your changelog entry in your tree is different from what
> you posted here (more complete) and you never posted a relevant patch to
> the list.

Just add an elevator_change(q, "noop"); or similar to any driver and
you'll see the issue. My .config doesn't matter, unless you are using
the S390 tape block driver or mGine flash block driver (mg_block). They
are the only users of that API.

I figured the folks that were truly interested would check the
changelog, the git pull requests are rarely as informative as the
individual changes. I actually thought I did pretty well on this one :-)

>> Add a registered bit and only do the unregister/register
>> dance in elevator_switch() if we need to. The other call
>> path for this is the sysfs parts to allow online switching,
>> which can only be called with a fully setup driver.
> 
> I don't doubt that you're right, but you certainly haven't given enough
> information for me to verify this in the 20 or 30 minutes I spent
> looking.

Did you try calling elevator_change? That should show the problem right
away, not in 20-30 minutes :-)

-- 
Jens Axboe


^ permalink raw reply

* Re: [PATCH 2/7] Bluetooth: Add LE connect support
From: Gustavo F. Padovan @ 2010-10-07 16:36 UTC (permalink / raw)
  To: Ville Tervo; +Cc: Marcel Holtmann, linux-bluetooth
In-Reply-To: <1286449089.6145.91.camel@aeonflux>

Hi Ville,

* Marcel Holtmann <marcel@holtmann.org> [2010-10-07 12:58:09 +0200]:

> Hi Ville,
> 
> > Add logic to create LE connections.


Could you be more verbose on the commit message, that way people can
understand better what you are doing in the patch. ;) 

> > 
> > Signed-off-by: Ville Tervo <ville.tervo@nokia.com>
> > ---
> >  include/net/bluetooth/hci.h      |    1 +
> >  include/net/bluetooth/hci_core.h |    6 ++-
> >  net/bluetooth/hci_conn.c         |   38 ++++++++++++++-
> >  net/bluetooth/hci_event.c        |  100 +++++++++++++++++++++++++++++++++++++-
> >  4 files changed, 141 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> > index b86aed5..b326240 100644
> > --- a/include/net/bluetooth/hci.h
> > +++ b/include/net/bluetooth/hci.h
> > @@ -162,6 +162,7 @@ enum {
> >  #define SCO_LINK	0x00
> >  #define ACL_LINK	0x01
> >  #define ESCO_LINK	0x02
> > +#define LE_LINK		0x03
> 
> this is not a value defined by the specification, while the others are.
> And some functions match these to HCI event. So if wanna do it like
> this, then using something like 0x80 is better.

A comment in the code saying that is also a good ideia.

-- 
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi

^ permalink raw reply

* Re: Assert CS, wait for IRQ, write data sequence
From: Grant Likely @ 2010-10-07 16:36 UTC (permalink / raw)
  To: Sergii Kovalchuk; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <201010061649.45237.sentinelofsetch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Wed, Oct 6, 2010 at 7:49 AM, Sergii Kovalchuk
<sentinelofsetch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi,
>
> I'm implementing an SPI protocol driver for TI WL12xx combo chip. According to
> the spec, for write transaction I should complete the following sequence:
>
> 1. Assert CS
> 2. Wait until chip will trigger IRQ
> 3. Write data
>
> Looking at spi_transfer structure I wondering, how I can implement such logic
> - there is no explicit ways to implement "wait for an event" within single
> spi_message processing.
>
> As current workarround I use a simple delay in 5 us, but for sleep states it
> might be not sufficient, since wake-up time are ususally greater.

Wow.  That's nasty.  The SPI layer really doesn't have a mechanism for
handling that.  What you *could* do is lock the spi bus; assert CS
manually; wait for the irq, and then issue the transfer.  Not exactly
pretty, but it would work within the existing infrastructure.

g.


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb

^ permalink raw reply

* Re: [PATCH v3] serio: add support for PS2Mult multiplexer protocol
From: Dmitry Torokhov @ 2010-10-07 16:36 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov; +Cc: linux-input
In-Reply-To: <AANLkTimZxi8V9SLFQ8N-oSDTSt+7PjLNPt=H=Ja2mpr9@mail.gmail.com>

On Thu, Oct 07, 2010 at 07:19:57PM +0400, Dmitry Eremin-Solenikov wrote:
> Hello,
> 
> On Thu, Sep 30, 2010 at 10:25 AM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Wed, Sep 29, 2010 at 04:45:53PM +0400, Dmitry Eremin-Solenikov wrote:
> >> On Thu, Sep 23, 2010 at 8:44 PM, Dmitry Eremin-Solenikov
> >> <dbaryshkov@gmail.com> wrote:
> >> > PS2Mult is a simple serial protocol used for multiplexing several PS/2 streams
> >> > into one serial data stream. It's used e.g. on TQM85xx serie of boards.
> >> >
> >> > Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> >> > ---
> >> >
> >> > It actually depends on "serio: multiple children" patch. I'm not resending it
> >> > as you were the originator of the latest version of the patch.
> >>
> >> So, what about this version of patch?
> >>
> >
> > Looks better but I think you also need ->start() to make sure you do not
> > try to deliver events too early. Does the following still work for you?
> 
> Sorry for the delay. Crashes w/o the attached patch.
> 

Ah, I see, however what I actually wanted is to create ports before hand
and handle any errors that might arise and then enable the device and
register child ports.

If you apply the patch below instead of yours does it still work?

Thanks.

-- 
Dmitry

Input: ps2mult - don't register ports twice

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

 drivers/input/serio/ps2mult.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)


diff --git a/drivers/input/serio/ps2mult.c b/drivers/input/serio/ps2mult.c
index 3664398..52b58de 100644
--- a/drivers/input/serio/ps2mult.c
+++ b/drivers/input/serio/ps2mult.c
@@ -144,9 +144,6 @@ static int ps2mult_create_port(struct ps2mult *psm, int i)
 	serio->parent = psm->mx_serio;
 	serio->port_data = &psm->ports[i];
 
-	serio_register_port(serio);
-	dev_info(&serio->dev, "%s port at %s\n", serio->name, mx_serio->phys);
-
 	return 0;
 }
 
@@ -196,8 +193,12 @@ static int ps2mult_connect(struct serio *serio, struct serio_driver *drv)
 
 	ps2mult_reset(psm);
 
-	for (i = 0; i <  PS2MULT_NUM_PORTS; i++)
-		serio_register_port(psm->ports[i].serio);
+	for (i = 0; i <  PS2MULT_NUM_PORTS; i++) {
+		struct serio *s = psm->ports[i].serio;
+
+		dev_info(&serio->dev, "%s port at %s\n", s->name, serio->phys);
+		serio_register_port(s);
+	}
 
 	return 0;
 

^ permalink raw reply related

* [refpolicy] [PATCH] hadoop 1/10 -- unconfined
From: Paul Nuzzi @ 2010-10-07 16:35 UTC (permalink / raw)
  To: refpolicy
In-Reply-To: <4CADDC29.6030606@gentoo.org>

On 10/07/2010 10:41 AM, Chris PeBenito wrote:
> On 10/05/10 15:59, Paul Nuzzi wrote:
>> On 10/04/2010 02:18 PM, Christopher J. PeBenito wrote:
>>> On 10/04/10 13:15, Paul Nuzzi wrote:
>>>> On 10/01/2010 01:56 PM, Christopher J. PeBenito wrote:
>>>>> On 10/01/10 11:17, Paul Nuzzi wrote:
>>>>>> On 10/01/2010 08:02 AM, Dominick Grift wrote:
>>>>>>> On Thu, Sep 30, 2010 at 03:39:40PM -0400, Paul Nuzzi wrote:
>>>>>>>> I updated the patch based on recommendations from the mailing list.
>>>>>>>> All of hadoop's services are included in one module instead of
>>>>>>>> individual ones.  Unconfined and sysadm roles are given access to
>>>>>>>> hadoop and zookeeper client domain transitions. The services are started
>>>>>>>> using run_init.  Let me know what you think.
>>>>>>>
>>>>>>> Why do some hadoop domain need to manage generic tmp?
>>>>>>>
>>>>>>> files_manage_generic_tmp_dirs(zookeeper_t)
>>>>>>> files_manage_generic_tmp_dirs(hadoop_t)
>>>>>>> files_manage_generic_tmp_dirs(hadoop_$1_initrc_t)
>>>>>>> files_manage_generic_tmp_files(hadoop_$1_initrc_t)
>>>>>>> files_manage_generic_tmp_files(hadoop_$1_t)
>>>>>>> files_manage_generic_tmp_dirs(hadoop_$1_t)
>>>>>>
>>>>>> This has to be done for Java JMX to work.  All of the files are written to
>>>>>> /tmp/hsperfdata_(hadoop/zookeeper). /tmp/hsperfdata_ is labeled tmp_t while
>>>>>> all the files for each service are labeled with hadoop_*_tmp_t.  The first service
>>>>>> will end up owning the directory if it is not labeled tmp_t.
>>>>>
>>>>> The hsperfdata dir in /tmp certainly the bane of policy writers.  Based on a quick look through the policy, it looks like the only dir they create in /tmp is this hsperfdata dir.  I suggest you do something like
>>>>>
>>>>> files_tmp_filetrans(hadoop_t, hadoop_hsperfdata_t, dir)
>>>>> files_tmp_filetrans(zookeeper_t, hadoop_hsperfdata_t, dir)
>>>>>
>>>>> filetrans_pattern(hadoop_t, hadoop_hsperfdata_t, hadoop_tmp_t, file)
>>>>> filetrans_pattern(zookeeper_t, hadoop_hsperfdata_t, zookeeper_tmp_t, file)
>>>>>
>>>>
>>>> That looks like a better way to handle the tmp_t problem.
>>>>
>>>> I changed the patch with your comments.  Hopefully this will be one of the last updates.
>>>> Tested on a CDH3 cluster as a module without any problems.
>>>
>>> There are several little issues with style, but it'll be easier just to fix them when its committed.
>>>
>>> Other comments inline.
>>>
>>
>> I did my best locking down the ports hadoop uses.  Unfortunately the services use high, randomized ports making
>> tcp_connect_generic_port a must have.  Hopefully one day hadoop will settle on static ports.  I added hadoop_datanode port 50010 since it is important to lock down that service.  I changed the patch based on the rest of the comments.
> 
> Merged.  I've made several changes:

Thanks to everyone who helped get this merged.

> 
> * a pass cleaning up the style.
> * adjusted some regular expressions in the file contexts: .* is the same as (.*)? since * means 0 or more matches.
> * renamed a few interfaces
> * two rules that I dropped as they require further explanation
> 
>> +files_read_all_files(hadoop_t)
> 
> A very big privilege.

"hadoop fs -put" takes any file you are allowed to access and puts it into the distributed file system.

> and
> 
>> +fs_associate(hadoop_tasktracker_t)

This might not be needed.

> This is a domain, so the only files with this type should be the /proc/pid ones, which don't require associate permissions.
> 
> 
>> ---
>>   policy/modules/kernel/corenetwork.te.in |    5
>>   policy/modules/roles/sysadm.te          |    8
>>   policy/modules/services/hadoop.fc       |   54 ++++
>>   policy/modules/services/hadoop.if       |  352 +++++++++++++++++++++++++++++
>>   policy/modules/services/hadoop.te       |  379 ++++++++++++++++++++++++++++++++
>>   policy/modules/system/unconfined.te     |    8
>>   6 files changed, 806 insertions(+)
>>
>> diff --git a/policy/modules/kernel/corenetwork.te.in b/policy/modules/kernel/corenetwork.te.in
>> index 2ecdde8..73163db 100644
>> --- a/policy/modules/kernel/corenetwork.te.in
>> +++ b/policy/modules/kernel/corenetwork.te.in
>> @@ -105,6 +105,8 @@ network_port(giftd, tcp,1213,s0)
>>   network_port(git, tcp,9418,s0, udp,9418,s0)
>>   network_port(gopher, tcp,70,s0, udp,70,s0)
>>   network_port(gpsd, tcp,2947,s0)
>> +network_port(hadoop_datanode, tcp, 50010,s0)
>> +network_port(hadoop_namenode, tcp, 8020,s0)
>>   network_port(hddtemp, tcp,7634,s0)
>>   network_port(howl, tcp,5335,s0, udp,5353,s0)
>>   network_port(hplip, tcp,1782,s0, tcp,2207,s0, tcp,2208,s0, tcp, 8290,s0, tcp,50000,s0, tcp,50002,s0, tcp,8292,s0, tcp,9100,s0, tcp,9101,s0, tcp,9102,s0, tcp,9220,s0, tcp,9221,s0, tcp,9222,s0, tcp,9280,s0, tcp,9281,s0, tcp,9282,s0, tcp,9290,s0, tcp,9291,s0, tcp,9292,s0)
>> @@ -211,6 +213,9 @@ network_port(xdmcp, udp,177,s0, tcp,177,s0)
>>   network_port(xen, tcp,8002,s0)
>>   network_port(xfs, tcp,7100,s0)
>>   network_port(xserver, tcp,6000-6020,s0)
>> +network_port(zookeeper_client, tcp, 2181,s0)
>> +network_port(zookeeper_election, tcp, 3888,s0)
>> +network_port(zookeeper_leader, tcp, 2888,s0)
>>   network_port(zebra, tcp,2600-2604,s0, tcp,2606,s0, udp,2600-2604,s0, udp,2606,s0)
>>   network_port(zope, tcp,8021,s0)
>>
>> diff --git a/policy/modules/roles/sysadm.te b/policy/modules/roles/sysadm.te
>> index cad05ff..d2bc2b1 100644
>> --- a/policy/modules/roles/sysadm.te
>> +++ b/policy/modules/roles/sysadm.te
>> @@ -152,6 +152,10 @@ optional_policy(`
>>   ')
>>
>>   optional_policy(`
>> +    hadoop_run(sysadm_t, sysadm_r)
>> +')
>> +
>> +optional_policy(`
>>       # allow system administrator to use the ipsec script to look
>>       # at things (e.g., ipsec auto --status)
>>       # probably should create an ipsec_admin role for this kind of thing
>> @@ -392,6 +396,10 @@ optional_policy(`
>>       yam_run(sysadm_t, sysadm_r)
>>   ')
>>
>> +optional_policy(`
>> +    hadoop_zookeeper_run_client(sysadm_t, sysadm_r)
>> +')
>> +
>>   ifndef(`distro_redhat',`
>>       optional_policy(`
>>           auth_role(sysadm_r, sysadm_t)
>> diff --git a/policy/modules/services/hadoop.fc b/policy/modules/services/hadoop.fc
>> new file mode 100644
>> index 0000000..a09275d
>> --- /dev/null
>> +++ b/policy/modules/services/hadoop.fc
>> @@ -0,0 +1,54 @@
>> +/etc/hadoop.*(/.*)?                        gen_context(system_u:object_r:hadoop_etc_t,s0)
>> +
>> +/etc/rc\.d/init\.d/hadoop-(.*)?-datanode        --    gen_context(system_u:object_r:hadoop_datanode_initrc_exec_t,s0)
>> +/etc/rc\.d/init\.d/hadoop-(.*)?-jobtracker        --    gen_context(system_u:object_r:hadoop_jobtracker_initrc_exec_t,s0)
>> +/etc/rc\.d/init\.d/hadoop-(.*)?-namenode        --    gen_context(system_u:object_r:hadoop_namenode_initrc_exec_t,s0)
>> +/etc/rc\.d/init\.d/hadoop-(.*)?-secondarynamenode    --    gen_context(system_u:object_r:hadoop_secondarynamenode_initrc_exec_t,s0)
>> +/etc/rc\.d/init\.d/hadoop-(.*)?-tasktracker        --    gen_context(system_u:object_r:hadoop_tasktracker_initrc_exec_t,s0)
>> +/etc/rc\.d/init\.d/hadoop-zookeeper            --    gen_context(system_u:object_r:zookeeper_server_initrc_exec_t,s0)
>> +/etc/init\.d/hadoop-datanode                --    gen_context(system_u:object_r:hadoop_datanode_initrc_exec_t,s0)
>> +/etc/init\.d/hadoop-jobtracker                --    gen_context(system_u:object_r:hadoop_jobtracker_initrc_exec_t,s0)
>> +/etc/init\.d/hadoop-namenode                --    gen_context(system_u:object_r:hadoop_namenode_initrc_exec_t,s0)
>> +/etc/init\.d/hadoop-secondarynamenode            --    gen_context(system_u:object_r:hadoop_secondarynamenode_initrc_exec_t,s0)
>> +/etc/init\.d/hadoop-tasktracker                --    gen_context(system_u:object_r:hadoop_tasktracker_initrc_exec_t,s0)
>> +/etc/init\.d/zookeeper                    --    gen_context(system_u:object_r:zookeeper_server_initrc_exec_t,s0)
>> +
>> +/etc/zookeeper(/.*)?                        gen_context(system_u:object_r:zookeeper_etc_t,s0)
>> +/etc/zookeeper\.dist(/.*)?                    gen_context(system_u:object_r:zookeeper_etc_t,s0)
>> +
>> +/usr/lib/hadoop(.*)?/bin/hadoop                --    gen_context(system_u:object_r:hadoop_exec_t,s0)
>> +
>> +/usr/bin/zookeeper-client                --    gen_context(system_u:object_r:zookeeper_exec_t,s0)
>> +/usr/bin/zookeeper-server                --    gen_context(system_u:object_r:zookeeper_server_exec_t,s0)
>> +
>> +/var/zookeeper(/.*)?                        gen_context(system_u:object_r:zookeeper_server_var_t,s0)
>> +/var/lib/zookeeper(/.*)?                    gen_context(system_u:object_r:zookeeper_server_var_t,s0)
>> +
>> +/var/lib/hadoop(.*)?                        gen_context(system_u:object_r:hadoop_var_lib_t,s0)
>> +/var/lib/hadoop(.*)?/cache/hadoop/dfs/data(/.*)?        gen_context(system_u:object_r:hadoop_datanode_var_lib_t,s0)
>> +/var/lib/hadoop(.*)?/cache/hadoop/dfs/name(/.*)?        gen_context(system_u:object_r:hadoop_namenode_var_lib_t,s0)
>> +/var/lib/hadoop(.*)?/cache/hadoop/dfs/namesecondary(/.*)?    gen_context(system_u:object_r:hadoop_secondarynamenode_var_lib_t,s0)
>> +/var/lib/hadoop(.*)?/cache/hadoop/mapred/local/jobTracker(/.*)?        gen_context(system_u:object_r:hadoop_jobtracker_var_lib_t,s0)
>> +/var/lib/hadoop(.*)?/cache/hadoop/mapred/local/taskTracker(/.*)?    gen_context(system_u:object_r:hadoop_tasktracker_var_lib_t,s0)
>> +
>> +/var/lock/subsys/hadoop-datanode            --    gen_context(system_u:object_r:hadoop_datanode_lock_t,s0)
>> +/var/lock/subsys/hadoop-namenode            --    gen_context(system_u:object_r:hadoop_namenode_lock_t,s0)
>> +/var/lock/subsys/hadoop-jobtracker            --    gen_context(system_u:object_r:hadoop_jobtracker_lock_t,s0)
>> +/var/lock/subsys/hadoop-tasktracker            --    gen_context(system_u:object_r:hadoop_tasktracker_lock_t,s0)
>> +/var/lock/subsys/hadoop-secondarynamenode        --    gen_context(system_u:object_r:hadoop_secondarynamenode_lock_t,s0)
>> +
>> +/var/log/hadoop(.*)?                        gen_context(system_u:object_r:hadoop_log_t,s0)
>> +/var/log/hadoop(.*)?/hadoop-hadoop-datanode-(.*)?        gen_context(system_u:object_r:hadoop_datanode_log_t,s0)
>> +/var/log/hadoop(.*)?/hadoop-hadoop-jobtracker-(.*)?        gen_context(system_u:object_r:hadoop_jobtracker_log_t,s0)
>> +/var/log/hadoop(.*)?/hadoop-hadoop-namenode-(.*)?        gen_context(system_u:object_r:hadoop_namenode_log_t,s0)
>> +/var/log/hadoop(.*)?/hadoop-hadoop-secondarynamenode-(.*)?    gen_context(system_u:object_r:hadoop_secondarynamenode_log_t,s0)
>> +/var/log/hadoop(.*)?/hadoop-hadoop-tasktracker-(.*)?        gen_context(system_u:object_r:hadoop_tasktracker_log_t,s0)
>> +/var/log/hadoop(.*)?/history(/.*)?                gen_context(system_u:object_r:hadoop_jobtracker_log_t,s0)
>> +/var/log/zookeeper(/.*)?                    gen_context(system_u:object_r:zookeeper_log_t,s0)
>> +
>> +/var/run/hadoop(.*)?                    -d    gen_context(system_u:object_r:hadoop_var_run_t,s0)
>> +/var/run/hadoop(.*)?/hadoop-hadoop-datanode\.pid    --    gen_context(system_u:object_r:hadoop_datanode_initrc_var_run_t,s0)
>> +/var/run/hadoop(.*)?/hadoop-hadoop-namenode\.pid    --    gen_context(system_u:object_r:hadoop_namenode_initrc_var_run_t,s0)
>> +/var/run/hadoop(.*)?/hadoop-hadoop-jobtracker\.pid    --    gen_context(system_u:object_r:hadoop_jobtracker_initrc_var_run_t,s0)
>> +/var/run/hadoop(.*)?/hadoop-hadoop-tasktracker\.pid    --    gen_context(system_u:object_r:hadoop_tasktracker_initrc_var_run_t,s0)
>> +/var/run/hadoop(.*)?/hadoop-hadoop-secondarynamenode\.pid    --    gen_context(system_u:object_r:hadoop_secondarynamenode_initrc_var_run_t,s0)
>> diff --git a/policy/modules/services/hadoop.if b/policy/modules/services/hadoop.if
>> new file mode 100644
>> index 0000000..e919bcb
>> --- /dev/null
>> +++ b/policy/modules/services/hadoop.if
>> @@ -0,0 +1,352 @@
>> +##<summary>Software for reliable, scalable, distributed computing.</summary>
>> +
>> +#######################################
>> +##<summary>
>> +##    The template to define a hadoop domain.
>> +##</summary>
>> +##<param name="domain_prefix">
>> +##    <summary>
>> +##    Domain prefix to be used.
>> +##    </summary>
>> +##</param>
>> +#
>> +template(`hadoop_domain_template',`
>> +    gen_require(`
>> +        attribute hadoop_domain;
>> +        type hadoop_log_t, hadoop_var_lib_t, hadoop_var_run_t;
>> +        type hadoop_exec_t, hadoop_hsperfdata_t;
>> +    ')
>> +
>> +    ########################################
>> +    #
>> +    # Shared declarations.
>> +    #
>> +
>> +    type hadoop_$1_t, hadoop_domain;
>> +    domain_type(hadoop_$1_t)
>> +    domain_entry_file(hadoop_$1_t, hadoop_exec_t)
>> +
>> +    type hadoop_$1_initrc_t;
>> +    type hadoop_$1_initrc_exec_t;
>> +    init_script_domain(hadoop_$1_initrc_t, hadoop_$1_initrc_exec_t)
>> +
>> +    role system_r types { hadoop_$1_initrc_t hadoop_$1_t };
>> +
>> +    type hadoop_$1_lock_t;
>> +    files_lock_file(hadoop_$1_lock_t)
>> +    files_lock_filetrans(hadoop_$1_initrc_t, hadoop_$1_lock_t, file)
>> +
>> +    type hadoop_$1_log_t;
>> +    logging_log_file(hadoop_$1_log_t)
>> +    filetrans_pattern(hadoop_$1_initrc_t, hadoop_log_t, hadoop_$1_log_t, {dir file})
>> +    filetrans_pattern(hadoop_$1_t, hadoop_log_t, hadoop_$1_log_t, {dir file})
>> +
>> +    type hadoop_$1_var_lib_t;
>> +    files_type(hadoop_$1_var_lib_t)
>> +    filetrans_pattern(hadoop_$1_t, hadoop_var_lib_t, hadoop_$1_var_lib_t, file)
>> +
>> +    type hadoop_$1_initrc_var_run_t;
>> +    files_pid_file(hadoop_$1_initrc_var_run_t)
>> +    filetrans_pattern(hadoop_$1_initrc_t, hadoop_var_run_t, hadoop_$1_initrc_var_run_t, file)
>> +
>> +    type hadoop_$1_tmp_t;
>> +    files_tmp_file(hadoop_$1_tmp_t)
>> +    files_tmp_filetrans(hadoop_$1_t, hadoop_hsperfdata_t, dir)
>> +    filetrans_pattern(hadoop_$1_t, hadoop_hsperfdata_t, hadoop_$1_tmp_t, file)
>> +
>> +    ####################################
>> +    #
>> +    # Shared hadoop_$1 initrc policy.
>> +    #
>> +
>> +    allow hadoop_$1_initrc_t hadoop_$1_t:process { signal signull };
>> +    allow hadoop_$1_initrc_t self:capability { setuid setgid };
>> +    allow hadoop_$1_initrc_t self:fifo_file rw_fifo_file_perms;
>> +    allow hadoop_$1_initrc_t self:process setsched;
>> +
>> +    consoletype_exec(hadoop_$1_initrc_t)
>> +    corecmd_exec_bin(hadoop_$1_initrc_t)
>> +    corecmd_exec_shell(hadoop_$1_initrc_t)
>> +
>> +    domtrans_pattern(hadoop_$1_initrc_t, hadoop_exec_t, hadoop_$1_t)
>> +    dontaudit hadoop_$1_initrc_t self:capability sys_tty_config;
>> +
>> +    files_read_etc_files(hadoop_$1_initrc_t)
>> +    files_read_usr_files(hadoop_$1_initrc_t)
>> +    files_search_pids(hadoop_$1_initrc_t)
>> +    files_search_locks(hadoop_$1_initrc_t)
>> +    fs_getattr_xattr_fs(hadoop_$1_initrc_t)
>> +
>> +    hadoop_exec_config_files(hadoop_$1_initrc_t)
>> +
>> +    init_rw_utmp(hadoop_$1_initrc_t)
>> +    init_use_script_ptys(hadoop_$1_initrc_t)
>> +
>> +    kernel_read_kernel_sysctls(hadoop_$1_initrc_t)
>> +    kernel_read_sysctl(hadoop_$1_initrc_t)
>> +    kernel_read_system_state(hadoop_$1_initrc_t)
>> +
>> +    logging_send_syslog_msg(hadoop_$1_initrc_t)
>> +    logging_send_audit_msgs(hadoop_$1_initrc_t)
>> +    logging_search_logs(hadoop_$1_initrc_t)
>> +
>> +    manage_files_pattern(hadoop_$1_initrc_t, hadoop_$1_lock_t, hadoop_$1_lock_t)
>> +    manage_files_pattern(hadoop_$1_initrc_t, hadoop_$1_initrc_var_run_t, hadoop_$1_initrc_var_run_t)
>> +    manage_files_pattern(hadoop_$1_initrc_t, hadoop_$1_log_t, hadoop_$1_log_t)
>> +    manage_dirs_pattern(hadoop_$1_initrc_t, hadoop_var_run_t, hadoop_var_run_t)
>> +    manage_files_pattern(hadoop_$1_initrc_t, hadoop_var_run_t, hadoop_var_run_t)
>> +
>> +    miscfiles_read_localization(hadoop_$1_initrc_t)
>> +
>> +    optional_policy(`
>> +        nscd_socket_use(hadoop_$1_initrc_t)
>> +    ')
>> +
>> +    term_use_generic_ptys(hadoop_$1_initrc_t)
>> +
>> +    userdom_dontaudit_search_user_home_dirs(hadoop_$1_initrc_t)
>> +
>> +    ####################################
>> +    #
>> +    # Shared hadoop_$1 policy.
>> +    #
>> +
>> +    allow hadoop_$1_t hadoop_domain:process signull;
>> +    allow hadoop_$1_t self:fifo_file rw_fifo_file_perms;
>> +    allow hadoop_$1_t self:process execmem;
>> +    allow hadoop_$1_t hadoop_var_run_t:dir getattr;
>> +
>> +    corecmd_exec_bin(hadoop_$1_t)
>> +    corecmd_exec_shell(hadoop_$1_t)
>> +
>> +    dev_read_rand(hadoop_$1_t)
>> +    dev_read_urand(hadoop_$1_t)
>> +    dev_read_sysfs(hadoop_$1_t)
>> +    dontaudit hadoop_$1_t self:netlink_route_socket rw_netlink_socket_perms;
>> +
>> +    files_read_etc_files(hadoop_$1_t)
>> +    files_search_pids(hadoop_$1_t)
>> +    files_search_var_lib(hadoop_$1_t)
>> +
>> +    hadoop_exec_config_files(hadoop_$1_t)
>> +
>> +    java_exec(hadoop_$1_t)
>> +
>> +    kernel_read_network_state(hadoop_$1_t)
>> +    kernel_read_system_state(hadoop_$1_t)
>> +
>> +    logging_search_logs(hadoop_$1_t)
>> +
>> +    manage_dirs_pattern(hadoop_$1_t, hadoop_$1_var_lib_t, hadoop_$1_var_lib_t)
>> +    manage_dirs_pattern(hadoop_$1_t, hadoop_hsperfdata_t, hadoop_hsperfdata_t)
>> +    manage_files_pattern(hadoop_$1_t, hadoop_$1_log_t, hadoop_$1_log_t)
>> +    manage_files_pattern(hadoop_$1_t, hadoop_$1_var_lib_t, hadoop_$1_var_lib_t)
>> +    manage_files_pattern(hadoop_$1_t, hadoop_$1_tmp_t, hadoop_$1_tmp_t)
>> +    miscfiles_read_localization(hadoop_$1_t)
>> +
>> +    optional_policy(`
>> +        nscd_socket_use(hadoop_$1_t)
>> +    ')
>> +
>> +    sysnet_read_config(hadoop_$1_t)
>> +
>> +    allow hadoop_$1_t self:tcp_socket create_stream_socket_perms;
>> +    corenet_all_recvfrom_unlabeled(hadoop_$1_t)
>> +    corenet_all_recvfrom_netlabel(hadoop_$1_t)
>> +    corenet_tcp_bind_all_nodes(hadoop_$1_t)
>> +    corenet_tcp_sendrecv_generic_if(hadoop_$1_t)
>> +    corenet_tcp_sendrecv_generic_node(hadoop_$1_t)
>> +    corenet_tcp_sendrecv_all_ports(hadoop_$1_t)
>> +    # Hadoop uses high ordered random ports for services
>> +    # If permanent ports are chosen, remove line below and lock down
>> +    corenet_tcp_connect_generic_port(hadoop_$1_t)
>> +
>> +    allow hadoop_$1_t self:udp_socket create_socket_perms;
>> +    corenet_udp_sendrecv_generic_if(hadoop_$1_t)
>> +    corenet_udp_sendrecv_all_nodes(hadoop_$1_t)
>> +    corenet_udp_bind_all_nodes(hadoop_$1_t)
>> +')
>> +
>> +########################################
>> +##<summary>
>> +##    Execute hadoop in the
>> +##    hadoop domain.
>> +##</summary>
>> +##<param name="domain">
>> +##    <summary>
>> +##    Domain allowed to transition.
>> +##    </summary>
>> +##</param>
>> +#
>> +interface(`hadoop_domtrans',`
>> +    gen_require(`
>> +        type hadoop_t, hadoop_exec_t;
>> +    ')
>> +
>> +    files_search_usr($1)
>> +    libs_search_lib($1)
>> +    domtrans_pattern($1, hadoop_exec_t, hadoop_t)
>> +')
>> +
>> +########################################
>> +##<summary>
>> +##    Execute hadoop in the hadoop domain,
>> +##    and allow the specified role the
>> +##    hadoop domain.
>> +##</summary>
>> +##<param name="domain">
>> +##    <summary>
>> +##    Domain allowed to transition.
>> +##    </summary>
>> +##</param>
>> +##<param name="role">
>> +##    <summary>
>> +##    Role allowed access.
>> +##    </summary>
>> +##</param>
>> +##<rolecap/>
>> +#
>> +interface(`hadoop_run',`
>> +    gen_require(`
>> +        type hadoop_t;
>> +    ')
>> +
>> +    hadoop_domtrans($1)
>> +    role $2 types hadoop_t;
>> +
>> +    allow $1 hadoop_t:process { ptrace signal_perms };
>> +    ps_process_pattern($1, hadoop_t)
>> +')
>> +
>> +########################################
>> +##<summary>
>> +##    Execute zookeeper client in the
>> +##    zookeeper client domain.
>> +##</summary>
>> +##<param name="domain">
>> +##    <summary>
>> +##    Domain allowed to transition.
>> +##    </summary>
>> +##</param>
>> +#
>> +interface(`hadoop_domtrans_zookeeper_client',`
>> +    gen_require(`
>> +        type zookeeper_t, zookeeper_exec_t;
>> +    ')
>> +
>> +    corecmd_search_bin($1)
>> +    files_search_usr($1)
>> +    domtrans_pattern($1, zookeeper_exec_t, zookeeper_t)
>> +')
>> +
>> +########################################
>> +##<summary>
>> +##    Execute zookeeper server in the
>> +##    zookeeper server domain.
>> +##</summary>
>> +##<param name="domain">
>> +##    <summary>
>> +##    Domain allowed to transition.
>> +##    </summary>
>> +##</param>
>> +#
>> +interface(`hadoop_domtrans_zookeeper_server',`
>> +    gen_require(`
>> +        type zookeeper_server_t, zookeeper_server_exec_t;
>> +    ')
>> +
>> +    corecmd_search_bin($1)
>> +    files_search_usr($1)
>> +    domtrans_pattern($1, zookeeper_server_exec_t, zookeeper_server_t)
>> +')
>> +
>> +########################################
>> +##<summary>
>> +##    Execute zookeeper server in the
>> +##    zookeeper domain.
>> +##</summary>
>> +##<param name="domain">
>> +##    <summary>
>> +##    Domain allowed to transition.
>> +##    </summary>
>> +##</param>
>> +#
>> +interface(`hadoop_zookeeper_initrc_domtrans_server',`
>> +    gen_require(`
>> +        type zookeeper_server_initrc_exec_t;
>> +    ')
>> +
>> +    init_labeled_script_domtrans($1, zookeeper_server_initrc_exec_t)
>> +')
>> +
>> +########################################
>> +##<summary>
>> +##    Execute zookeeper client in the
>> +##    zookeeper client domain, and allow the
>> +##    specified role the zookeeper client domain.
>> +##</summary>
>> +##<param name="domain">
>> +##    <summary>
>> +##    Domain allowed to transition.
>> +##    </summary>
>> +##</param>
>> +##<param name="role">
>> +##    <summary>
>> +##    Role allowed access.
>> +##    </summary>
>> +##</param>
>> +##<rolecap/>
>> +#
>> +interface(`hadoop_zookeeper_run_client',`
>> +    gen_require(`
>> +        type zookeeper_t;
>> +    ')
>> +
>> +    hadoop_domtrans_zookeeper_client($1)
>> +    role $2 types zookeeper_t;
>> +
>> +    allow $1 zookeeper_t:process { ptrace signal_perms };
>> +    ps_process_pattern($1, zookeeper_t)
>> +')
>> +
>> +########################################
>> +##<summary>
>> +##  Give permission to a domain to read
>> +##  hadoop_etc_t
>> +##</summary>
>> +##<param name="domain">
>> +##<summary>
>> +##  Domain needing read permission
>> +##</summary>
>> +##</param>
>> +#
>> +interface(`hadoop_read_config_files', `
>> +    gen_require(`
>> +        type hadoop_etc_t;
>> +    ')
>> +
>> +    allow $1 hadoop_etc_t:dir search_dir_perms;
>> +    allow $1 hadoop_etc_t:lnk_file { read getattr };
>> +    allow $1 hadoop_etc_t:file read_file_perms;
>> +')
>> +
>> +########################################
>> +##<summary>
>> +##  Give permission to a domain to
>> +##  execute hadoop_etc_t
>> +##</summary>
>> +##<param name="domain">
>> +##<summary>
>> +##  Domain needing read and execute
>> +##  permission
>> +##</summary>
>> +##</param>
>> +#
>> +interface(`hadoop_exec_config_files', `
>> +    gen_require(`
>> +        type hadoop_etc_t;
>> +    ')
>> +
>> +    hadoop_read_config_files($1)
>> +    allow $1 hadoop_etc_t:file { execute execute_no_trans};
>> +')
>> diff --git a/policy/modules/services/hadoop.te b/policy/modules/services/hadoop.te
>> new file mode 100644
>> index 0000000..587c393
>> --- /dev/null
>> +++ b/policy/modules/services/hadoop.te
>> @@ -0,0 +1,379 @@
>> +policy_module(hadoop, 1.0.0)
>> +
>> +########################################
>> +#
>> +# Hadoop declarations.
>> +#
>> +
>> +attribute hadoop_domain;
>> +
>> +type hadoop_t;
>> +type hadoop_exec_t;
>> +application_domain(hadoop_t, hadoop_exec_t)
>> +ubac_constrained(hadoop_t)
>> +
>> +type hadoop_etc_t;
>> +files_config_file(hadoop_etc_t)
>> +
>> +type hadoop_var_lib_t;
>> +files_type(hadoop_var_lib_t)
>> +
>> +type hadoop_log_t;
>> +logging_log_file(hadoop_log_t)
>> +
>> +type hadoop_var_run_t;
>> +files_pid_file(hadoop_var_run_t)
>> +
>> +type hadoop_tmp_t;
>> +files_tmp_file(hadoop_tmp_t)
>> +ubac_constrained(hadoop_tmp_t)
>> +
>> +type hadoop_hsperfdata_t;
>> +files_tmp_file(hadoop_hsperfdata_t)
>> +ubac_constrained(hadoop_hsperfdata_t)
>> +
>> +hadoop_domain_template(datanode)
>> +hadoop_domain_template(jobtracker)
>> +hadoop_domain_template(namenode)
>> +hadoop_domain_template(secondarynamenode)
>> +hadoop_domain_template(tasktracker)
>> +
>> +########################################
>> +#
>> +# Hadoop zookeeper client declarations.
>> +#
>> +
>> +type zookeeper_t;
>> +type zookeeper_exec_t;
>> +application_domain(zookeeper_t, zookeeper_exec_t)
>> +ubac_constrained(zookeeper_t)
>> +
>> +type zookeeper_etc_t;
>> +files_config_file(zookeeper_etc_t)
>> +
>> +type zookeeper_log_t;
>> +logging_log_file(zookeeper_log_t)
>> +
>> +type zookeeper_tmp_t;
>> +files_tmp_file(zookeeper_tmp_t)
>> +ubac_constrained(zookeeper_tmp_t)
>> +
>> +########################################
>> +#
>> +# Hadoop zookeeper server declarations.
>> +#
>> +
>> +type zookeeper_server_t;
>> +type zookeeper_server_exec_t;
>> +init_daemon_domain(zookeeper_server_t, zookeeper_server_exec_t)
>> +
>> +type zookeeper_server_initrc_exec_t;
>> +init_script_file(zookeeper_server_initrc_exec_t)
>> +
>> +type zookeeper_server_var_t;
>> +files_type(zookeeper_server_var_t)
>> +
>> +# This will need a file context specification.
>> +type zookeeper_server_var_run_t;
>> +files_pid_file(zookeeper_server_var_run_t)
>> +
>> +type zookeeper_server_tmp_t;
>> +files_tmp_file(zookeeper_server_tmp_t)
>> +
>> +########################################
>> +#
>> +# Hadoop policy.
>> +#
>> +
>> +allow hadoop_t self:capability sys_resource;
>> +allow hadoop_t self:process { getsched setsched signal signull setrlimit execmem };
>> +allow hadoop_t self:fifo_file rw_fifo_file_perms;
>> +allow hadoop_t self:key write;
>> +allow hadoop_t self:tcp_socket create_stream_socket_perms;
>> +allow hadoop_t self:udp_socket create_socket_perms;
>> +allow hadoop_t hadoop_domain:process signull;
>> +
>> +dontaudit hadoop_t self:netlink_route_socket rw_netlink_socket_perms;
>> +
>> +read_files_pattern(hadoop_t, hadoop_etc_t, hadoop_etc_t)
>> +read_lnk_files_pattern(hadoop_t, hadoop_etc_t, hadoop_etc_t)
>> +can_exec(hadoop_t, hadoop_etc_t)
>> +
>> +manage_dirs_pattern(hadoop_t, hadoop_var_lib_t, hadoop_var_lib_t)
>> +manage_dirs_pattern(hadoop_t, hadoop_log_t, hadoop_log_t)
>> +manage_dirs_pattern(hadoop_t, hadoop_tmp_t, hadoop_tmp_t)
>> +manage_dirs_pattern(hadoop_t, hadoop_hsperfdata_t, hadoop_hsperfdata_t)
>> +manage_files_pattern(hadoop_t, hadoop_var_lib_t, hadoop_var_lib_t)
>> +manage_files_pattern(hadoop_t, hadoop_tmp_t, hadoop_tmp_t)
>> +
>> +getattr_dirs_pattern(hadoop_t, hadoop_var_run_t, hadoop_var_run_t)
>> +
>> +files_tmp_filetrans(hadoop_t, hadoop_hsperfdata_t, dir)
>> +filetrans_pattern(hadoop_t, hadoop_hsperfdata_t, hadoop_tmp_t, file)
>> +
>> +kernel_read_network_state(hadoop_t)
>> +kernel_read_system_state(hadoop_t)
>> +
>> +corecmd_exec_bin(hadoop_t)
>> +corecmd_exec_shell(hadoop_t)
>> +
>> +corenet_all_recvfrom_unlabeled(hadoop_t)
>> +corenet_all_recvfrom_netlabel(hadoop_t)
>> +corenet_sendrecv_hadoop_namenode_client_packets(hadoop_t)
>> +corenet_sendrecv_portmap_client_packets(hadoop_t)
>> +corenet_sendrecv_zope_client_packets(hadoop_t)
>> +corenet_tcp_bind_all_nodes(hadoop_t)
>> +corenet_tcp_connect_hadoop_namenode_port(hadoop_t)
>> +corenet_tcp_connect_hadoop_datanode_port(hadoop_t)
>> +corenet_tcp_connect_portmap_port(hadoop_t)
>> +corenet_tcp_connect_zope_port(hadoop_t)
>> +corenet_tcp_sendrecv_all_nodes(hadoop_t)
>> +corenet_tcp_sendrecv_all_ports(hadoop_t)
>> +corenet_tcp_sendrecv_generic_if(hadoop_t)
>> +# Hadoop uses high ordered random ports for services
>> +# If permanent ports are chosen, remove line below and lock down
>> +corenet_tcp_connect_generic_port(hadoop_t)
>> +corenet_udp_bind_all_nodes(hadoop_t)
>> +corenet_udp_sendrecv_all_nodes(hadoop_t)
>> +corenet_udp_sendrecv_all_ports(hadoop_t)
>> +corenet_udp_sendrecv_generic_if(hadoop_t)
>> +
>> +dev_read_rand(hadoop_t)
>> +dev_read_sysfs(hadoop_t)
>> +dev_read_urand(hadoop_t)
>> +
>> +files_dontaudit_search_spool(hadoop_t)
>> +files_read_usr_files(hadoop_t)
>> +files_read_all_files(hadoop_t)
>> +
>> +fs_getattr_xattr_fs(hadoop_t)
>> +
>> +java_exec(hadoop_t)
>> +
>> +miscfiles_read_localization(hadoop_t)
>> +
>> +userdom_dontaudit_search_user_home_dirs(hadoop_t)
>> +userdom_use_user_terminals(hadoop_t)
>> +
>> +optional_policy(`
>> +    nis_use_ypbind(hadoop_t)
>> +')
>> +
>> +optional_policy(`
>> +    nscd_socket_use(hadoop_t)
>> +')
>> +
>> +########################################
>> +#
>> +# Hadoop datanode policy.
>> +#
>> +
>> +allow hadoop_datanode_t self:process signal;
>> +corenet_tcp_bind_hadoop_datanode_port(hadoop_datanode_t)
>> +corenet_tcp_connect_hadoop_datanode_port(hadoop_datanode_t)
>> +corenet_tcp_connect_hadoop_namenode_port(hadoop_datanode_t)
>> +fs_getattr_xattr_fs(hadoop_datanode_t)
>> +manage_dirs_pattern(hadoop_datanode_t, hadoop_var_lib_t, hadoop_var_lib_t)
>> +
>> +########################################
>> +#
>> +# Hadoop jobtracker policy.
>> +#
>> +
>> +corenet_tcp_bind_zope_port(hadoop_jobtracker_t)
>> +corenet_tcp_connect_hadoop_datanode_port(hadoop_jobtracker_t)
>> +corenet_tcp_connect_hadoop_namenode_port(hadoop_jobtracker_t)
>> +create_dirs_pattern(hadoop_jobtracker_t, hadoop_jobtracker_log_t, hadoop_jobtracker_log_t)
>> +manage_dirs_pattern(hadoop_jobtracker_t, hadoop_var_lib_t, hadoop_var_lib_t)
>> +setattr_dirs_pattern(hadoop_jobtracker_t, hadoop_jobtracker_log_t, hadoop_jobtracker_log_t)
>> +
>> +########################################
>> +#
>> +# Hadoop namenode policy.
>> +#
>> +
>> +corenet_tcp_bind_hadoop_namenode_port(hadoop_namenode_t)
>> +corenet_tcp_connect_hadoop_namenode_port(hadoop_namenode_t)
>> +manage_dirs_pattern(hadoop_namenode_t, hadoop_var_lib_t, hadoop_var_lib_t)
>> +manage_files_pattern(hadoop_namenode_t, hadoop_var_lib_t, hadoop_var_lib_t)
>> +
>> +########################################
>> +#
>> +# Hadoop secondary namenode policy.
>> +#
>> +
>> +corenet_tcp_connect_hadoop_namenode_port(hadoop_secondarynamenode_t)
>> +manage_dirs_pattern(hadoop_secondarynamenode_t, hadoop_var_lib_t, hadoop_var_lib_t)
>> +
>> +########################################
>> +#
>> +# Hadoop tasktracker policy.
>> +#
>> +
>> +allow hadoop_tasktracker_t self:process signal;
>> +
>> +corenet_tcp_connect_hadoop_datanode_port(hadoop_tasktracker_t)
>> +corenet_tcp_connect_hadoop_namenode_port(hadoop_tasktracker_t)
>> +corenet_tcp_connect_zope_port(hadoop_tasktracker_t)
>> +
>> +filetrans_pattern(hadoop_tasktracker_t, hadoop_log_t, hadoop_tasktracker_log_t, dir)
>> +fs_associate(hadoop_tasktracker_t)
>> +fs_getattr_xattr_fs(hadoop_tasktracker_t)
>> +
>> +manage_dirs_pattern(hadoop_tasktracker_t, hadoop_var_lib_t, hadoop_var_lib_t)
>> +manage_dirs_pattern(hadoop_tasktracker_t, hadoop_tasktracker_log_t, hadoop_tasktracker_log_t);
>> +
>> +########################################
>> +#
>> +# Hadoop zookeeper client policy.
>> +#
>> +
>> +allow zookeeper_t self:process { getsched sigkill signal signull execmem };
>> +allow zookeeper_t self:fifo_file rw_fifo_file_perms;
>> +allow zookeeper_t self:tcp_socket create_stream_socket_perms;
>> +allow zookeeper_t self:udp_socket create_socket_perms;
>> +allow zookeeper_t zookeeper_server_t:process signull;
>> +
>> +read_files_pattern(zookeeper_t, zookeeper_etc_t, zookeeper_etc_t)
>> +read_lnk_files_pattern(zookeeper_t, zookeeper_etc_t, zookeeper_etc_t)
>> +
>> +setattr_dirs_pattern(zookeeper_t, zookeeper_log_t, zookeeper_log_t)
>> +append_files_pattern(zookeeper_t, zookeeper_log_t, zookeeper_log_t)
>> +create_files_pattern(zookeeper_t, zookeeper_log_t, zookeeper_log_t)
>> +read_files_pattern(zookeeper_t, zookeeper_log_t, zookeeper_log_t)
>> +setattr_files_pattern(zookeeper_t, zookeeper_log_t, zookeeper_log_t)
>> +logging_log_filetrans(zookeeper_t, zookeeper_log_t, file)
>> +
>> +manage_dirs_pattern(zookeeper_t, hadoop_hsperfdata_t, hadoop_hsperfdata_t)
>> +manage_files_pattern(zookeeper_t, zookeeper_tmp_t, zookeeper_tmp_t)
>> +files_tmp_filetrans(zookeeper_t, hadoop_hsperfdata_t, dir)
>> +filetrans_pattern(zookeeper_t, hadoop_hsperfdata_t, zookeeper_tmp_t, file)
>> +
>> +can_exec(zookeeper_t, zookeeper_exec_t)
>> +
>> +kernel_read_network_state(zookeeper_t)
>> +kernel_read_system_state(zookeeper_t)
>> +
>> +corecmd_exec_bin(zookeeper_t)
>> +corecmd_exec_shell(zookeeper_t)
>> +
>> +dontaudit zookeeper_t self:netlink_route_socket rw_netlink_socket_perms;
>> +
>> +corenet_all_recvfrom_unlabeled(zookeeper_t)
>> +corenet_all_recvfrom_netlabel(zookeeper_t)
>> +corenet_sendrecv_zookeeper_client_client_packets(zookeeper_t)
>> +corenet_tcp_bind_all_nodes(zookeeper_t)
>> +corenet_tcp_connect_zookeeper_client_port(zookeeper_t)
>> +corenet_tcp_sendrecv_all_nodes(zookeeper_t)
>> +corenet_tcp_sendrecv_all_ports(zookeeper_t)
>> +corenet_tcp_sendrecv_generic_if(zookeeper_t)
>> +# Hadoop uses high ordered random ports for services
>> +# If permanent ports are chosen, remove line below and lock down
>> +corenet_tcp_connect_generic_port(zookeeper_t)
>> +corenet_udp_bind_all_nodes(zookeeper_t)
>> +corenet_udp_sendrecv_all_nodes(zookeeper_t)
>> +corenet_udp_sendrecv_all_ports(zookeeper_t)
>> +corenet_udp_sendrecv_generic_if(zookeeper_t)
>> +
>> +dev_read_rand(zookeeper_t)
>> +dev_read_sysfs(zookeeper_t)
>> +dev_read_urand(zookeeper_t)
>> +
>> +files_read_etc_files(zookeeper_t)
>> +files_read_usr_files(zookeeper_t)
>> +
>> +miscfiles_read_localization(zookeeper_t)
>> +
>> +sysnet_read_config(zookeeper_t)
>> +
>> +userdom_dontaudit_search_user_home_dirs(zookeeper_t)
>> +userdom_use_user_terminals(zookeeper_t)
>> +
>> +java_exec(zookeeper_t)
>> +
>> +optional_policy(`
>> +    nscd_socket_use(zookeeper_t)
>> +')
>> +
>> +########################################
>> +#
>> +# Hadoop zookeeper server policy.
>> +#
>> +
>> +allow zookeeper_server_t self:capability kill;
>> +allow zookeeper_server_t self:process { execmem getsched sigkill signal signull };
>> +allow zookeeper_server_t self:fifo_file rw_fifo_file_perms;
>> +allow zookeeper_server_t self:netlink_route_socket rw_netlink_socket_perms;
>> +allow zookeeper_server_t self:tcp_socket create_stream_socket_perms;
>> +allow zookeeper_server_t self:udp_socket create_socket_perms;
>> +
>> +read_files_pattern(zookeeper_server_t, zookeeper_etc_t, zookeeper_etc_t)
>> +read_lnk_files_pattern(zookeeper_server_t, zookeeper_etc_t, zookeeper_etc_t)
>> +
>> +manage_dirs_pattern(zookeeper_server_t, zookeeper_server_var_t, zookeeper_server_var_t)
>> +manage_files_pattern(zookeeper_server_t, zookeeper_server_var_t, zookeeper_server_var_t)
>> +files_var_lib_filetrans(zookeeper_server_t, zookeeper_server_var_t, { dir file })
>> +
>> +setattr_dirs_pattern(zookeeper_server_t, zookeeper_log_t, zookeeper_log_t)
>> +append_files_pattern(zookeeper_server_t, zookeeper_log_t, zookeeper_log_t)
>> +create_files_pattern(zookeeper_server_t, zookeeper_log_t, zookeeper_log_t)
>> +read_files_pattern(zookeeper_server_t, zookeeper_log_t, zookeeper_log_t)
>> +setattr_files_pattern(zookeeper_server_t, zookeeper_log_t, zookeeper_log_t)
>> +logging_log_filetrans(zookeeper_server_t, zookeeper_log_t, file)
>> +
>> +manage_files_pattern(zookeeper_server_t, zookeeper_server_var_run_t, zookeeper_server_var_run_t)
>> +files_pid_filetrans(zookeeper_server_t, zookeeper_server_var_run_t, file)
>> +
>> +manage_dirs_pattern(zookeeper_server_t, hadoop_hsperfdata_t, hadoop_hsperfdata_t)
>> +manage_files_pattern(zookeeper_server_t, zookeeper_server_tmp_t, zookeeper_server_tmp_t)
>> +files_tmp_filetrans(zookeeper_server_t, hadoop_hsperfdata_t, dir)
>> +filetrans_pattern(zookeeper_server_t, hadoop_hsperfdata_t, zookeeper_server_tmp_t, file)
>> +
>> +can_exec(zookeeper_server_t, zookeeper_server_exec_t)
>> +
>> +kernel_read_network_state(zookeeper_server_t)
>> +kernel_read_system_state(zookeeper_server_t)
>> +
>> +corecmd_exec_bin(zookeeper_server_t)
>> +corecmd_exec_shell(zookeeper_server_t)
>> +
>> +corenet_all_recvfrom_unlabeled(zookeeper_server_t)
>> +corenet_all_recvfrom_netlabel(zookeeper_server_t)
>> +corenet_sendrecv_zookeeper_election_client_packets(zookeeper_server_t)
>> +corenet_sendrecv_zookeeper_leader_client_packets(zookeeper_server_t)
>> +corenet_sendrecv_zookeeper_client_server_packets(zookeeper_server_t)
>> +corenet_sendrecv_zookeeper_election_server_packets(zookeeper_server_t)
>> +corenet_sendrecv_zookeeper_leader_server_packets(zookeeper_server_t)
>> +corenet_tcp_bind_all_nodes(zookeeper_server_t)
>> +corenet_tcp_bind_zookeeper_client_port(zookeeper_server_t)
>> +corenet_tcp_bind_zookeeper_election_port(zookeeper_server_t)
>> +corenet_tcp_bind_zookeeper_leader_port(zookeeper_server_t)
>> +corenet_tcp_connect_zookeeper_election_port(zookeeper_server_t)
>> +corenet_tcp_connect_zookeeper_leader_port(zookeeper_server_t)
>> +corenet_tcp_sendrecv_generic_if(zookeeper_server_t)
>> +corenet_tcp_sendrecv_generic_node(zookeeper_server_t)
>> +corenet_tcp_sendrecv_all_ports(zookeeper_server_t)
>> +# Hadoop uses high ordered random ports for services
>> +# If permanent ports are chosen, remove line below and lock down
>> +corenet_tcp_connect_generic_port(zookeeper_server_t)
>> +corenet_udp_sendrecv_generic_if(zookeeper_server_t)
>> +corenet_udp_sendrecv_all_nodes(zookeeper_server_t)
>> +corenet_udp_sendrecv_all_ports(zookeeper_server_t)
>> +corenet_udp_bind_all_nodes(zookeeper_server_t)
>> +
>> +dev_read_rand(zookeeper_server_t)
>> +dev_read_sysfs(zookeeper_server_t)
>> +dev_read_urand(zookeeper_server_t)
>> +
>> +files_read_etc_files(zookeeper_server_t)
>> +files_read_usr_files(zookeeper_server_t)
>> +
>> +fs_getattr_xattr_fs(zookeeper_server_t)
>> +
>> +logging_send_syslog_msg(zookeeper_server_t)
>> +
>> +miscfiles_read_localization(zookeeper_server_t)
>> +
>> +sysnet_read_config(zookeeper_server_t)
>> +
>> +java_exec(zookeeper_server_t)
>> diff --git a/policy/modules/system/unconfined.te b/policy/modules/system/unconfined.te
>> index f976344..f1e6c9f 100644
>> --- a/policy/modules/system/unconfined.te
>> +++ b/policy/modules/system/unconfined.te
>> @@ -118,6 +118,10 @@ optional_policy(`
>>   ')
>>
>>   optional_policy(`
>> +    hadoop_run(unconfined_t, unconfined_r)
>> +')
>> +
>> +optional_policy(`
>>       inn_domtrans(unconfined_t)
>>   ')
>>
>> @@ -210,6 +214,10 @@ optional_policy(`
>>       xserver_domtrans(unconfined_t)
>>   ')
>>
>> +optional_policy(`
>> +    hadoop_zookeeper_run_client(unconfined_t, unconfined_r)
>> +')
>> +
>>   ########################################
>>   #
>>   # Unconfined Execmem Local policy
> 
> 

^ permalink raw reply


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.